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 and Gerrit.""" | 8 """A git-command for integrating reviews on Rietveld and Gerrit.""" |
9 | 9 |
10 from __future__ import print_function | 10 from __future__ import print_function |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 def _get_bucket_map(changelist, options, option_parser): | 343 def _get_bucket_map(changelist, options, option_parser): |
344 """Returns a dict mapping bucket names to builders and tests, | 344 """Returns a dict mapping bucket names to builders and tests, |
345 for triggering try jobs. | 345 for triggering try jobs. |
346 """ | 346 """ |
347 # If no bots are listed, we try to get a set of builders and tests based | 347 # If no bots are listed, we try to get a set of builders and tests based |
348 # on GetPreferredTryMasters functions in PRESUBMIT.py files. | 348 # on GetPreferredTryMasters functions in PRESUBMIT.py files. |
349 if not options.bot: | 349 if not options.bot: |
350 change = changelist.GetChange( | 350 change = changelist.GetChange( |
351 changelist.GetCommonAncestorWithUpstream(), None) | 351 changelist.GetCommonAncestorWithUpstream(), None) |
352 # Get try masters from PRESUBMIT.py files. | 352 # Get try masters from PRESUBMIT.py files. |
353 return presubmit_support.DoGetTryMasters( | 353 masters = presubmit_support.DoGetTryMasters( |
354 change=change, | 354 change=change, |
355 changed_files=change.LocalPaths(), | 355 changed_files=change.LocalPaths(), |
356 repository_root=settings.GetRoot(), | 356 repository_root=settings.GetRoot(), |
357 default_presubmit=None, | 357 default_presubmit=None, |
358 project=None, | 358 project=None, |
359 verbose=options.verbose, | 359 verbose=options.verbose, |
360 output_stream=sys.stdout) | 360 output_stream=sys.stdout) |
| 361 if masters is None: |
| 362 return None |
| 363 return {MASTER_PREFIX + m: b for m, b in masters.iteritems()} |
361 | 364 |
362 if options.bucket: | 365 if options.bucket: |
363 return {options.bucket: {b: [] for b in options.bot}} | 366 return {options.bucket: {b: [] for b in options.bot}} |
364 if options.master: | 367 if options.master: |
365 return {_prefix_master(options.master): {b: [] for b in options.bot}} | 368 return {_prefix_master(options.master): {b: [] for b in options.bot}} |
366 | 369 |
367 # If bots are listed but no master or bucket, then we need to find out | 370 # If bots are listed but no master or bucket, then we need to find out |
368 # the corresponding master for each bot. | 371 # the corresponding master for each bot. |
369 bucket_map, error_message = _get_bucket_map_for_builders(options.bot) | 372 bucket_map, error_message = _get_bucket_map_for_builders(options.bot) |
370 if error_message: | 373 if error_message: |
(...skipping 5015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5386 if __name__ == '__main__': | 5389 if __name__ == '__main__': |
5387 # These affect sys.stdout so do it outside of main() to simplify mocks in | 5390 # These affect sys.stdout so do it outside of main() to simplify mocks in |
5388 # unit testing. | 5391 # unit testing. |
5389 fix_encoding.fix_encoding() | 5392 fix_encoding.fix_encoding() |
5390 setup_color.init() | 5393 setup_color.init() |
5391 try: | 5394 try: |
5392 sys.exit(main(sys.argv[1:])) | 5395 sys.exit(main(sys.argv[1:])) |
5393 except KeyboardInterrupt: | 5396 except KeyboardInterrupt: |
5394 sys.stderr.write('interrupted\n') | 5397 sys.stderr.write('interrupted\n') |
5395 sys.exit(1) | 5398 sys.exit(1) |
OLD | NEW |