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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 } | 52 } |
53 | 53 |
54 | 54 |
55 class Preparation(Step): | 55 class Preparation(Step): |
56 def __init__(self): | 56 def __init__(self): |
57 Step.__init__(self, "Preparation.") | 57 Step.__init__(self, "Preparation.") |
58 | 58 |
59 def RunStep(self): | 59 def RunStep(self): |
60 self.InitialEnvironmentChecks() | 60 self.InitialEnvironmentChecks() |
61 self.CommonPrepare() | 61 self.CommonPrepare() |
| 62 self.PrepareBranch() |
62 self.DeleteBranch(self.Config(TRUNKBRANCH)) | 63 self.DeleteBranch(self.Config(TRUNKBRANCH)) |
63 | 64 |
64 | 65 |
65 class FreshBranch(Step): | 66 class FreshBranch(Step): |
66 def __init__(self): | 67 def __init__(self): |
67 Step.__init__(self, "Create a fresh branch.") | 68 Step.__init__(self, "Create a fresh branch.") |
68 | 69 |
69 def RunStep(self): | 70 def RunStep(self): |
70 args = "checkout -b %s svn/bleeding_edge" % self.Config(BRANCHNAME) | 71 args = "checkout -b %s svn/bleeding_edge" % self.Config(BRANCHNAME) |
71 if self.Git(args) is None: | 72 if self.Git(args) is None: |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 print("Congratulations, you have successfully created the trunk " | 481 print("Congratulations, you have successfully created the trunk " |
481 "revision %s. Please don't forget to roll this new version into " | 482 "revision %s. Please don't forget to roll this new version into " |
482 "Chromium, and to update the v8rel spreadsheet:" % ver) | 483 "Chromium, and to update the v8rel spreadsheet:" % ver) |
483 print "%s\ttrunk\t%s" % (ver, self._state["trunk_revision"]) | 484 print "%s\ttrunk\t%s" % (ver, self._state["trunk_revision"]) |
484 | 485 |
485 self.CommonCleanup() | 486 self.CommonCleanup() |
486 if self.Config(TRUNKBRANCH) != self._state["current_branch"]: | 487 if self.Config(TRUNKBRANCH) != self._state["current_branch"]: |
487 self.Git("branch -D %s" % self.Config(TRUNKBRANCH)) | 488 self.Git("branch -D %s" % self.Config(TRUNKBRANCH)) |
488 | 489 |
489 | 490 |
490 def RunScript(config, | 491 def RunPushToTrunk(config, |
491 options, | 492 options, |
492 side_effect_handler=DEFAULT_SIDE_EFFECT_HANDLER): | 493 side_effect_handler=DEFAULT_SIDE_EFFECT_HANDLER): |
493 step_classes = [ | 494 step_classes = [ |
494 Preparation, | 495 Preparation, |
495 FreshBranch, | 496 FreshBranch, |
496 DetectLastPush, | 497 DetectLastPush, |
497 PrepareChangeLog, | 498 PrepareChangeLog, |
498 EditChangeLog, | 499 EditChangeLog, |
499 IncrementVersion, | 500 IncrementVersion, |
500 CommitLocal, | 501 CommitLocal, |
501 UploadStep, | 502 UploadStep, |
502 CommitRepository, | 503 CommitRepository, |
503 StragglerCommits, | 504 StragglerCommits, |
504 SquashCommits, | 505 SquashCommits, |
505 NewBranch, | 506 NewBranch, |
506 ApplyChanges, | 507 ApplyChanges, |
507 SetVersion, | 508 SetVersion, |
508 CommitTrunk, | 509 CommitTrunk, |
509 SanityCheck, | 510 SanityCheck, |
510 CommitSVN, | 511 CommitSVN, |
511 TagRevision, | 512 TagRevision, |
512 CheckChromium, | 513 CheckChromium, |
513 SwitchChromium, | 514 SwitchChromium, |
514 UpdateChromiumCheckout, | 515 UpdateChromiumCheckout, |
515 UploadCL, | 516 UploadCL, |
516 SwitchV8, | 517 SwitchV8, |
517 CleanUp, | 518 CleanUp, |
518 ] | 519 ] |
519 | 520 |
520 state = {} | 521 RunScript(step_classes, config, options, side_effect_handler) |
521 steps = [] | |
522 number = 0 | |
523 | |
524 for step_class in step_classes: | |
525 # TODO(machenbach): Factory methods. | |
526 step = step_class() | |
527 step.SetNumber(number) | |
528 step.SetConfig(config) | |
529 step.SetOptions(options) | |
530 step.SetState(state) | |
531 step.SetSideEffectHandler(side_effect_handler) | |
532 steps.append(step) | |
533 number += 1 | |
534 | |
535 for step in steps[options.s:]: | |
536 step.Run() | |
537 | 522 |
538 | 523 |
539 def BuildOptions(): | 524 def BuildOptions(): |
540 result = optparse.OptionParser() | 525 result = optparse.OptionParser() |
541 result.add_option("-s", "--step", dest="s", | 526 result.add_option("-s", "--step", dest="s", |
542 help="Specify the step where to start work. Default: 0.", | 527 help="Specify the step where to start work. Default: 0.", |
543 default=0, type="int") | 528 default=0, type="int") |
544 result.add_option("-l", "--last-push", dest="l", | 529 result.add_option("-l", "--last-push", dest="l", |
545 help=("Manually specify the git commit ID " | 530 help=("Manually specify the git commit ID " |
546 "of the last push to trunk.")) | 531 "of the last push to trunk.")) |
(...skipping 13 matching lines...) Expand all Loading... |
560 def Main(): | 545 def Main(): |
561 parser = BuildOptions() | 546 parser = BuildOptions() |
562 (options, args) = parser.parse_args() | 547 (options, args) = parser.parse_args() |
563 if not ProcessOptions(options): | 548 if not ProcessOptions(options): |
564 parser.print_help() | 549 parser.print_help() |
565 return 1 | 550 return 1 |
566 RunScript(CONFIG, options) | 551 RunScript(CONFIG, options) |
567 | 552 |
568 if __name__ == "__main__": | 553 if __name__ == "__main__": |
569 sys.exit(Main()) | 554 sys.exit(Main()) |
OLD | NEW |