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

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

Issue 181583002: Refactoring: Deprecate optparse 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/merge_to_branch.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
11 # disclaimer in the documentation and/or other materials provided 11 # disclaimer in the documentation and/or other materials provided
12 # with the distribution. 12 # with the distribution.
13 # * Neither the name of Google Inc. nor the names of its 13 # * Neither the name of Google Inc. nor the names of its
14 # contributors may be used to endorse or promote products derived 14 # contributors may be used to endorse or promote products derived
15 # from this software without specific prior written permission. 15 # from this software without specific prior written permission.
16 # 16 #
17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 28
29 import argparse
29 import json 30 import json
30 import optparse
31 import os 31 import os
32 import re 32 import re
33 import sys 33 import sys
34 import urllib 34 import urllib
35 35
36 from common_includes import * 36 from common_includes import *
37 import push_to_trunk 37 import push_to_trunk
38 from push_to_trunk import PushToTrunkOptions 38 from push_to_trunk import PushToTrunkOptions
39 from push_to_trunk import RunPushToTrunk 39 from push_to_trunk import RunPushToTrunk
40 40
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 result = optparse.OptionParser() 183 parser = argparse.ArgumentParser()
184 result.add_option("-a", "--author", dest="a", 184 parser.add_argument("-a", "--author", dest="a",
185 help=("Specify the author email used for rietveld.")) 185 help="The author email used for rietveld.")
186 result.add_option("-c", "--chromium", dest="c", 186 parser.add_argument("-c", "--chromium", dest="c",
187 help=("Specify the path to your Chromium src/ " 187 help=("The path to your Chromium src/ directory to "
188 "directory to automate the V8 roll.")) 188 "automate the V8 roll."))
189 result.add_option("-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 result.add_option("-r", "--reviewer", 192 parser.add_argument("-r", "--reviewer",
193 help=("Specify the account name to be used for reviews.")) 193 help="The account name to be used for reviews.")
194 result.add_option("-s", "--step", dest="s", 194 parser.add_argument("-s", "--step", dest="s",
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 result.add_option("--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 result 199 return parser
200 200
201 201
202 def Main(): 202 def Main():
203 parser = BuildOptions() 203 parser = BuildOptions()
204 (options, args) = 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.a or not options.c 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/merge_to_branch.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698