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 34 matching lines...) Loading... |
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.r = options.r | |
56 self.c = options.c | 55 self.c = options.c |
57 self.push = getattr(options, 'push', False) | 56 self.push = getattr(options, 'push', False) |
58 self.author = getattr(options, 'a', None) | 57 self.author = getattr(options, 'a', None) |
59 | 58 |
60 | 59 |
61 class Preparation(Step): | 60 class Preparation(Step): |
62 MESSAGE = "Preparation." | 61 MESSAGE = "Preparation." |
63 | 62 |
64 def RunStep(self): | 63 def RunStep(self): |
65 self.InitialEnvironmentChecks() | 64 self.InitialEnvironmentChecks() |
(...skipping 89 matching lines...) Loading... |
155 print "ToT (r%d) is clean. Pushing to trunk." % latest | 154 print "ToT (r%d) is clean. Pushing to trunk." % latest |
156 self.PushTreeStatus("Tree is closed (preparing to push)") | 155 self.PushTreeStatus("Tree is closed (preparing to push)") |
157 | 156 |
158 # TODO(machenbach): Update the script before calling it. | 157 # TODO(machenbach): Update the script before calling it. |
159 try: | 158 try: |
160 if self._options.push: | 159 if self._options.push: |
161 self._side_effect_handler.Call( | 160 self._side_effect_handler.Call( |
162 RunPushToTrunk, | 161 RunPushToTrunk, |
163 push_to_trunk.CONFIG, | 162 push_to_trunk.CONFIG, |
164 PushToTrunkOptions.MakeForcedOptions(self._options.author, | 163 PushToTrunkOptions.MakeForcedOptions(self._options.author, |
165 self._options.r, | 164 self._options.reviewer, |
166 self._options.c), | 165 self._options.c), |
167 self._side_effect_handler) | 166 self._side_effect_handler) |
168 finally: | 167 finally: |
169 self.PushTreeStatus(self._state["tree_message"]) | 168 self.PushTreeStatus(self._state["tree_message"]) |
170 else: | 169 else: |
171 print("ToT (r%d) is ahead of the LKGR (r%d). Skipping push to trunk." | 170 print("ToT (r%d) is ahead of the LKGR (r%d). Skipping push to trunk." |
172 % (latest, lkgr)) | 171 % (latest, lkgr)) |
173 | 172 |
174 | 173 |
175 def RunAutoRoll(config, | 174 def RunAutoRoll(config, |
(...skipping 14 matching lines...) Loading... |
190 def BuildOptions(): | 189 def BuildOptions(): |
191 result = optparse.OptionParser() | 190 result = optparse.OptionParser() |
192 result.add_option("-a", "--author", dest="a", | 191 result.add_option("-a", "--author", dest="a", |
193 help=("Specify the author email used for rietveld.")) | 192 help=("Specify the author email used for rietveld.")) |
194 result.add_option("-c", "--chromium", dest="c", | 193 result.add_option("-c", "--chromium", dest="c", |
195 help=("Specify the path to your Chromium src/ " | 194 help=("Specify the path to your Chromium src/ " |
196 "directory to automate the V8 roll.")) | 195 "directory to automate the V8 roll.")) |
197 result.add_option("-p", "--push", | 196 result.add_option("-p", "--push", |
198 help="Push to trunk if possible. Dry run if unspecified.", | 197 help="Push to trunk if possible. Dry run if unspecified.", |
199 default=False, action="store_true") | 198 default=False, action="store_true") |
200 result.add_option("-r", "--reviewer", dest="r", | 199 result.add_option("-r", "--reviewer", |
201 help=("Specify the account name to be used for reviews.")) | 200 help=("Specify the account name to be used for reviews.")) |
202 result.add_option("-s", "--step", dest="s", | 201 result.add_option("-s", "--step", dest="s", |
203 help="Specify the step where to start work. Default: 0.", | 202 help="Specify the step where to start work. Default: 0.", |
204 default=0, type="int") | 203 default=0, type="int") |
205 result.add_option("--status-password", | 204 result.add_option("--status-password", |
206 help="A file with the password to the status app.") | 205 help="A file with the password to the status app.") |
207 return result | 206 return result |
208 | 207 |
209 | 208 |
210 def Main(): | 209 def Main(): |
211 parser = BuildOptions() | 210 parser = BuildOptions() |
212 (options, args) = parser.parse_args() | 211 (options, args) = parser.parse_args() |
213 if not options.a or not options.c or not options.r: | 212 if not options.a or not options.c or not options.reviewer: |
214 print "You need to specify author, chromium src location and reviewer." | 213 print "You need to specify author, chromium src location and reviewer." |
215 parser.print_help() | 214 parser.print_help() |
216 return 1 | 215 return 1 |
217 RunAutoRoll(CONFIG, AutoRollOptions(options)) | 216 RunAutoRoll(CONFIG, AutoRollOptions(options)) |
218 | 217 |
219 if __name__ == "__main__": | 218 if __name__ == "__main__": |
220 sys.exit(Main()) | 219 sys.exit(Main()) |
OLD | NEW |