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