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
This commit is contained in:
Bryan Jacobs
2013-05-06 13:36:24 -04:00
parent 59bbb580e3
commit f609f91b72
4 changed files with 50 additions and 20 deletions

View File

@ -146,6 +146,10 @@ Gerrit Code Review: http://code.google.com/p/gerrit/
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 @@ Gerrit Code Review: http://code.google.com/p/gerrit/
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 @@ Gerrit Code Review: http://code.google.com/p/gerrit/
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