diff options
Diffstat (limited to 'subcmds')
| -rw-r--r-- | subcmds/upload.py | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/subcmds/upload.py b/subcmds/upload.py index 5a426113..569e31c1 100644 --- a/subcmds/upload.py +++ b/subcmds/upload.py | |||
| @@ -111,6 +111,9 @@ Gerrit Code Review: http://code.google.com/p/gerrit/ | |||
| 111 | """ | 111 | """ |
| 112 | 112 | ||
| 113 | def _Options(self, p): | 113 | def _Options(self, p): |
| 114 | p.add_option('-t', | ||
| 115 | dest='auto_topic', action='store_true', | ||
| 116 | help='Send local branch name to Gerrit Code Review') | ||
| 114 | p.add_option('--replace', | 117 | p.add_option('--replace', |
| 115 | dest='replace', action='store_true', | 118 | dest='replace', action='store_true', |
| 116 | help='Upload replacement patchesets from this branch') | 119 | help='Upload replacement patchesets from this branch') |
| @@ -121,7 +124,7 @@ Gerrit Code Review: http://code.google.com/p/gerrit/ | |||
| 121 | type='string', action='append', dest='cc', | 124 | type='string', action='append', dest='cc', |
| 122 | help='Also send email to these email addresses.') | 125 | help='Also send email to these email addresses.') |
| 123 | 126 | ||
| 124 | def _SingleBranch(self, branch, people): | 127 | def _SingleBranch(self, opt, branch, people): |
| 125 | project = branch.project | 128 | project = branch.project |
| 126 | name = branch.name | 129 | name = branch.name |
| 127 | remote = project.GetBranch(name).remote | 130 | remote = project.GetBranch(name).remote |
| @@ -154,11 +157,11 @@ Gerrit Code Review: http://code.google.com/p/gerrit/ | |||
| 154 | answer = _ConfirmManyUploads() | 157 | answer = _ConfirmManyUploads() |
| 155 | 158 | ||
| 156 | if answer: | 159 | if answer: |
| 157 | self._UploadAndReport([branch], people) | 160 | self._UploadAndReport(opt, [branch], people) |
| 158 | else: | 161 | else: |
| 159 | _die("upload aborted by user") | 162 | _die("upload aborted by user") |
| 160 | 163 | ||
| 161 | def _MultipleBranches(self, pending, people): | 164 | def _MultipleBranches(self, opt, pending, people): |
| 162 | projects = {} | 165 | projects = {} |
| 163 | branches = {} | 166 | branches = {} |
| 164 | 167 | ||
| @@ -227,7 +230,7 @@ Gerrit Code Review: http://code.google.com/p/gerrit/ | |||
| 227 | if not _ConfirmManyUploads(multiple_branches=True): | 230 | if not _ConfirmManyUploads(multiple_branches=True): |
| 228 | _die("upload aborted by user") | 231 | _die("upload aborted by user") |
| 229 | 232 | ||
| 230 | self._UploadAndReport(todo, people) | 233 | self._UploadAndReport(opt, todo, people) |
| 231 | 234 | ||
| 232 | def _AppendAutoCcList(self, branch, people): | 235 | def _AppendAutoCcList(self, branch, people): |
| 233 | """ | 236 | """ |
| @@ -311,9 +314,9 @@ Gerrit Code Review: http://code.google.com/p/gerrit/ | |||
| 311 | _die("upload aborted by user") | 314 | _die("upload aborted by user") |
| 312 | 315 | ||
| 313 | branch.replace_changes = to_replace | 316 | branch.replace_changes = to_replace |
| 314 | self._UploadAndReport([branch], people) | 317 | self._UploadAndReport(opt, [branch], people) |
| 315 | 318 | ||
| 316 | def _UploadAndReport(self, todo, original_people): | 319 | def _UploadAndReport(self, opt, todo, original_people): |
| 317 | have_errors = False | 320 | have_errors = False |
| 318 | for branch in todo: | 321 | for branch in todo: |
| 319 | try: | 322 | try: |
| @@ -335,7 +338,7 @@ Gerrit Code Review: http://code.google.com/p/gerrit/ | |||
| 335 | branch.error = 'User aborted' | 338 | branch.error = 'User aborted' |
| 336 | continue | 339 | continue |
| 337 | 340 | ||
| 338 | branch.UploadForReview(people) | 341 | branch.UploadForReview(people, auto_topic=opt.auto_topic) |
| 339 | branch.uploaded = True | 342 | branch.uploaded = True |
| 340 | except UploadError, e: | 343 | except UploadError, e: |
| 341 | branch.error = e | 344 | branch.error = e |
| @@ -391,6 +394,6 @@ Gerrit Code Review: http://code.google.com/p/gerrit/ | |||
| 391 | if not pending: | 394 | if not pending: |
| 392 | print >>sys.stdout, "no branches ready for upload" | 395 | print >>sys.stdout, "no branches ready for upload" |
| 393 | elif len(pending) == 1 and len(pending[0][1]) == 1: | 396 | elif len(pending) == 1 and len(pending[0][1]) == 1: |
| 394 | self._SingleBranch(pending[0][1][0], people) | 397 | self._SingleBranch(opt, pending[0][1][0], people) |
| 395 | else: | 398 | else: |
| 396 | self._MultipleBranches(pending, people) | 399 | self._MultipleBranches(opt, pending, people) |
