Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(769)

Side by Side Diff: tools/release/common_includes.py

Issue 938023002: Add sheriff details to roll commit message. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Link to instructions Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/release/chromium_roll.py ('k') | tools/release/test_scripts.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 735 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 746
747 747
748 class DetermineV8Sheriff(Step): 748 class DetermineV8Sheriff(Step):
749 MESSAGE = "Determine the V8 sheriff for code review." 749 MESSAGE = "Determine the V8 sheriff for code review."
750 750
751 def RunStep(self): 751 def RunStep(self):
752 self["sheriff"] = None 752 self["sheriff"] = None
753 if not self._options.sheriff: # pragma: no cover 753 if not self._options.sheriff: # pragma: no cover
754 return 754 return
755 755
756 try:
757 # The googlers mapping maps @google.com accounts to @chromium.org
758 # accounts.
759 googlers = imp.load_source('googlers_mapping',
760 self._options.googlers_mapping)
761 googlers = googlers.list_to_dict(googlers.get_list())
762 except: # pragma: no cover
763 print "Skip determining sheriff without googler mapping."
764 return
765
766 # The sheriff determined by the rotation on the waterfall has a 756 # The sheriff determined by the rotation on the waterfall has a
767 # @google.com account. 757 # @google.com account.
768 url = "https://chromium-build.appspot.com/p/chromium/sheriff_v8.js" 758 url = "https://chromium-build.appspot.com/p/chromium/sheriff_v8.js"
769 match = re.match(r"document\.write\('(\w+)'\)", self.ReadURL(url)) 759 match = re.match(r"document\.write\('(\w+)'\)", self.ReadURL(url))
770 760
771 # If "channel is sheriff", we can't match an account. 761 # If "channel is sheriff", we can't match an account.
772 if match: 762 if match:
773 g_name = match.group(1) 763 g_name = match.group(1)
774 self["sheriff"] = googlers.get(g_name + "@google.com", 764 # Optimistically assume that google and chromium account name are the
775 g_name + "@chromium.org") 765 # same.
776 self._options.reviewer = self["sheriff"] 766 self["sheriff"] = g_name + "@chromium.org"
767 self._options.reviewer = ("%s,%s" %
768 (self["sheriff"], self._options.reviewer))
777 print "Found active sheriff: %s" % self["sheriff"] 769 print "Found active sheriff: %s" % self["sheriff"]
778 else: 770 else:
779 print "No active sheriff found." 771 print "No active sheriff found."
780 772
781 773
782 def MakeStep(step_class=Step, number=0, state=None, config=None, 774 def MakeStep(step_class=Step, number=0, state=None, config=None,
783 options=None, side_effect_handler=DEFAULT_SIDE_EFFECT_HANDLER): 775 options=None, side_effect_handler=DEFAULT_SIDE_EFFECT_HANDLER):
784 # Allow to pass in empty dictionaries. 776 # Allow to pass in empty dictionaries.
785 state = state if state is not None else {} 777 state = state if state is not None else {}
786 config = config if config is not None else {} 778 config = config if config is not None else {}
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 810
819 def _Config(self): 811 def _Config(self):
820 return {} 812 return {}
821 813
822 def MakeOptions(self, args=None): 814 def MakeOptions(self, args=None):
823 parser = argparse.ArgumentParser(description=self._Description()) 815 parser = argparse.ArgumentParser(description=self._Description())
824 parser.add_argument("-a", "--author", default="", 816 parser.add_argument("-a", "--author", default="",
825 help="The author email used for rietveld.") 817 help="The author email used for rietveld.")
826 parser.add_argument("--dry-run", default=False, action="store_true", 818 parser.add_argument("--dry-run", default=False, action="store_true",
827 help="Perform only read-only actions.") 819 help="Perform only read-only actions.")
828 parser.add_argument("-g", "--googlers-mapping",
829 help="Path to the script mapping google accounts.")
830 parser.add_argument("-r", "--reviewer", default="", 820 parser.add_argument("-r", "--reviewer", default="",
831 help="The account name to be used for reviews.") 821 help="The account name to be used for reviews.")
832 parser.add_argument("--sheriff", default=False, action="store_true", 822 parser.add_argument("--sheriff", default=False, action="store_true",
833 help=("Determine current sheriff to review CLs. On " 823 help=("Determine current sheriff to review CLs. On "
834 "success, this will overwrite the reviewer " 824 "success, this will overwrite the reviewer "
835 "option.")) 825 "option."))
836 parser.add_argument("-s", "--step", 826 parser.add_argument("-s", "--step",
837 help="Specify the step where to start work. Default: 0.", 827 help="Specify the step where to start work. Default: 0.",
838 default=0, type=int) 828 default=0, type=int)
839 parser.add_argument("--work-dir", 829 parser.add_argument("--work-dir",
840 help=("Location where to bootstrap a working v8 " 830 help=("Location where to bootstrap a working v8 "
841 "checkout.")) 831 "checkout."))
842 self._PrepareOptions(parser) 832 self._PrepareOptions(parser)
843 833
844 if args is None: # pragma: no cover 834 if args is None: # pragma: no cover
845 options = parser.parse_args() 835 options = parser.parse_args()
846 else: 836 else:
847 options = parser.parse_args(args) 837 options = parser.parse_args(args)
848 838
849 # Process common options. 839 # Process common options.
850 if options.step < 0: # pragma: no cover 840 if options.step < 0: # pragma: no cover
851 print "Bad step number %d" % options.step 841 print "Bad step number %d" % options.step
852 parser.print_help() 842 parser.print_help()
853 return None 843 return None
854 if options.sheriff and not options.googlers_mapping: # pragma: no cover
855 print "To determine the current sheriff, requires the googler mapping"
856 parser.print_help()
857 return None
858 844
859 # Defaults for options, common to all scripts. 845 # Defaults for options, common to all scripts.
860 options.manual = getattr(options, "manual", True) 846 options.manual = getattr(options, "manual", True)
861 options.force = getattr(options, "force", False) 847 options.force = getattr(options, "force", False)
862 options.bypass_upload_hooks = False 848 options.bypass_upload_hooks = False
863 849
864 # Derived options. 850 # Derived options.
865 options.requires_editor = not options.force 851 options.requires_editor = not options.force
866 options.wait_for_lgtm = not options.force 852 options.wait_for_lgtm = not options.force
867 options.force_readline_defaults = not options.manual 853 options.force_readline_defaults = not options.manual
(...skipping 21 matching lines...) Expand all
889 for (number, step_class) in enumerate([BootstrapStep] + step_classes): 875 for (number, step_class) in enumerate([BootstrapStep] + step_classes):
890 steps.append(MakeStep(step_class, number, self._state, self._config, 876 steps.append(MakeStep(step_class, number, self._state, self._config,
891 options, self._side_effect_handler)) 877 options, self._side_effect_handler))
892 for step in steps[options.step:]: 878 for step in steps[options.step:]:
893 if step.Run(): 879 if step.Run():
894 return 0 880 return 0
895 return 0 881 return 0
896 882
897 def Run(self, args=None): 883 def Run(self, args=None):
898 return self.RunSteps(self._Steps(), args) 884 return self.RunSteps(self._Steps(), args)
OLDNEW
« no previous file with comments | « tools/release/chromium_roll.py ('k') | tools/release/test_scripts.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698