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

Side by Side Diff: tools/push-to-trunk/auto_roll.py

Issue 180873010: Refactoring: Long option names in push and merge scripts. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | tools/push-to-trunk/common_includes.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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 DOT_GIT_LOCATION: ".git", 45 DOT_GIT_LOCATION: ".git",
46 SETTINGS_LOCATION: "~/.auto-roll", 46 SETTINGS_LOCATION: "~/.auto-roll",
47 } 47 }
48 48
49 49
50 class AutoRollOptions(CommonOptions): 50 class AutoRollOptions(CommonOptions):
51 def __init__(self, options): 51 def __init__(self, options):
52 super(AutoRollOptions, self).__init__(options) 52 super(AutoRollOptions, self).__init__(options)
53 self.requires_editor = False 53 self.requires_editor = False
54 self.status_password = options.status_password 54 self.status_password = options.status_password
55 self.c = options.c 55 self.chromium = options.chromium
56 self.push = getattr(options, 'push', False) 56 self.push = getattr(options, 'push', False)
57 self.author = getattr(options, 'a', None) 57 self.author = getattr(options, 'author', None)
58 58
59 59
60 class Preparation(Step): 60 class Preparation(Step):
61 MESSAGE = "Preparation." 61 MESSAGE = "Preparation."
62 62
63 def RunStep(self): 63 def RunStep(self):
64 self.InitialEnvironmentChecks() 64 self.InitialEnvironmentChecks()
65 self.CommonPrepare() 65 self.CommonPrepare()
66 66
67 67
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 self.PushTreeStatus("Tree is closed (preparing to push)") 148 self.PushTreeStatus("Tree is closed (preparing to push)")
149 149
150 # TODO(machenbach): Update the script before calling it. 150 # TODO(machenbach): Update the script before calling it.
151 try: 151 try:
152 if self._options.push: 152 if self._options.push:
153 self._side_effect_handler.Call( 153 self._side_effect_handler.Call(
154 RunPushToTrunk, 154 RunPushToTrunk,
155 push_to_trunk.CONFIG, 155 push_to_trunk.CONFIG,
156 PushToTrunkOptions.MakeForcedOptions(self._options.author, 156 PushToTrunkOptions.MakeForcedOptions(self._options.author,
157 self._options.reviewer, 157 self._options.reviewer,
158 self._options.c), 158 self._options.chromium),
159 self._side_effect_handler) 159 self._side_effect_handler)
160 finally: 160 finally:
161 self.PushTreeStatus(self["tree_message"]) 161 self.PushTreeStatus(self["tree_message"])
162 else: 162 else:
163 print("ToT (r%d) is ahead of the LKGR (r%d). Skipping push to trunk." 163 print("ToT (r%d) is ahead of the LKGR (r%d). Skipping push to trunk."
164 % (latest, lkgr)) 164 % (latest, lkgr))
165 165
166 166
167 def RunAutoRoll(config, 167 def RunAutoRoll(config,
168 options, 168 options,
169 side_effect_handler=DEFAULT_SIDE_EFFECT_HANDLER): 169 side_effect_handler=DEFAULT_SIDE_EFFECT_HANDLER):
170 step_classes = [ 170 step_classes = [
171 Preparation, 171 Preparation,
172 CheckAutoRollSettings, 172 CheckAutoRollSettings,
173 CheckTreeStatus, 173 CheckTreeStatus,
174 FetchLatestRevision, 174 FetchLatestRevision,
175 CheckLastPush, 175 CheckLastPush,
176 FetchLKGR, 176 FetchLKGR,
177 PushToTrunk, 177 PushToTrunk,
178 ] 178 ]
179 RunScript(step_classes, config, options, side_effect_handler) 179 RunScript(step_classes, config, options, side_effect_handler)
180 180
181 181
182 def BuildOptions(): 182 def BuildOptions():
183 parser = argparse.ArgumentParser() 183 parser = argparse.ArgumentParser()
184 parser.add_argument("-a", "--author", dest="a", 184 parser.add_argument("-a", "--author",
185 help="The author email used for rietveld.") 185 help="The author email used for rietveld.")
186 parser.add_argument("-c", "--chromium", dest="c", 186 parser.add_argument("-c", "--chromium",
187 help=("The path to your Chromium src/ directory to " 187 help=("The path to your Chromium src/ directory to "
188 "automate the V8 roll.")) 188 "automate the V8 roll."))
189 parser.add_argument("-p", "--push", 189 parser.add_argument("-p", "--push",
190 help="Push to trunk if possible. Dry run if unspecified.", 190 help="Push to trunk if possible. Dry run if unspecified.",
191 default=False, action="store_true") 191 default=False, action="store_true")
192 parser.add_argument("-r", "--reviewer", 192 parser.add_argument("-r", "--reviewer",
193 help="The account name to be used for reviews.") 193 help="The account name to be used for reviews.")
194 parser.add_argument("-s", "--step", dest="s", 194 parser.add_argument("-s", "--step",
195 help="Specify the step where to start work. Default: 0.", 195 help="Specify the step where to start work. Default: 0.",
196 default=0, type=int) 196 default=0, type=int)
197 parser.add_argument("--status-password", 197 parser.add_argument("--status-password",
198 help="A file with the password to the status app.") 198 help="A file with the password to the status app.")
199 return parser 199 return parser
200 200
201 201
202 def Main(): 202 def Main():
203 parser = BuildOptions() 203 parser = BuildOptions()
204 options = parser.parse_args() 204 options = parser.parse_args()
205 if not options.a or not options.c or not options.reviewer: 205 if not options.author or not options.chromium or not options.reviewer:
206 print "You need to specify author, chromium src location and reviewer." 206 print "You need to specify author, chromium src location and reviewer."
207 parser.print_help() 207 parser.print_help()
208 return 1 208 return 1
209 RunAutoRoll(CONFIG, AutoRollOptions(options)) 209 RunAutoRoll(CONFIG, AutoRollOptions(options))
210 210
211 if __name__ == "__main__": 211 if __name__ == "__main__":
212 sys.exit(Main()) 212 sys.exit(Main())
OLDNEW
« no previous file with comments | « no previous file | tools/push-to-trunk/common_includes.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698