You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by jo...@apache.org on 2014/02/20 00:07:26 UTC

git commit: [#6902] ticket:534 set the current branch to the target branch in merge request

Repository: incubator-allura
Updated Branches:
  refs/heads/master c32547b42 -> 88cdedb5d


[#6902] ticket:534 set the current branch to the target branch in merge request


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/88cdedb5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/88cdedb5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/88cdedb5

Branch: refs/heads/master
Commit: 88cdedb5d148e19a46f92678bcd5bb02f505d586
Parents: c32547b
Author: Yuriy Arhipov <yu...@yandex.ru>
Authored: Wed Feb 12 16:23:50 2014 +0400
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Wed Feb 19 23:07:13 2014 +0000

----------------------------------------------------------------------
 Allura/allura/model/repository.py                   |  7 ++++++-
 .../forgegit/tests/functional/test_controllers.py   | 16 ++++++++++++++++
 2 files changed, 22 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/88cdedb5/Allura/allura/model/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repository.py b/Allura/allura/model/repository.py
index 4a00f52..2c08017 100644
--- a/Allura/allura/model/repository.py
+++ b/Allura/allura/model/repository.py
@@ -727,9 +727,14 @@ class MergeRequest(VersionedArtifact, ActivityObject):
 
     def _commits(self):
         with self.push_downstream_context():
+            rev = self.app.repo.latest(branch=self.target_branch)
+            if rev:
+                commit = rev._id
+            else:
+                commit = self.app.repo.head
             return list(c.app.repo.log(
                 self.downstream.commit_id,
-                exclude=self.app.repo.head,
+                exclude=commit,
                 id_only=False))
 
     @classmethod

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/88cdedb5/ForgeGit/forgegit/tests/functional/test_controllers.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/functional/test_controllers.py b/ForgeGit/forgegit/tests/functional/test_controllers.py
index e4ccc51..282c773 100644
--- a/ForgeGit/forgegit/tests/functional/test_controllers.py
+++ b/ForgeGit/forgegit/tests/functional/test_controllers.py
@@ -580,6 +580,22 @@ class TestFork(_TestCase):
         assert_equal(_select_val(r, 'source_branch'), 'zz')
         assert_equal(_select_val(r, 'target_branch'), 'zz')
 
+    def test_merge_request_with_branch(self):
+        r = self.app.post('/p/test2/code/do_request_merge',
+                          params={
+                              'source_branch': 'zz',
+                              'target_branch': 'zz',
+                              'summary': 'summary',
+                              'description': 'description'}).follow()
+        assert '[5c4724]' not in r
+        r = self.app.post('/p/test2/code/do_request_merge',
+                          params={
+                              'source_branch': 'zz',
+                              'target_branch': 'master',
+                              'summary': 'summary',
+                              'description': 'description'}).follow()
+        assert '[5c4724]' in r
+
 
 class TestDiff(TestController):