| 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 748 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 759       reviewer = self._options.reviewer | 759       reviewer = self._options.reviewer | 
| 760     else: | 760     else: | 
| 761       print "Please enter the email address of a V8 reviewer for your patch: ", | 761       print "Please enter the email address of a V8 reviewer for your patch: ", | 
| 762       self.DieNoManualMode("A reviewer must be specified in forced mode.") | 762       self.DieNoManualMode("A reviewer must be specified in forced mode.") | 
| 763       reviewer = self.ReadLine() | 763       reviewer = self.ReadLine() | 
| 764     self.GitUpload(reviewer, self._options.author, self._options.force_upload, | 764     self.GitUpload(reviewer, self._options.author, self._options.force_upload, | 
| 765                    bypass_hooks=self._options.bypass_upload_hooks, | 765                    bypass_hooks=self._options.bypass_upload_hooks, | 
| 766                    cc=self._options.cc) | 766                    cc=self._options.cc) | 
| 767 | 767 | 
| 768 | 768 | 
| 769 class DetermineV8Sheriff(Step): |  | 
| 770   MESSAGE = "Determine the V8 sheriff for code review." |  | 
| 771 |  | 
| 772   def RunStep(self): |  | 
| 773     self["sheriff"] = None |  | 
| 774     if not self._options.sheriff:  # pragma: no cover |  | 
| 775       return |  | 
| 776 |  | 
| 777     # The sheriff determined by the rotation on the waterfall has a |  | 
| 778     # @google.com account. |  | 
| 779     url = "https://chromium-build.appspot.com/p/chromium/sheriff_v8.js" |  | 
| 780     match = re.match(r"document\.write\('(\w+)'\)", self.ReadURL(url)) |  | 
| 781 |  | 
| 782     # If "channel is sheriff", we can't match an account. |  | 
| 783     if match: |  | 
| 784       g_name = match.group(1) |  | 
| 785       # Optimistically assume that google and chromium account name are the |  | 
| 786       # same. |  | 
| 787       self["sheriff"] = g_name + "@chromium.org" |  | 
| 788       self._options.reviewer = ("%s,%s" % |  | 
| 789                                 (self["sheriff"], self._options.reviewer)) |  | 
| 790       print "Found active sheriff: %s" % self["sheriff"] |  | 
| 791     else: |  | 
| 792       print "No active sheriff found." |  | 
| 793 |  | 
| 794 |  | 
| 795 def MakeStep(step_class=Step, number=0, state=None, config=None, | 769 def MakeStep(step_class=Step, number=0, state=None, config=None, | 
| 796              options=None, side_effect_handler=DEFAULT_SIDE_EFFECT_HANDLER): | 770              options=None, side_effect_handler=DEFAULT_SIDE_EFFECT_HANDLER): | 
| 797     # Allow to pass in empty dictionaries. | 771     # Allow to pass in empty dictionaries. | 
| 798     state = state if state is not None else {} | 772     state = state if state is not None else {} | 
| 799     config = config if config is not None else {} | 773     config = config if config is not None else {} | 
| 800 | 774 | 
| 801     try: | 775     try: | 
| 802       message = step_class.MESSAGE | 776       message = step_class.MESSAGE | 
| 803     except AttributeError: | 777     except AttributeError: | 
| 804       message = step_class.__name__ | 778       message = step_class.__name__ | 
| (...skipping 30 matching lines...) Expand all  Loading... | 
| 835   def MakeOptions(self, args=None): | 809   def MakeOptions(self, args=None): | 
| 836     parser = argparse.ArgumentParser(description=self._Description()) | 810     parser = argparse.ArgumentParser(description=self._Description()) | 
| 837     parser.add_argument("-a", "--author", default="", | 811     parser.add_argument("-a", "--author", default="", | 
| 838                         help="The author email used for rietveld.") | 812                         help="The author email used for rietveld.") | 
| 839     parser.add_argument("--dry-run", default=False, action="store_true", | 813     parser.add_argument("--dry-run", default=False, action="store_true", | 
| 840                         help="Perform only read-only actions.") | 814                         help="Perform only read-only actions.") | 
| 841     parser.add_argument("--json-output", | 815     parser.add_argument("--json-output", | 
| 842                         help="File to write results summary to.") | 816                         help="File to write results summary to.") | 
| 843     parser.add_argument("-r", "--reviewer", default="", | 817     parser.add_argument("-r", "--reviewer", default="", | 
| 844                         help="The account name to be used for reviews.") | 818                         help="The account name to be used for reviews.") | 
| 845     parser.add_argument("--sheriff", default=False, action="store_true", |  | 
| 846                         help=("Determine current sheriff to review CLs. On " |  | 
| 847                               "success, this will overwrite the reviewer " |  | 
| 848                               "option.")) |  | 
| 849     parser.add_argument("-s", "--step", | 819     parser.add_argument("-s", "--step", | 
| 850         help="Specify the step where to start work. Default: 0.", | 820         help="Specify the step where to start work. Default: 0.", | 
| 851         default=0, type=int) | 821         default=0, type=int) | 
| 852     parser.add_argument("--work-dir", | 822     parser.add_argument("--work-dir", | 
| 853                         help=("Location where to bootstrap a working v8 " | 823                         help=("Location where to bootstrap a working v8 " | 
| 854                               "checkout.")) | 824                               "checkout.")) | 
| 855     self._PrepareOptions(parser) | 825     self._PrepareOptions(parser) | 
| 856 | 826 | 
| 857     if args is None:  # pragma: no cover | 827     if args is None:  # pragma: no cover | 
| 858       options = parser.parse_args() | 828       options = parser.parse_args() | 
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 907           return 0 | 877           return 0 | 
| 908     finally: | 878     finally: | 
| 909       if options.json_output: | 879       if options.json_output: | 
| 910         with open(options.json_output, "w") as f: | 880         with open(options.json_output, "w") as f: | 
| 911           json.dump({"step_summary": step_summary}, f) | 881           json.dump({"step_summary": step_summary}, f) | 
| 912 | 882 | 
| 913     return 0 | 883     return 0 | 
| 914 | 884 | 
| 915   def Run(self, args=None): | 885   def Run(self, args=None): | 
| 916     return self.RunSteps(self._Steps(), args) | 886     return self.RunSteps(self._Steps(), args) | 
| OLD | NEW | 
|---|