| 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 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 line = re.sub("\d+$", self[prefix + "major"], line) | 522 line = re.sub("\d+$", self[prefix + "major"], line) |
| 523 elif line.startswith("#define MINOR_VERSION"): | 523 elif line.startswith("#define MINOR_VERSION"): |
| 524 line = re.sub("\d+$", self[prefix + "minor"], line) | 524 line = re.sub("\d+$", self[prefix + "minor"], line) |
| 525 elif line.startswith("#define BUILD_NUMBER"): | 525 elif line.startswith("#define BUILD_NUMBER"): |
| 526 line = re.sub("\d+$", self[prefix + "build"], line) | 526 line = re.sub("\d+$", self[prefix + "build"], line) |
| 527 elif line.startswith("#define PATCH_LEVEL"): | 527 elif line.startswith("#define PATCH_LEVEL"): |
| 528 line = re.sub("\d+$", self[prefix + "patch"], line) | 528 line = re.sub("\d+$", self[prefix + "patch"], line) |
| 529 output += "%s\n" % line | 529 output += "%s\n" % line |
| 530 TextToFile(output, version_file) | 530 TextToFile(output, version_file) |
| 531 | 531 |
| 532 def SVNCommit(self, root, commit_message): |
| 533 patch = self.GitDiff("HEAD^", "HEAD") |
| 534 TextToFile(patch, self._config[PATCH_FILE]) |
| 535 if not self.Command("patch", "-d %s -p1 -i %s" % |
| 536 (root, self._config[PATCH_FILE]), |
| 537 cwd=self._options.svn): |
| 538 self.Die("Could not apply patch.") |
| 539 self.Command( |
| 540 "svn", |
| 541 "commit --non-interactive --username=%s --config-dir=%s -m \"%s\"" % |
| 542 (self._options.author, self._options.svn_config, commit_message), |
| 543 cwd=self._options.svn) |
| 544 |
| 545 |
| 532 class UploadStep(Step): | 546 class UploadStep(Step): |
| 533 MESSAGE = "Upload for code review." | 547 MESSAGE = "Upload for code review." |
| 534 | 548 |
| 535 def RunStep(self): | 549 def RunStep(self): |
| 536 if self._options.reviewer: | 550 if self._options.reviewer: |
| 537 print "Using account %s for review." % self._options.reviewer | 551 print "Using account %s for review." % self._options.reviewer |
| 538 reviewer = self._options.reviewer | 552 reviewer = self._options.reviewer |
| 539 else: | 553 else: |
| 540 print "Please enter the email address of a V8 reviewer for your patch: ", | 554 print "Please enter the email address of a V8 reviewer for your patch: ", |
| 541 self.DieNoManualMode("A reviewer must be specified in forced mode.") | 555 self.DieNoManualMode("A reviewer must be specified in forced mode.") |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 parser.add_argument("--dry-run", default=False, action="store_true", | 638 parser.add_argument("--dry-run", default=False, action="store_true", |
| 625 help="Perform only read-only actions.") | 639 help="Perform only read-only actions.") |
| 626 parser.add_argument("-g", "--googlers-mapping", | 640 parser.add_argument("-g", "--googlers-mapping", |
| 627 help="Path to the script mapping google accounts.") | 641 help="Path to the script mapping google accounts.") |
| 628 parser.add_argument("-r", "--reviewer", default="", | 642 parser.add_argument("-r", "--reviewer", default="", |
| 629 help="The account name to be used for reviews.") | 643 help="The account name to be used for reviews.") |
| 630 parser.add_argument("--sheriff", default=False, action="store_true", | 644 parser.add_argument("--sheriff", default=False, action="store_true", |
| 631 help=("Determine current sheriff to review CLs. On " | 645 help=("Determine current sheriff to review CLs. On " |
| 632 "success, this will overwrite the reviewer " | 646 "success, this will overwrite the reviewer " |
| 633 "option.")) | 647 "option.")) |
| 648 parser.add_argument("--svn", |
| 649 help=("Optional full svn checkout for the commit." |
| 650 "The folder needs to be the svn root.")) |
| 651 parser.add_argument("--svn-config", |
| 652 help=("Optional folder used as svn --config-dir.")) |
| 634 parser.add_argument("-s", "--step", | 653 parser.add_argument("-s", "--step", |
| 635 help="Specify the step where to start work. Default: 0.", | 654 help="Specify the step where to start work. Default: 0.", |
| 636 default=0, type=int) | 655 default=0, type=int) |
| 637 self._PrepareOptions(parser) | 656 self._PrepareOptions(parser) |
| 638 | 657 |
| 639 if args is None: # pragma: no cover | 658 if args is None: # pragma: no cover |
| 640 options = parser.parse_args() | 659 options = parser.parse_args() |
| 641 else: | 660 else: |
| 642 options = parser.parse_args(args) | 661 options = parser.parse_args(args) |
| 643 | 662 |
| 644 # Process common options. | 663 # Process common options. |
| 645 if options.step < 0: # pragma: no cover | 664 if options.step < 0: # pragma: no cover |
| 646 print "Bad step number %d" % options.step | 665 print "Bad step number %d" % options.step |
| 647 parser.print_help() | 666 parser.print_help() |
| 648 return None | 667 return None |
| 649 if options.sheriff and not options.googlers_mapping: # pragma: no cover | 668 if options.sheriff and not options.googlers_mapping: # pragma: no cover |
| 650 print "To determine the current sheriff, requires the googler mapping" | 669 print "To determine the current sheriff, requires the googler mapping" |
| 651 parser.print_help() | 670 parser.print_help() |
| 652 return None | 671 return None |
| 672 if options.svn and not options.svn_config: |
| 673 print "Using pure svn for committing requires also --svn-config" |
| 674 parser.print_help() |
| 675 return None |
| 653 | 676 |
| 654 # Defaults for options, common to all scripts. | 677 # Defaults for options, common to all scripts. |
| 655 options.manual = getattr(options, "manual", True) | 678 options.manual = getattr(options, "manual", True) |
| 656 options.force = getattr(options, "force", False) | 679 options.force = getattr(options, "force", False) |
| 657 | 680 |
| 658 # Derived options. | 681 # Derived options. |
| 659 options.requires_editor = not options.force | 682 options.requires_editor = not options.force |
| 660 options.wait_for_lgtm = not options.force | 683 options.wait_for_lgtm = not options.force |
| 661 options.force_readline_defaults = not options.manual | 684 options.force_readline_defaults = not options.manual |
| 662 options.force_upload = not options.manual | 685 options.force_upload = not options.manual |
| (...skipping 17 matching lines...) Expand all Loading... |
| 680 for (number, step_class) in enumerate(step_classes): | 703 for (number, step_class) in enumerate(step_classes): |
| 681 steps.append(MakeStep(step_class, number, self._state, self._config, | 704 steps.append(MakeStep(step_class, number, self._state, self._config, |
| 682 options, self._side_effect_handler)) | 705 options, self._side_effect_handler)) |
| 683 for step in steps[options.step:]: | 706 for step in steps[options.step:]: |
| 684 if step.Run(): | 707 if step.Run(): |
| 685 return 0 | 708 return 0 |
| 686 return 0 | 709 return 0 |
| 687 | 710 |
| 688 def Run(self, args=None): | 711 def Run(self, args=None): |
| 689 return self.RunSteps(self._Steps(), args) | 712 return self.RunSteps(self._Steps(), args) |
| OLD | NEW |