OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 # Copyright (C) 2008 Evan Martin <martine@danga.com> | 6 # Copyright (C) 2008 Evan Martin <martine@danga.com> |
7 | 7 |
8 """A git-command for integrating reviews on Rietveld.""" | 8 """A git-command for integrating reviews on Rietveld.""" |
9 | 9 |
10 from distutils.version import LooseVersion | 10 from distutils.version import LooseVersion |
(...skipping 2079 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2090 change.LocalPaths(), | 2090 change.LocalPaths(), |
2091 settings.GetRoot(), | 2091 settings.GetRoot(), |
2092 None, | 2092 None, |
2093 None, | 2093 None, |
2094 options.verbose, | 2094 options.verbose, |
2095 sys.stdout) | 2095 sys.stdout) |
2096 if not options.bot: | 2096 if not options.bot: |
2097 parser.error('No default try builder to try, use --bot') | 2097 parser.error('No default try builder to try, use --bot') |
2098 | 2098 |
2099 builders_and_tests = {} | 2099 builders_and_tests = {} |
2100 for bot in options.bot: | 2100 old_style = filter(lambda x: isinstance(x, basestring), options.bot) |
| 2101 new_style = filter(lambda x: isinstance(x, tuple), options.bot) |
| 2102 |
| 2103 for bot in old_style: |
2101 if ':' in bot: | 2104 if ':' in bot: |
2102 builder, tests = bot.split(':', 1) | 2105 builder, tests = bot.split(':', 1) |
2103 builders_and_tests.setdefault(builder, []).extend(tests.split(',')) | 2106 builders_and_tests.setdefault(builder, []).extend(tests.split(',')) |
2104 elif ',' in bot: | 2107 elif ',' in bot: |
2105 parser.error('Specify one bot per --bot flag') | 2108 parser.error('Specify one bot per --bot flag') |
2106 else: | 2109 else: |
2107 builders_and_tests.setdefault(bot, []).append('defaulttests') | 2110 builders_and_tests.setdefault(bot, []).append('defaulttests') |
2108 | 2111 |
| 2112 for bot, tests in new_style: |
| 2113 builders_and_tests.setdefault(bot, []).extend(tests) |
| 2114 |
2109 if options.testfilter: | 2115 if options.testfilter: |
2110 forced_tests = sum((t.split(',') for t in options.testfilter), []) | 2116 forced_tests = sum((t.split(',') for t in options.testfilter), []) |
2111 builders_and_tests = dict( | 2117 builders_and_tests = dict( |
2112 (b, forced_tests) for b, t in builders_and_tests.iteritems() | 2118 (b, forced_tests) for b, t in builders_and_tests.iteritems() |
2113 if t != ['compile']) | 2119 if t != ['compile']) |
2114 | 2120 |
2115 if any('triggered' in b for b in builders_and_tests): | 2121 if any('triggered' in b for b in builders_and_tests): |
2116 print >> sys.stderr, ( | 2122 print >> sys.stderr, ( |
2117 'ERROR You are trying to send a job to a triggered bot. This type of' | 2123 'ERROR You are trying to send a job to a triggered bot. This type of' |
2118 ' bot requires an\ninitial job from a parent (usually a builder). ' | 2124 ' bot requires an\ninitial job from a parent (usually a builder). ' |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2362 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' | 2368 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' |
2363 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) | 2369 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) |
2364 | 2370 |
2365 | 2371 |
2366 if __name__ == '__main__': | 2372 if __name__ == '__main__': |
2367 # These affect sys.stdout so do it outside of main() to simplify mocks in | 2373 # These affect sys.stdout so do it outside of main() to simplify mocks in |
2368 # unit testing. | 2374 # unit testing. |
2369 fix_encoding.fix_encoding() | 2375 fix_encoding.fix_encoding() |
2370 colorama.init() | 2376 colorama.init() |
2371 sys.exit(main(sys.argv[1:])) | 2377 sys.exit(main(sys.argv[1:])) |
OLD | NEW |