| 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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 args = "apply --index --reject %s \"%s\"" % (reverse_patch, patch_file) | 363 args = "apply --index --reject %s \"%s\"" % (reverse_patch, patch_file) |
| 364 if self.Git(args) is None: | 364 if self.Git(args) is None: |
| 365 self.WaitForResolvingConflicts(patch_file) | 365 self.WaitForResolvingConflicts(patch_file) |
| 366 | 366 |
| 367 | 367 |
| 368 class UploadStep(Step): | 368 class UploadStep(Step): |
| 369 def __init__(self): | 369 def __init__(self): |
| 370 Step.__init__(self, "Upload for code review.") | 370 Step.__init__(self, "Upload for code review.") |
| 371 | 371 |
| 372 def RunStep(self): | 372 def RunStep(self): |
| 373 if self._options and self._options.r: | 373 if self._options.r: |
| 374 print "Using account %s for review." % self._options.r | 374 print "Using account %s for review." % self._options.r |
| 375 reviewer = self._options.r | 375 reviewer = self._options.r |
| 376 else: | 376 else: |
| 377 print "Please enter the email address of a V8 reviewer for your patch: ", | 377 print "Please enter the email address of a V8 reviewer for your patch: ", |
| 378 self.DieInForcedMode("A reviewer must be specified in forced mode.") | 378 self.DieInForcedMode("A reviewer must be specified in forced mode.") |
| 379 reviewer = self.ReadLine() | 379 reviewer = self.ReadLine() |
| 380 args = "cl upload -r \"%s\" --send-mail" % reviewer | 380 force_flag = " -f" if self._options.f else "" |
| 381 if self.Git(args,pipe=False) is None: | 381 args = "cl upload -r \"%s\" --send-mail%s" % (reviewer, force_flag) |
| 382 # TODO(machenbach): Check output in forced mode. Verify that all required |
| 383 # base files were uploaded, if not retry. |
| 384 if self.Git(args, pipe=False) is None: |
| 382 self.Die("'git cl upload' failed, please try again.") | 385 self.Die("'git cl upload' failed, please try again.") |
| 383 | 386 |
| 384 | 387 |
| 385 def RunScript(step_classes, | 388 def RunScript(step_classes, |
| 386 config, | 389 config, |
| 387 options, | 390 options, |
| 388 side_effect_handler=DEFAULT_SIDE_EFFECT_HANDLER): | 391 side_effect_handler=DEFAULT_SIDE_EFFECT_HANDLER): |
| 389 state = {} | 392 state = {} |
| 390 steps = [] | 393 steps = [] |
| 391 number = 0 | 394 number = 0 |
| 392 | 395 |
| 393 for step_class in step_classes: | 396 for step_class in step_classes: |
| 394 # TODO(machenbach): Factory methods. | 397 # TODO(machenbach): Factory methods. |
| 395 step = step_class() | 398 step = step_class() |
| 396 step.SetNumber(number) | 399 step.SetNumber(number) |
| 397 step.SetConfig(config) | 400 step.SetConfig(config) |
| 398 step.SetOptions(options) | 401 step.SetOptions(options) |
| 399 step.SetState(state) | 402 step.SetState(state) |
| 400 step.SetSideEffectHandler(side_effect_handler) | 403 step.SetSideEffectHandler(side_effect_handler) |
| 401 steps.append(step) | 404 steps.append(step) |
| 402 number += 1 | 405 number += 1 |
| 403 | 406 |
| 404 for step in steps[options.s:]: | 407 for step in steps[options.s:]: |
| 405 step.Run() | 408 step.Run() |
| OLD | NEW |