incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [6/9] git commit: [#4665] ticket:401 added source_branch to MergeRequest
Date Thu, 08 Aug 2013 15:09:43 GMT
[#4665] ticket:401 added source_branch to MergeRequest


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

Branch: refs/heads/cj/6464
Commit: 439222c6079a3e56b2551316a84f1872d5397f53
Parents: 2b78927
Author: Anton Kasyanov <mind1master@gmail.com>
Authored: Wed Jul 31 12:59:16 2013 +0300
Committer: Cory Johns <cjohns@slashdotmedia.com>
Committed: Wed Aug 7 22:35:27 2013 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/repository.py |  1 +
 Allura/allura/model/repository.py       |  1 +
 ForgeGit/forgegit/model/git_repo.py     | 15 +++++++++++++--
 3 files changed, 15 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/439222c6/Allura/allura/controllers/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/repository.py b/Allura/allura/controllers/repository.py
index d9331c7..aaf9f6a 100644
--- a/Allura/allura/controllers/repository.py
+++ b/Allura/allura/controllers/repository.py
@@ -178,6 +178,7 @@ class RepoRootController(BaseController, FeedController):
             mr = M.MergeRequest.upsert(
                 downstream=downstream,
                 target_branch=kw['target_branch'],
+                source_branch=kw['source_branch'],
                 summary=kw['summary'],
                 description=kw['description'])
             M.Notification.post(

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/439222c6/Allura/allura/model/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repository.py b/Allura/allura/model/repository.py
index a3d9a44..e29cd0a 100644
--- a/Allura/allura/model/repository.py
+++ b/Allura/allura/model/repository.py
@@ -557,6 +557,7 @@ class MergeRequest(VersionedArtifact, ActivityObject):
             project_id=S.ObjectId,
             mount_point=str,
             commit_id=str))
+    source_branch=FieldProperty(str,if_missing='')
     target_branch=FieldProperty(str)
     creator_id=FieldProperty(S.ObjectId, if_missing=lambda:c.user._id)
     created=FieldProperty(datetime, if_missing=datetime.utcnow)

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/439222c6/ForgeGit/forgegit/model/git_repo.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/model/git_repo.py b/ForgeGit/forgegit/model/git_repo.py
index 9906c0b..a982b2b 100644
--- a/ForgeGit/forgegit/model/git_repo.py
+++ b/ForgeGit/forgegit/model/git_repo.py
@@ -78,9 +78,20 @@ class Repository(M.Repository):
 
     def merge_command(self, merge_request):
         '''Return the command to merge a given commit to a given target branch'''
-        return 'git checkout %s\ngit fetch %s\ngit merge %s' % (
+        if merge_request.source_branch:
+            fetch_command = 'git fetch {} {}'.format(
+                merge_request.downstream_repo_url,
+                merge_request.source_branch,
+            )
+        else:
+            fetch_command = 'git fetch {} {} # warning: '\
+            'no source branch specified'.format(
+                merge_request.downstream_repo_url,
+                '<source_branch>',
+            )
+        return 'git checkout %s\n%s\ngit merge %s' % (
             merge_request.target_branch,
-            merge_request.downstream_repo_url,
+            fetch_command,
             merge_request.downstream.commit_id,
         )
 


Mime
View raw message