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 4589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4600 | 4600 |
4601 print('The tree is %s' % status) | 4601 print('The tree is %s' % status) |
4602 print() | 4602 print() |
4603 print(GetTreeStatusReason()) | 4603 print(GetTreeStatusReason()) |
4604 if status != 'open': | 4604 if status != 'open': |
4605 return 1 | 4605 return 1 |
4606 return 0 | 4606 return 0 |
4607 | 4607 |
4608 | 4608 |
4609 def CMDtry(parser, args): | 4609 def CMDtry(parser, args): |
4610 """Triggers try jobs through BuildBucket.""" | 4610 '''Triggers try jobs through BuildBucket.''' |
4611 group = optparse.OptionGroup(parser, "Try job options") | 4611 group = optparse.OptionGroup(parser, 'Try job options') |
4612 group.add_option( | 4612 group.add_option( |
4613 "-b", "--bot", action="append", | 4613 '-b', '--bot', action='append', |
4614 help=("IMPORTANT: specify ONE builder per --bot flag. Use it multiple " | 4614 help=('IMPORTANT: specify ONE builder per --bot flag. Use it multiple ' |
4615 "times to specify multiple builders. ex: " | 4615 'times to specify multiple builders. ex: ' |
4616 "'-b win_rel -b win_layout'. See " | 4616 '"-b win_rel -b win_layout". See ' |
4617 "the try server waterfall for the builders name and the tests " | 4617 'the try server waterfall for the builders name and the tests ' |
4618 "available.")) | 4618 'available.')) |
4619 group.add_option( | 4619 group.add_option( |
4620 "-m", "--master", default='', | 4620 '-m', '--master', default='', |
4621 help=("Specify a try master where to run the tries.")) | 4621 help=('Specify a try master where to run the tries.')) |
4622 group.add_option( | 4622 group.add_option( |
4623 "-r", "--revision", | 4623 '-r', '--revision', |
4624 help="Revision to use for the try job; default: the " | 4624 help='Revision to use for the try job; default: the ' |
4625 "revision will be determined by the try server; see " | 4625 'revision will be determined by the try server; see ' |
4626 "its waterfall for more info") | 4626 'its waterfall for more info') |
4627 group.add_option( | 4627 group.add_option( |
4628 "-c", "--clobber", action="store_true", default=False, | 4628 '-c', '--clobber', action='store_true', default=False, |
4629 help="Force a clobber before building; e.g. don't do an " | 4629 help='Force a clobber before building; e.g. don\'t do an ' |
4630 "incremental build") | 4630 'incremental build') |
4631 group.add_option( | 4631 group.add_option( |
4632 "--project", | 4632 '--project', |
4633 help="Override which project to use. Projects are defined " | 4633 help='Override which project to use. Projects are defined ' |
4634 "server-side to define what default bot set to use") | 4634 'server-side to define what default bot set to use') |
4635 group.add_option( | 4635 group.add_option( |
4636 "-p", "--property", dest="properties", action="append", default=[], | 4636 '-p', '--property', dest='properties', action='append', default=[], |
4637 help="Specify generic properties in the form -p key1=value1 -p " | 4637 help='Specify generic properties in the form -p key1=value1 -p ' |
4638 "key2=value2 etc (buildbucket only). The value will be treated as " | 4638 'key2=value2 etc (buildbucket only). The value will be treated as ' |
4639 "json if decodable, or as string otherwise.") | 4639 'json if decodable, or as string otherwise.') |
4640 group.add_option( | 4640 group.add_option( |
4641 "-n", "--name", help="Try job name; default to current branch name") | 4641 '-n', '--name', help='Try job name; default to current branch name') |
4642 group.add_option( | 4642 group.add_option( |
4643 "--use-rietveld", action="store_true", default=False, | 4643 '--use-rietveld', action='store_true', default=False, |
4644 help="Use Rietveld to trigger try jobs.") | 4644 help='Use Rietveld to trigger try jobs.') |
4645 group.add_option( | 4645 group.add_option( |
4646 "--buildbucket-host", default='cr-buildbucket.appspot.com', | 4646 '--buildbucket-host', default='cr-buildbucket.appspot.com', |
4647 help="Host of buildbucket. The default host is %default.") | 4647 help='Host of buildbucket. The default host is %default.') |
4648 parser.add_option_group(group) | 4648 parser.add_option_group(group) |
4649 auth.add_auth_options(parser) | 4649 auth.add_auth_options(parser) |
4650 options, args = parser.parse_args(args) | 4650 options, args = parser.parse_args(args) |
4651 auth_config = auth.extract_auth_config_from_options(options) | 4651 auth_config = auth.extract_auth_config_from_options(options) |
4652 | 4652 |
4653 if options.use_rietveld and options.properties: | 4653 if options.use_rietveld and options.properties: |
4654 parser.error('Properties can only be specified with buildbucket') | 4654 parser.error('Properties can only be specified with buildbucket') |
4655 | 4655 |
4656 # Make sure that all properties are prop=value pairs. | 4656 # Make sure that all properties are prop=value pairs. |
4657 bad_params = [x for x in options.properties if '=' not in x] | 4657 bad_params = [x for x in options.properties if '=' not in x] |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4806 for (master, builders) in sorted(masters.iteritems()): | 4806 for (master, builders) in sorted(masters.iteritems()): |
4807 if master: | 4807 if master: |
4808 print('Master: %s' % master) | 4808 print('Master: %s' % master) |
4809 length = max(len(builder) for builder in builders) | 4809 length = max(len(builder) for builder in builders) |
4810 for builder in sorted(builders): | 4810 for builder in sorted(builders): |
4811 print(' %*s: %s' % (length, builder, ','.join(builders[builder]))) | 4811 print(' %*s: %s' % (length, builder, ','.join(builders[builder]))) |
4812 return 0 | 4812 return 0 |
4813 | 4813 |
4814 | 4814 |
4815 def CMDtry_results(parser, args): | 4815 def CMDtry_results(parser, args): |
4816 group = optparse.OptionGroup(parser, "Try job results options") | 4816 """Prints info about try jobs associated with current CL.""" |
| 4817 group = optparse.OptionGroup(parser, 'Try job results options') |
4817 group.add_option( | 4818 group.add_option( |
4818 "-p", "--patchset", type=int, help="patchset number if not current.") | 4819 '-p', '--patchset', type=int, help='patchset number if not current.') |
4819 group.add_option( | 4820 group.add_option( |
4820 "--print-master", action='store_true', help="print master name as well.") | 4821 '--print-master', action='store_true', help='print master name as well.') |
4821 group.add_option( | 4822 group.add_option( |
4822 "--color", action='store_true', default=setup_color.IS_TTY, | 4823 '--color', action='store_true', default=setup_color.IS_TTY, |
4823 help="force color output, useful when piping output.") | 4824 help='force color output, useful when piping output.') |
4824 group.add_option( | 4825 group.add_option( |
4825 "--buildbucket-host", default='cr-buildbucket.appspot.com', | 4826 '--buildbucket-host', default='cr-buildbucket.appspot.com', |
4826 help="Host of buildbucket. The default host is %default.") | 4827 help='Host of buildbucket. The default host is %default.') |
4827 group.add_option( | 4828 group.add_option( |
4828 '--json', help='Path of JSON output file to write try job results to.') | 4829 '--json', help='Path of JSON output file to write try job results to.') |
4829 parser.add_option_group(group) | 4830 parser.add_option_group(group) |
4830 auth.add_auth_options(parser) | 4831 auth.add_auth_options(parser) |
4831 options, args = parser.parse_args(args) | 4832 options, args = parser.parse_args(args) |
4832 if args: | 4833 if args: |
4833 parser.error('Unrecognized args: %s' % ' '.join(args)) | 4834 parser.error('Unrecognized args: %s' % ' '.join(args)) |
4834 | 4835 |
4835 auth_config = auth.extract_auth_config_from_options(options) | 4836 auth_config = auth.extract_auth_config_from_options(options) |
4836 cl = Changelist(auth_config=auth_config) | 4837 cl = Changelist(auth_config=auth_config) |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5299 if __name__ == '__main__': | 5300 if __name__ == '__main__': |
5300 # These affect sys.stdout so do it outside of main() to simplify mocks in | 5301 # These affect sys.stdout so do it outside of main() to simplify mocks in |
5301 # unit testing. | 5302 # unit testing. |
5302 fix_encoding.fix_encoding() | 5303 fix_encoding.fix_encoding() |
5303 setup_color.init() | 5304 setup_color.init() |
5304 try: | 5305 try: |
5305 sys.exit(main(sys.argv[1:])) | 5306 sys.exit(main(sys.argv[1:])) |
5306 except KeyboardInterrupt: | 5307 except KeyboardInterrupt: |
5307 sys.stderr.write('interrupted\n') | 5308 sys.stderr.write('interrupted\n') |
5308 sys.exit(1) | 5309 sys.exit(1) |
OLD | NEW |