OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2013 the V8 project authors. All rights reserved. | 2 # Copyright 2013 the V8 project authors. All rights reserved. |
3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
5 # met: | 5 # met: |
6 # | 6 # |
7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
10 # copyright notice, this list of conditions and the following | 10 # copyright notice, this list of conditions and the following |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 | 220 |
221 | 221 |
222 class CommonOptions(object): | 222 class CommonOptions(object): |
223 def __init__(self, options, manual=True): | 223 def __init__(self, options, manual=True): |
224 self.requires_editor = True | 224 self.requires_editor = True |
225 self.wait_for_lgtm = True | 225 self.wait_for_lgtm = True |
226 self.s = options.s | 226 self.s = options.s |
227 self.force_readline_defaults = not manual | 227 self.force_readline_defaults = not manual |
228 self.force_upload = not manual | 228 self.force_upload = not manual |
229 self.manual = manual | 229 self.manual = manual |
| 230 self.author = getattr(options, 'a', None) |
230 | 231 |
231 | 232 |
232 class Step(object): | 233 class Step(object): |
233 def __init__(self, text, requires, number, config, state, options, handler): | 234 def __init__(self, text, requires, number, config, state, options, handler): |
234 self._text = text | 235 self._text = text |
235 self._requires = requires | 236 self._requires = requires |
236 self._number = number | 237 self._number = number |
237 self._config = config | 238 self._config = config |
238 self._state = state | 239 self._state = state |
239 self._options = options | 240 self._options = options |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 MESSAGE = "Upload for code review." | 462 MESSAGE = "Upload for code review." |
462 | 463 |
463 def RunStep(self): | 464 def RunStep(self): |
464 if self._options.r: | 465 if self._options.r: |
465 print "Using account %s for review." % self._options.r | 466 print "Using account %s for review." % self._options.r |
466 reviewer = self._options.r | 467 reviewer = self._options.r |
467 else: | 468 else: |
468 print "Please enter the email address of a V8 reviewer for your patch: ", | 469 print "Please enter the email address of a V8 reviewer for your patch: ", |
469 self.DieNoManualMode("A reviewer must be specified in forced mode.") | 470 self.DieNoManualMode("A reviewer must be specified in forced mode.") |
470 reviewer = self.ReadLine() | 471 reviewer = self.ReadLine() |
| 472 author_option = self._options.author |
| 473 author = " --email \"%s\"" % author_option if author_option else "" |
471 force_flag = " -f" if self._options.force_upload else "" | 474 force_flag = " -f" if self._options.force_upload else "" |
472 args = "cl upload -r \"%s\" --send-mail%s" % (reviewer, force_flag) | 475 args = ("cl upload%s -r \"%s\" --send-mail%s" |
| 476 % (author, reviewer, force_flag)) |
473 # TODO(machenbach): Check output in forced mode. Verify that all required | 477 # TODO(machenbach): Check output in forced mode. Verify that all required |
474 # base files were uploaded, if not retry. | 478 # base files were uploaded, if not retry. |
475 if self.Git(args, pipe=False) is None: | 479 if self.Git(args, pipe=False) is None: |
476 self.Die("'git cl upload' failed, please try again.") | 480 self.Die("'git cl upload' failed, please try again.") |
477 | 481 |
478 | 482 |
479 def MakeStep(step_class=Step, number=0, state=None, config=None, | 483 def MakeStep(step_class=Step, number=0, state=None, config=None, |
480 options=None, side_effect_handler=DEFAULT_SIDE_EFFECT_HANDLER): | 484 options=None, side_effect_handler=DEFAULT_SIDE_EFFECT_HANDLER): |
481 # Allow to pass in empty dictionaries. | 485 # Allow to pass in empty dictionaries. |
482 state = state if state is not None else {} | 486 state = state if state is not None else {} |
(...skipping 18 matching lines...) Expand all Loading... |
501 options, | 505 options, |
502 side_effect_handler=DEFAULT_SIDE_EFFECT_HANDLER): | 506 side_effect_handler=DEFAULT_SIDE_EFFECT_HANDLER): |
503 state = {} | 507 state = {} |
504 steps = [] | 508 steps = [] |
505 for (number, step_class) in enumerate(step_classes): | 509 for (number, step_class) in enumerate(step_classes): |
506 steps.append(MakeStep(step_class, number, state, config, | 510 steps.append(MakeStep(step_class, number, state, config, |
507 options, side_effect_handler)) | 511 options, side_effect_handler)) |
508 | 512 |
509 for step in steps[options.s:]: | 513 for step in steps[options.s:]: |
510 step.Run() | 514 step.Run() |
OLD | NEW |