Revert "Migrate git-repo to create private changes rather than drafts"
This reverts commit d88f53e2b9634b9645f80b2d8e653beac24711fe. I merged
it too hastily without paying enough attention to compatibility with
released Gerrit versions.
Change-Id: I4028d4737df1255f11e217da183a19a010597d5b
diff --git a/project.py b/project.py
index 5e20951..0b7baee 100644
--- a/project.py
+++ b/project.py
@@ -175,12 +175,14 @@
def UploadForReview(self, people,
auto_topic=False,
+ draft=False,
private=False,
wip=False,
dest_branch=None):
self.project.UploadForReview(self.name,
people,
auto_topic=auto_topic,
+ draft=draft,
private=private,
wip=wip,
dest_branch=dest_branch)
@@ -1108,6 +1110,7 @@
def UploadForReview(self, branch=None,
people=([], []),
auto_topic=False,
+ draft=False,
private=False,
wip=False,
dest_branch=None):
@@ -1153,7 +1156,12 @@
if dest_branch.startswith(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:
ref_spec = ref_spec + '/' + branch.name
diff --git a/subcmds/upload.py b/subcmds/upload.py
index f40ac9d..61b18bc 100644
--- a/subcmds/upload.py
+++ b/subcmds/upload.py
@@ -152,8 +152,8 @@
dest='current_branch', action='store_true',
help='Upload current git branch.')
p.add_option('-d', '--draft',
- action='store_true', dest='private', default=False,
- help='(Deprecated). If specified, upload as a private change.')
+ action='store_true', dest='draft', default=False,
+ help='If specified, upload as a draft.')
p.add_option('-p', '--private',
action='store_true', dest='private', default=False,
help='If specified, upload as a private change.')
@@ -205,7 +205,7 @@
destination = opt.dest_branch or project.dest_branch or project.revisionExpr
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):' % (
name,
len(commit_list),
@@ -386,6 +386,7 @@
branch.UploadForReview(people,
auto_topic=opt.auto_topic,
+ draft=opt.draft,
private=opt.private,
wip=opt.wip,
dest_branch=destination)