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
diff --git a/subcmds/upload.py b/subcmds/upload.py
index 13b8778..4a22e26 100644
--- a/subcmds/upload.py
+++ b/subcmds/upload.py
@@ -146,6 +146,10 @@
p.add_option('-d', '--draft',
action='store_true', dest='draft', default=False,
help='If specified, upload as a draft.')
+ p.add_option('-D', '--destination', '--dest',
+ type='string', action='store', dest='dest_branch',
+ metavar='BRANCH',
+ help='Submit for review on this target branch.')
# Options relating to upload hook. Note that verify and no-verify are NOT
# opposites of each other, which is why they store to different locations.
@@ -185,7 +189,8 @@
date = branch.date
commit_list = branch.commits
- print('Upload project %s/ to remote branch %s:' % (project.relpath, project.revisionExpr))
+ destination = project.dest_branch or project.revisionExpr
+ print('Upload project %s/ to remote branch %s:' % (project.relpath, destination))
print(' branch %s (%2d commit%s, %s):' % (
name,
len(commit_list),
@@ -336,7 +341,7 @@
key = 'review.%s.uploadtopic' % branch.project.remote.review
opt.auto_topic = branch.project.config.GetBoolean(key)
- branch.UploadForReview(people, auto_topic=opt.auto_topic, draft=opt.draft)
+ branch.UploadForReview(people, auto_topic=opt.auto_topic, draft=opt.draft, dest_branch=opt.dest_branch)
branch.uploaded = True
except UploadError as e:
branch.error = e