Revert "Migrate git-repo to create private changes rather than drafts"

This reverts commit d88f53e2b9. I merged
it too hastily without paying enough attention to compatibility with
released Gerrit versions.

Change-Id: I4028d4737df1255f11e217da183a19a010597d5b
This commit is contained in:
Jonathan Nieder 2017-08-08 18:34:53 +00:00
parent d88f53e2b9
commit c94d6eb902
2 changed files with 13 additions and 4 deletions

View File

@ -175,12 +175,14 @@ class ReviewableBranch(object):
def UploadForReview(self, people, def UploadForReview(self, people,
auto_topic=False, auto_topic=False,
draft=False,
private=False, private=False,
wip=False, wip=False,
dest_branch=None): dest_branch=None):
self.project.UploadForReview(self.name, self.project.UploadForReview(self.name,
people, people,
auto_topic=auto_topic, auto_topic=auto_topic,
draft=draft,
private=private, private=private,
wip=wip, wip=wip,
dest_branch=dest_branch) dest_branch=dest_branch)
@ -1108,6 +1110,7 @@ class Project(object):
def UploadForReview(self, branch=None, def UploadForReview(self, branch=None,
people=([], []), people=([], []),
auto_topic=False, auto_topic=False,
draft=False,
private=False, private=False,
wip=False, wip=False,
dest_branch=None): dest_branch=None):
@ -1153,7 +1156,12 @@ class Project(object):
if dest_branch.startswith(R_HEADS): if dest_branch.startswith(R_HEADS):
dest_branch = dest_branch[len(R_HEADS):] dest_branch = dest_branch[len(R_HEADS):]
ref_spec = '%s:refs/for/%s' % (R_HEADS + branch.name, dest_branch) upload_type = 'for'
if draft:
upload_type = 'drafts'
ref_spec = '%s:refs/%s/%s' % (R_HEADS + branch.name, upload_type,
dest_branch)
if auto_topic: if auto_topic:
ref_spec = ref_spec + '/' + branch.name ref_spec = ref_spec + '/' + branch.name

View File

@ -152,8 +152,8 @@ Gerrit Code Review: http://code.google.com/p/gerrit/
dest='current_branch', action='store_true', dest='current_branch', action='store_true',
help='Upload current git branch.') help='Upload current git branch.')
p.add_option('-d', '--draft', p.add_option('-d', '--draft',
action='store_true', dest='private', default=False, action='store_true', dest='draft', default=False,
help='(Deprecated). If specified, upload as a private change.') help='If specified, upload as a draft.')
p.add_option('-p', '--private', p.add_option('-p', '--private',
action='store_true', dest='private', default=False, action='store_true', dest='private', default=False,
help='If specified, upload as a private change.') help='If specified, upload as a private change.')
@ -205,7 +205,7 @@ Gerrit Code Review: http://code.google.com/p/gerrit/
destination = opt.dest_branch or project.dest_branch or project.revisionExpr destination = opt.dest_branch or project.dest_branch or project.revisionExpr
print('Upload project %s/ to remote branch %s%s:' % print('Upload project %s/ to remote branch %s%s:' %
(project.relpath, destination, ' (private)' if opt.private else '')) (project.relpath, destination, ' (draft)' if opt.draft else ''))
print(' branch %s (%2d commit%s, %s):' % ( print(' branch %s (%2d commit%s, %s):' % (
name, name,
len(commit_list), len(commit_list),
@ -386,6 +386,7 @@ Gerrit Code Review: http://code.google.com/p/gerrit/
branch.UploadForReview(people, branch.UploadForReview(people,
auto_topic=opt.auto_topic, auto_topic=opt.auto_topic,
draft=opt.draft,
private=opt.private, private=opt.private,
wip=opt.wip, wip=opt.wip,
dest_branch=destination) dest_branch=destination)