summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--project.py10
-rw-r--r--subcmds/upload.py7
2 files changed, 13 insertions, 4 deletions
diff --git a/project.py b/project.py
index 5e209510..0b7baeed 100644
--- a/project.py
+++ b/project.py
@@ -175,12 +175,14 @@ class ReviewableBranch(object):
175 175
176 def UploadForReview(self, people, 176 def UploadForReview(self, people,
177 auto_topic=False, 177 auto_topic=False,
178 draft=False,
178 private=False, 179 private=False,
179 wip=False, 180 wip=False,
180 dest_branch=None): 181 dest_branch=None):
181 self.project.UploadForReview(self.name, 182 self.project.UploadForReview(self.name,
182 people, 183 people,
183 auto_topic=auto_topic, 184 auto_topic=auto_topic,
185 draft=draft,
184 private=private, 186 private=private,
185 wip=wip, 187 wip=wip,
186 dest_branch=dest_branch) 188 dest_branch=dest_branch)
@@ -1108,6 +1110,7 @@ class Project(object):
1108 def UploadForReview(self, branch=None, 1110 def UploadForReview(self, branch=None,
1109 people=([], []), 1111 people=([], []),
1110 auto_topic=False, 1112 auto_topic=False,
1113 draft=False,
1111 private=False, 1114 private=False,
1112 wip=False, 1115 wip=False,
1113 dest_branch=None): 1116 dest_branch=None):
@@ -1153,7 +1156,12 @@ class Project(object):
1153 if dest_branch.startswith(R_HEADS): 1156 if dest_branch.startswith(R_HEADS):
1154 dest_branch = dest_branch[len(R_HEADS):] 1157 dest_branch = dest_branch[len(R_HEADS):]
1155 1158
1156 ref_spec = '%s:refs/for/%s' % (R_HEADS + branch.name, dest_branch) 1159 upload_type = 'for'
1160 if draft:
1161 upload_type = 'drafts'
1162
1163 ref_spec = '%s:refs/%s/%s' % (R_HEADS + branch.name, upload_type,
1164 dest_branch)
1157 if auto_topic: 1165 if auto_topic:
1158 ref_spec = ref_spec + '/' + branch.name 1166 ref_spec = ref_spec + '/' + branch.name
1159 1167
diff --git a/subcmds/upload.py b/subcmds/upload.py
index f40ac9df..61b18bc2 100644
--- a/subcmds/upload.py
+++ b/subcmds/upload.py
@@ -152,8 +152,8 @@ Gerrit Code Review: http://code.google.com/p/gerrit/
152 dest='current_branch', action='store_true', 152 dest='current_branch', action='store_true',
153 help='Upload current git branch.') 153 help='Upload current git branch.')
154 p.add_option('-d', '--draft', 154 p.add_option('-d', '--draft',
155 action='store_true', dest='private', default=False, 155 action='store_true', dest='draft', default=False,
156 help='(Deprecated). If specified, upload as a private change.') 156 help='If specified, upload as a draft.')
157 p.add_option('-p', '--private', 157 p.add_option('-p', '--private',
158 action='store_true', dest='private', default=False, 158 action='store_true', dest='private', default=False,
159 help='If specified, upload as a private change.') 159 help='If specified, upload as a private change.')
@@ -205,7 +205,7 @@ Gerrit Code Review: http://code.google.com/p/gerrit/
205 205
206 destination = opt.dest_branch or project.dest_branch or project.revisionExpr 206 destination = opt.dest_branch or project.dest_branch or project.revisionExpr
207 print('Upload project %s/ to remote branch %s%s:' % 207 print('Upload project %s/ to remote branch %s%s:' %
208 (project.relpath, destination, ' (private)' if opt.private else '')) 208 (project.relpath, destination, ' (draft)' if opt.draft else ''))
209 print(' branch %s (%2d commit%s, %s):' % ( 209 print(' branch %s (%2d commit%s, %s):' % (
210 name, 210 name,
211 len(commit_list), 211 len(commit_list),
@@ -386,6 +386,7 @@ Gerrit Code Review: http://code.google.com/p/gerrit/
386 386
387 branch.UploadForReview(people, 387 branch.UploadForReview(people,
388 auto_topic=opt.auto_topic, 388 auto_topic=opt.auto_topic,
389 draft=opt.draft,
389 private=opt.private, 390 private=opt.private,
390 wip=opt.wip, 391 wip=opt.wip,
391 dest_branch=destination) 392 dest_branch=destination)