diff options
| author | Bryan Jacobs <bryanrj@gmail.com> | 2013-05-06 13:36:24 -0400 |
|---|---|---|
| committer | Bryan Jacobs <bryanrj@gmail.com> | 2013-05-24 12:17:22 -0400 |
| commit | f609f91b72c0b90026da0eefcc0f52f12840971b (patch) | |
| tree | 819e244e52279d7b232df5e17727a9a828ddda66 /project.py | |
| parent | 59bbb580e34bbc5dce76dacaad9ff94f21fa396f (diff) | |
| download | git-repo-f609f91b72c0b90026da0eefcc0f52f12840971b.tar.gz git-repo-f609f91b72c0b90026da0eefcc0f52f12840971b.zip | |
Send reviews to a different branch from fetch
This adds the ability to have reviews pushed to a different branch
from the one on which changes are based. This is useful for "gateway"
systems without smartsync.
Change-Id: I3a8a0fabcaf6055e62d3fb55f89c944e2f81569f
Diffstat (limited to 'project.py')
| -rw-r--r-- | project.py | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/project.py b/project.py index f299297d7..5a7a6ca80 100644 --- a/project.py +++ b/project.py @@ -157,11 +157,12 @@ class ReviewableBranch(object): R_HEADS + self.name, '--') - def UploadForReview(self, people, auto_topic=False, draft=False): + def UploadForReview(self, people, auto_topic=False, draft=False, dest_branch=None): self.project.UploadForReview(self.name, people, auto_topic=auto_topic, - draft=draft) + draft=draft, + dest_branch=dest_branch) def GetPublishedRefs(self): refs = {} @@ -497,7 +498,8 @@ class Project(object): clone_depth = None, upstream = None, parent = None, - is_derived = False): + is_derived = False, + dest_branch = None): """Init a Project object. Args: @@ -517,6 +519,7 @@ class Project(object): parent: The parent Project object. is_derived: False if the project was explicitly defined in the manifest; True if the project is a discovered submodule. + dest_branch: The branch to which to push changes for review by default. """ self.manifest = manifest self.name = name @@ -559,6 +562,7 @@ class Project(object): self.work_git = None self.bare_git = self._GitGetByExec(self, bare=True) self.bare_ref = GitRefs(gitdir) + self.dest_branch = dest_branch # This will be filled in if a project is later identified to be the # project containing repo hooks. @@ -908,7 +912,8 @@ class Project(object): def UploadForReview(self, branch=None, people=([],[]), auto_topic=False, - draft=False): + draft=False, + dest_branch=None): """Uploads the named branch for code review. """ if branch is None: @@ -922,7 +927,10 @@ class Project(object): if not branch.remote.review: raise GitError('remote %s has no review url' % branch.remote.name) - dest_branch = branch.merge + if dest_branch is None: + dest_branch = self.dest_branch + if dest_branch is None: + dest_branch = branch.merge if not dest_branch.startswith(R_HEADS): dest_branch = R_HEADS + dest_branch |
