OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 | 7 |
8 """ | 8 """ |
9 submit_try: Submit a try request. | 9 submit_try: Submit a try request. |
10 | 10 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 return self._changelist | 141 return self._changelist |
142 | 142 |
143 @property | 143 @property |
144 def revision(self): | 144 def revision(self): |
145 return self._revision | 145 return self._revision |
146 | 146 |
147 usage = ( | 147 usage = ( |
148 """submit_try: Submit a try request. | 148 """submit_try: Submit a try request. |
149 submit_try %s--bot <buildername> [<buildername> ...] | 149 submit_try %s--bot <buildername> [<buildername> ...] |
150 | 150 |
151 --bot Builder on which to run the try. Required. | 151 -b, --bot Builder on which to run the try. Required. |
152 -h, --help Show this message. | 152 -h, --help Show this message. |
153 -r <revision#> Revision from which to run the try. | 153 -r <revision#> Revision from which to run the try. |
154 -l, --list_bots List the available try builders and exit. | 154 -l, --list_bots List the available try builders and exit. |
155 """ % ('<changelist> ' if is_svn else '')) | 155 """ % ('<changelist> ' if is_svn else '')) |
156 | 156 |
157 def Error(msg=None): | 157 def Error(msg=None): |
158 if msg: | 158 if msg: |
159 print msg | 159 print msg |
160 print usage | 160 print usage |
161 sys.exit(1) | 161 sys.exit(1) |
162 | 162 |
163 using_bots = None | 163 using_bots = None |
164 changelist = None | 164 changelist = None |
165 revision = None | 165 revision = None |
166 | 166 |
167 while argv: | 167 while argv: |
168 arg = argv.pop(0) | 168 arg = argv.pop(0) |
169 if arg == '-h' or arg == '--help': | 169 if arg == '-h' or arg == '--help': |
170 Error() | 170 Error() |
171 elif arg == '-l' or arg == '--list_bots': | 171 elif arg == '-l' or arg == '--list_bots': |
172 print 'submit_try: Available builders:\n %s' % '\n '.join(trybots) | 172 print 'submit_try: Available builders:\n %s' % '\n '.join(trybots) |
173 sys.exit(0) | 173 sys.exit(0) |
174 elif arg == '--bot': | 174 elif arg == '-b' or arg == '--bot': |
175 if using_bots: | 175 if using_bots: |
176 Error('--bot specified multiple times.') | 176 Error('--bot specified multiple times.') |
177 if len(argv) < 1: | 177 if len(argv) < 1: |
178 Error('You must specify a builder with "--bot".') | 178 Error('You must specify a builder with "--bot".') |
179 using_bots = [] | 179 using_bots = [] |
180 while argv and not argv[0].startswith('-'): | 180 while argv and not argv[0].startswith('-'): |
181 bot = argv.pop(0) | 181 bot = argv.pop(0) |
182 if bot == ALL_BUILDERS: | 182 if bot == ALL_BUILDERS: |
183 if using_bots: | 183 if using_bots: |
184 Error('Cannot specify "all" with additional builder names.') | 184 Error('Cannot specify "all" with additional builder names.') |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 | 255 |
256 # Parse and validate the command-line arguments. | 256 # Parse and validate the command-line arguments. |
257 args = ValidateArgs(sys.argv[1:], trybots=trybots, is_svn=is_svn) | 257 args = ValidateArgs(sys.argv[1:], trybots=trybots, is_svn=is_svn) |
258 | 258 |
259 # Submit the try request. | 259 # Submit the try request. |
260 SubmitTryRequest(args, is_svn=is_svn) | 260 SubmitTryRequest(args, is_svn=is_svn) |
261 | 261 |
262 | 262 |
263 if __name__ == '__main__': | 263 if __name__ == '__main__': |
264 sys.exit(main()) | 264 sys.exit(main()) |
OLD | NEW |