| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 CHANGELOG_FILE: "ChangeLog", | 47 CHANGELOG_FILE: "ChangeLog", |
| 48 CHANGELOG_ENTRY_FILE: "/tmp/v8-push-to-trunk-tempfile-changelog-entry", | 48 CHANGELOG_ENTRY_FILE: "/tmp/v8-push-to-trunk-tempfile-changelog-entry", |
| 49 PATCH_FILE: "/tmp/v8-push-to-trunk-tempfile-patch-file", | 49 PATCH_FILE: "/tmp/v8-push-to-trunk-tempfile-patch-file", |
| 50 COMMITMSG_FILE: "/tmp/v8-push-to-trunk-tempfile-commitmsg", | 50 COMMITMSG_FILE: "/tmp/v8-push-to-trunk-tempfile-commitmsg", |
| 51 DEPS_FILE: "DEPS", | 51 DEPS_FILE: "DEPS", |
| 52 } | 52 } |
| 53 | 53 |
| 54 | 54 |
| 55 class PushToTrunkOptions(CommonOptions): | 55 class PushToTrunkOptions(CommonOptions): |
| 56 @staticmethod | 56 @staticmethod |
| 57 def MakeForcedOptions(reviewer, chrome_path): | 57 def MakeForcedOptions(author, reviewer, chrome_path): |
| 58 """Convenience wrapper.""" | 58 """Convenience wrapper.""" |
| 59 class Options(object): | 59 class Options(object): |
| 60 pass | 60 pass |
| 61 options = Options() | 61 options = Options() |
| 62 options.s = 0 | 62 options.s = 0 |
| 63 options.l = None | 63 options.l = None |
| 64 options.f = True | 64 options.f = True |
| 65 options.m = False | 65 options.m = False |
| 66 options.r = reviewer | 66 options.r = reviewer |
| 67 options.c = chrome_path | 67 options.c = chrome_path |
| 68 options.a = author |
| 68 return PushToTrunkOptions(options) | 69 return PushToTrunkOptions(options) |
| 69 | 70 |
| 70 def __init__(self, options): | 71 def __init__(self, options): |
| 71 super(PushToTrunkOptions, self).__init__(options, options.m) | 72 super(PushToTrunkOptions, self).__init__(options, options.m) |
| 72 self.requires_editor = not options.f | 73 self.requires_editor = not options.f |
| 73 self.wait_for_lgtm = not options.f | 74 self.wait_for_lgtm = not options.f |
| 74 self.tbr_commit = not options.m | 75 self.tbr_commit = not options.m |
| 75 self.l = options.l | 76 self.l = options.l |
| 76 self.r = options.r | 77 self.r = options.r |
| 77 self.c = options.c | 78 self.c = options.c |
| 79 self.author = getattr(options, 'a', None) |
| 78 | 80 |
| 79 class Preparation(Step): | 81 class Preparation(Step): |
| 80 MESSAGE = "Preparation." | 82 MESSAGE = "Preparation." |
| 81 | 83 |
| 82 def RunStep(self): | 84 def RunStep(self): |
| 83 self.InitialEnvironmentChecks() | 85 self.InitialEnvironmentChecks() |
| 84 self.CommonPrepare() | 86 self.CommonPrepare() |
| 85 self.PrepareBranch() | 87 self.PrepareBranch() |
| 86 self.DeleteBranch(self.Config(TRUNKBRANCH)) | 88 self.DeleteBranch(self.Config(TRUNKBRANCH)) |
| 87 | 89 |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 else: | 487 else: |
| 486 print "Please enter the email address of a reviewer for the roll CL: ", | 488 print "Please enter the email address of a reviewer for the roll CL: ", |
| 487 self.DieNoManualMode("A reviewer must be specified in forced mode.") | 489 self.DieNoManualMode("A reviewer must be specified in forced mode.") |
| 488 rev = self.ReadLine() | 490 rev = self.ReadLine() |
| 489 self.RestoreIfUnset("svn_revision") | 491 self.RestoreIfUnset("svn_revision") |
| 490 args = ("commit -am \"Update V8 to version %s " | 492 args = ("commit -am \"Update V8 to version %s " |
| 491 "(based on bleeding_edge revision r%s).\n\nTBR=%s\"" | 493 "(based on bleeding_edge revision r%s).\n\nTBR=%s\"" |
| 492 % (ver, self._state["svn_revision"], rev)) | 494 % (ver, self._state["svn_revision"], rev)) |
| 493 if self.Git(args) is None: | 495 if self.Git(args) is None: |
| 494 self.Die("'git commit' failed.") | 496 self.Die("'git commit' failed.") |
| 497 author_option = self._options.author |
| 498 author = " --email \"%s\"" % author_option if author_option else "" |
| 495 force_flag = " -f" if self._options.force_upload else "" | 499 force_flag = " -f" if self._options.force_upload else "" |
| 496 if self.Git("cl upload --send-mail%s" % force_flag, pipe=False) is None: | 500 if self.Git("cl upload%s --send-mail%s" % (author, force_flag), |
| 501 pipe=False) is None: |
| 497 self.Die("'git cl upload' failed, please try again.") | 502 self.Die("'git cl upload' failed, please try again.") |
| 498 print "CL uploaded." | 503 print "CL uploaded." |
| 499 | 504 |
| 500 | 505 |
| 501 class SwitchV8(Step): | 506 class SwitchV8(Step): |
| 502 MESSAGE = "Returning to V8 checkout." | 507 MESSAGE = "Returning to V8 checkout." |
| 503 REQUIRES = "chrome_path" | 508 REQUIRES = "chrome_path" |
| 504 | 509 |
| 505 def RunStep(self): | 510 def RunStep(self): |
| 506 self.RestoreIfUnset("v8_path") | 511 self.RestoreIfUnset("v8_path") |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 UploadCL, | 566 UploadCL, |
| 562 SwitchV8, | 567 SwitchV8, |
| 563 CleanUp, | 568 CleanUp, |
| 564 ] | 569 ] |
| 565 | 570 |
| 566 RunScript(step_classes, config, options, side_effect_handler) | 571 RunScript(step_classes, config, options, side_effect_handler) |
| 567 | 572 |
| 568 | 573 |
| 569 def BuildOptions(): | 574 def BuildOptions(): |
| 570 result = optparse.OptionParser() | 575 result = optparse.OptionParser() |
| 576 result.add_option("-a", "--author", dest="a", |
| 577 help=("Specify the author email used for rietveld.")) |
| 571 result.add_option("-c", "--chromium", dest="c", | 578 result.add_option("-c", "--chromium", dest="c", |
| 572 help=("Specify the path to your Chromium src/ " | 579 help=("Specify the path to your Chromium src/ " |
| 573 "directory to automate the V8 roll.")) | 580 "directory to automate the V8 roll.")) |
| 574 result.add_option("-f", "--force", dest="f", | 581 result.add_option("-f", "--force", dest="f", |
| 575 help="Don't prompt the user.", | 582 help="Don't prompt the user.", |
| 576 default=False, action="store_true") | 583 default=False, action="store_true") |
| 577 result.add_option("-l", "--last-push", dest="l", | 584 result.add_option("-l", "--last-push", dest="l", |
| 578 help=("Manually specify the git commit ID " | 585 help=("Manually specify the git commit ID " |
| 579 "of the last push to trunk.")) | 586 "of the last push to trunk.")) |
| 580 result.add_option("-m", "--manual", dest="m", | 587 result.add_option("-m", "--manual", dest="m", |
| (...skipping 13 matching lines...) Expand all Loading... |
| 594 return False | 601 return False |
| 595 if not options.m and not options.r: | 602 if not options.m and not options.r: |
| 596 print "A reviewer (-r) is required in (semi-)automatic mode." | 603 print "A reviewer (-r) is required in (semi-)automatic mode." |
| 597 return False | 604 return False |
| 598 if options.f and options.m: | 605 if options.f and options.m: |
| 599 print "Manual and forced mode cannot be combined." | 606 print "Manual and forced mode cannot be combined." |
| 600 return False | 607 return False |
| 601 if not options.m and not options.c: | 608 if not options.m and not options.c: |
| 602 print "A chromium checkout (-c) is required in (semi-)automatic mode." | 609 print "A chromium checkout (-c) is required in (semi-)automatic mode." |
| 603 return False | 610 return False |
| 611 if not options.m and not options.a: |
| 612 print "Specify your chromium.org email with -a in (semi-)automatic mode." |
| 613 return False |
| 604 return True | 614 return True |
| 605 | 615 |
| 606 | 616 |
| 607 def Main(): | 617 def Main(): |
| 608 parser = BuildOptions() | 618 parser = BuildOptions() |
| 609 (options, args) = parser.parse_args() | 619 (options, args) = parser.parse_args() |
| 610 if not ProcessOptions(options): | 620 if not ProcessOptions(options): |
| 611 parser.print_help() | 621 parser.print_help() |
| 612 return 1 | 622 return 1 |
| 613 RunPushToTrunk(CONFIG, PushToTrunkOptions(options)) | 623 RunPushToTrunk(CONFIG, PushToTrunkOptions(options)) |
| 614 | 624 |
| 615 if __name__ == "__main__": | 625 if __name__ == "__main__": |
| 616 sys.exit(Main()) | 626 sys.exit(Main()) |
| OLD | NEW |