| 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 |
| 11 # disclaimer in the documentation and/or other materials provided | 11 # disclaimer in the documentation and/or other materials provided |
| 12 # with the distribution. | 12 # with the distribution. |
| 13 # * Neither the name of Google Inc. nor the names of its | 13 # * Neither the name of Google Inc. nor the names of its |
| 14 # contributors may be used to endorse or promote products derived | 14 # contributors may be used to endorse or promote products derived |
| 15 # from this software without specific prior written permission. | 15 # from this software without specific prior written permission. |
| 16 # | 16 # |
| 17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 18 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 18 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 19 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 19 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 20 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 20 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 | 28 |
| 29 import optparse | 29 import argparse |
| 30 import sys | 30 import sys |
| 31 import tempfile | 31 import tempfile |
| 32 import urllib2 | 32 import urllib2 |
| 33 | 33 |
| 34 from common_includes import * | 34 from common_includes import * |
| 35 | 35 |
| 36 TRUNKBRANCH = "TRUNKBRANCH" | 36 TRUNKBRANCH = "TRUNKBRANCH" |
| 37 CHROMIUM = "CHROMIUM" | 37 CHROMIUM = "CHROMIUM" |
| 38 DEPS_FILE = "DEPS_FILE" | 38 DEPS_FILE = "DEPS_FILE" |
| 39 | 39 |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 UpdateChromiumCheckout, | 538 UpdateChromiumCheckout, |
| 539 UploadCL, | 539 UploadCL, |
| 540 SwitchV8, | 540 SwitchV8, |
| 541 CleanUp, | 541 CleanUp, |
| 542 ] | 542 ] |
| 543 | 543 |
| 544 RunScript(step_classes, config, options, side_effect_handler) | 544 RunScript(step_classes, config, options, side_effect_handler) |
| 545 | 545 |
| 546 | 546 |
| 547 def BuildOptions(): | 547 def BuildOptions(): |
| 548 result = optparse.OptionParser() | 548 parser = argparse.ArgumentParser() |
| 549 result.add_option("-a", "--author", dest="a", | 549 group = parser.add_mutually_exclusive_group() |
| 550 help=("Specify the author email used for rietveld.")) | 550 group.add_argument("-f", "--force", dest="f", |
| 551 result.add_option("-b", "--last-bleeding-edge", dest="b", | 551 help="Don't prompt the user.", |
| 552 help=("Manually specify the git commit ID of the last " | 552 default=False, action="store_true") |
| 553 "bleeding edge revision that was pushed to trunk. " | 553 group.add_argument("-m", "--manual", dest="m", |
| 554 "This is used for the auto-generated ChangeLog " | 554 help="Prompt the user at every important step.", |
| 555 "entry.")) | 555 default=False, action="store_true") |
| 556 result.add_option("-c", "--chromium", dest="c", | 556 parser.add_argument("-a", "--author", dest="a", |
| 557 help=("Specify the path to your Chromium src/ " | 557 help="The author email used for rietveld.") |
| 558 "directory to automate the V8 roll.")) | 558 parser.add_argument("-b", "--last-bleeding-edge", dest="b", |
| 559 result.add_option("-f", "--force", dest="f", | 559 help=("The git commit ID of the last bleeding edge " |
| 560 help="Don't prompt the user.", | 560 "revision that was pushed to trunk. This is used " |
| 561 default=False, action="store_true") | 561 "for the auto-generated ChangeLog entry.")) |
| 562 result.add_option("-l", "--last-push", dest="l", | 562 parser.add_argument("-c", "--chromium", dest="c", |
| 563 help=("Manually specify the git commit ID " | 563 help=("The path to your Chromium src/ directory to " |
| 564 "of the last push to trunk.")) | 564 "automate the V8 roll.")) |
| 565 result.add_option("-m", "--manual", dest="m", | 565 parser.add_argument("-l", "--last-push", dest="l", |
| 566 help="Prompt the user at every important step.", | 566 help="The git commit ID of the last push to trunk.") |
| 567 default=False, action="store_true") | 567 parser.add_argument("-r", "--reviewer", |
| 568 result.add_option("-r", "--reviewer", | 568 help="The account name to be used for reviews.") |
| 569 help=("Specify the account name to be used for reviews.")) | 569 parser.add_argument("-s", "--step", dest="s", |
| 570 result.add_option("-s", "--step", dest="s", | 570 help="The step where to start work. Default: 0.", |
| 571 help="Specify the step where to start work. Default: 0.", | 571 default=0, type=int) |
| 572 default=0, type="int") | 572 return parser |
| 573 return result | |
| 574 | 573 |
| 575 | 574 |
| 576 def ProcessOptions(options): | 575 def ProcessOptions(options): |
| 577 if options.s < 0: | 576 if options.s < 0: |
| 578 print "Bad step number %d" % options.s | 577 print "Bad step number %d" % options.s |
| 579 return False | 578 return False |
| 580 if not options.m and not options.reviewer: | 579 if not options.m and not options.reviewer: |
| 581 print "A reviewer (-r) is required in (semi-)automatic mode." | 580 print "A reviewer (-r) is required in (semi-)automatic mode." |
| 582 return False | 581 return False |
| 583 if options.f and options.m: | |
| 584 print "Manual and forced mode cannot be combined." | |
| 585 return False | |
| 586 if not options.m and not options.c: | 582 if not options.m and not options.c: |
| 587 print "A chromium checkout (-c) is required in (semi-)automatic mode." | 583 print "A chromium checkout (-c) is required in (semi-)automatic mode." |
| 588 return False | 584 return False |
| 589 if not options.m and not options.a: | 585 if not options.m and not options.a: |
| 590 print "Specify your chromium.org email with -a in (semi-)automatic mode." | 586 print "Specify your chromium.org email with -a in (semi-)automatic mode." |
| 591 return False | 587 return False |
| 592 return True | 588 return True |
| 593 | 589 |
| 594 | 590 |
| 595 def Main(): | 591 def Main(): |
| 596 parser = BuildOptions() | 592 parser = BuildOptions() |
| 597 (options, args) = parser.parse_args() | 593 options = parser.parse_args() |
| 598 if not ProcessOptions(options): | 594 if not ProcessOptions(options): |
| 599 parser.print_help() | 595 parser.print_help() |
| 600 return 1 | 596 return 1 |
| 601 RunPushToTrunk(CONFIG, PushToTrunkOptions(options)) | 597 RunPushToTrunk(CONFIG, PushToTrunkOptions(options)) |
| 602 | 598 |
| 603 if __name__ == "__main__": | 599 if __name__ == "__main__": |
| 604 sys.exit(Main()) | 600 sys.exit(Main()) |
| OLD | NEW |