diff options
author | Changcheng Xiao <xchangcheng@google.com> | 2017-08-07 15:05:46 +0200 |
---|---|---|
committer | Changcheng Xiao <xchangcheng@google.com> | 2017-08-07 15:08:18 +0200 |
commit | d88f53e2b9634b9645f80b2d8e653beac24711fe (patch) | |
tree | 7fc6d88e282aa7d11322549f900b6708f135ab3f | |
parent | 87984c6db4962043c2b9e5a5a4a30eaf6d066077 (diff) | |
download | git-repo-d88f53e2b9634b9645f80b2d8e653beac24711fe.tar.gz |
Migrate git-repo to create private changes rather than drafts
Considering that some users might expect changes created with
'-d' option are not public. Private changes may be a better
choice here than work-in-progress changes.
Change-Id: I46a8fb9ae38beb41cf96d6abe82bea6db2439669
-rw-r--r-- | project.py | 10 | ||||
-rw-r--r-- | subcmds/upload.py | 7 |
2 files changed, 4 insertions, 13 deletions
@@ -175,14 +175,12 @@ 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, | ||
179 | private=False, | 178 | private=False, |
180 | wip=False, | 179 | wip=False, |
181 | dest_branch=None): | 180 | dest_branch=None): |
182 | self.project.UploadForReview(self.name, | 181 | self.project.UploadForReview(self.name, |
183 | people, | 182 | people, |
184 | auto_topic=auto_topic, | 183 | auto_topic=auto_topic, |
185 | draft=draft, | ||
186 | private=private, | 184 | private=private, |
187 | wip=wip, | 185 | wip=wip, |
188 | dest_branch=dest_branch) | 186 | dest_branch=dest_branch) |
@@ -1110,7 +1108,6 @@ class Project(object): | |||
1110 | def UploadForReview(self, branch=None, | 1108 | def UploadForReview(self, branch=None, |
1111 | people=([], []), | 1109 | people=([], []), |
1112 | auto_topic=False, | 1110 | auto_topic=False, |
1113 | draft=False, | ||
1114 | private=False, | 1111 | private=False, |
1115 | wip=False, | 1112 | wip=False, |
1116 | dest_branch=None): | 1113 | dest_branch=None): |
@@ -1156,12 +1153,7 @@ class Project(object): | |||
1156 | if dest_branch.startswith(R_HEADS): | 1153 | if dest_branch.startswith(R_HEADS): |
1157 | dest_branch = dest_branch[len(R_HEADS):] | 1154 | dest_branch = dest_branch[len(R_HEADS):] |
1158 | 1155 | ||
1159 | upload_type = 'for' | 1156 | ref_spec = '%s:refs/for/%s' % (R_HEADS + branch.name, dest_branch) |
1160 | if draft: | ||
1161 | upload_type = 'drafts' | ||
1162 | |||
1163 | ref_spec = '%s:refs/%s/%s' % (R_HEADS + branch.name, upload_type, | ||
1164 | dest_branch) | ||
1165 | if auto_topic: | 1157 | if auto_topic: |
1166 | ref_spec = ref_spec + '/' + branch.name | 1158 | ref_spec = ref_spec + '/' + branch.name |
1167 | 1159 | ||
diff --git a/subcmds/upload.py b/subcmds/upload.py index 61b18bc2..f40ac9df 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='draft', default=False, | 155 | action='store_true', dest='private', default=False, |
156 | help='If specified, upload as a draft.') | 156 | help='(Deprecated). If specified, upload as a private change.') |
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, ' (draft)' if opt.draft else '')) | 208 | (project.relpath, destination, ' (private)' if opt.private 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,7 +386,6 @@ 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, | ||
390 | private=opt.private, | 389 | private=opt.private, |
391 | wip=opt.wip, | 390 | wip=opt.wip, |
392 | dest_branch=destination) | 391 | dest_branch=destination) |