| 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 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 'changes': [{ | 502 'changes': [{ |
| 503 'author': {'email': owner_email}, | 503 'author': {'email': owner_email}, |
| 504 'revision': options.revision, | 504 'revision': options.revision, |
| 505 }], | 505 }], |
| 506 'properties': { | 506 'properties': { |
| 507 'category': category, | 507 'category': category, |
| 508 'issue': changelist.GetIssue(), | 508 'issue': changelist.GetIssue(), |
| 509 'patch_project': project, | 509 'patch_project': project, |
| 510 'patch_storage': 'rietveld', | 510 'patch_storage': 'rietveld', |
| 511 'patchset': patchset, | 511 'patchset': patchset, |
| 512 'reason': options.name, | |
| 513 'rietveld': codereview_url, | 512 'rietveld': codereview_url, |
| 514 }, | 513 }, |
| 515 } | 514 } |
| 516 if 'presubmit' in builder.lower(): | 515 if 'presubmit' in builder.lower(): |
| 517 parameters['properties']['dry_run'] = 'true' | 516 parameters['properties']['dry_run'] = 'true' |
| 518 if tests: | 517 if tests: |
| 519 parameters['properties']['testfilter'] = tests | 518 parameters['properties']['testfilter'] = tests |
| 520 if extra_properties: | 519 if extra_properties: |
| 521 parameters['properties'].update(extra_properties) | 520 parameters['properties'].update(extra_properties) |
| 522 if options.clobber: | 521 if options.clobber: |
| (...skipping 4314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4837 help='Override which project to use. Projects are defined ' | 4836 help='Override which project to use. Projects are defined ' |
| 4838 'in recipe to determine to which repository or directory to ' | 4837 'in recipe to determine to which repository or directory to ' |
| 4839 'apply the patch') | 4838 'apply the patch') |
| 4840 group.add_option( | 4839 group.add_option( |
| 4841 '-p', '--property', dest='properties', action='append', default=[], | 4840 '-p', '--property', dest='properties', action='append', default=[], |
| 4842 help='Specify generic properties in the form -p key1=value1 -p ' | 4841 help='Specify generic properties in the form -p key1=value1 -p ' |
| 4843 'key2=value2 etc. The value will be treated as ' | 4842 'key2=value2 etc. The value will be treated as ' |
| 4844 'json if decodable, or as string otherwise. ' | 4843 'json if decodable, or as string otherwise. ' |
| 4845 'NOTE: using this may make your try job not usable for CQ, ' | 4844 'NOTE: using this may make your try job not usable for CQ, ' |
| 4846 'which will then schedule another try job with default properties') | 4845 'which will then schedule another try job with default properties') |
| 4847 # TODO(tandrii): if this even used? | |
| 4848 group.add_option( | |
| 4849 '-n', '--name', help='Try job name; default to current branch name') | |
| 4850 group.add_option( | 4846 group.add_option( |
| 4851 '--buildbucket-host', default='cr-buildbucket.appspot.com', | 4847 '--buildbucket-host', default='cr-buildbucket.appspot.com', |
| 4852 help='Host of buildbucket. The default host is %default.') | 4848 help='Host of buildbucket. The default host is %default.') |
| 4853 parser.add_option_group(group) | 4849 parser.add_option_group(group) |
| 4854 auth.add_auth_options(parser) | 4850 auth.add_auth_options(parser) |
| 4855 options, args = parser.parse_args(args) | 4851 options, args = parser.parse_args(args) |
| 4856 auth_config = auth.extract_auth_config_from_options(options) | 4852 auth_config = auth.extract_auth_config_from_options(options) |
| 4857 | 4853 |
| 4858 # Make sure that all properties are prop=value pairs. | 4854 # Make sure that all properties are prop=value pairs. |
| 4859 bad_params = [x for x in options.properties if '=' not in x] | 4855 bad_params = [x for x in options.properties if '=' not in x] |
| (...skipping 10 matching lines...) Expand all Loading... |
| 4870 if cl.IsGerrit(): | 4866 if cl.IsGerrit(): |
| 4871 parser.error( | 4867 parser.error( |
| 4872 'Not yet supported for Gerrit (http://crbug.com/599931).\n' | 4868 'Not yet supported for Gerrit (http://crbug.com/599931).\n' |
| 4873 'If your project has Commit Queue, dry run is a workaround:\n' | 4869 'If your project has Commit Queue, dry run is a workaround:\n' |
| 4874 ' git cl set-commit --dry-run') | 4870 ' git cl set-commit --dry-run') |
| 4875 | 4871 |
| 4876 error_message = cl.CannotTriggerTryJobReason() | 4872 error_message = cl.CannotTriggerTryJobReason() |
| 4877 if error_message: | 4873 if error_message: |
| 4878 parser.error('Can\'t trigger try jobs: %s' % error_message) | 4874 parser.error('Can\'t trigger try jobs: %s' % error_message) |
| 4879 | 4875 |
| 4880 if not options.name: | |
| 4881 options.name = cl.GetBranch() | |
| 4882 | |
| 4883 if options.bucket and options.master: | 4876 if options.bucket and options.master: |
| 4884 parser.error('Only one of --bucket and --master may be used.') | 4877 parser.error('Only one of --bucket and --master may be used.') |
| 4885 | 4878 |
| 4886 buckets = _get_bucket_map(cl, options, parser) | 4879 buckets = _get_bucket_map(cl, options, parser) |
| 4887 | 4880 |
| 4888 if not buckets: | 4881 if not buckets: |
| 4889 # Default to triggering Dry Run (see http://crbug.com/625697). | 4882 # Default to triggering Dry Run (see http://crbug.com/625697). |
| 4890 if options.verbose: | 4883 if options.verbose: |
| 4891 print('git cl try with no bots now defaults to CQ Dry Run.') | 4884 print('git cl try with no bots now defaults to CQ Dry Run.') |
| 4892 return cl.TriggerDryRun() | 4885 return cl.TriggerDryRun() |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5410 if __name__ == '__main__': | 5403 if __name__ == '__main__': |
| 5411 # These affect sys.stdout so do it outside of main() to simplify mocks in | 5404 # These affect sys.stdout so do it outside of main() to simplify mocks in |
| 5412 # unit testing. | 5405 # unit testing. |
| 5413 fix_encoding.fix_encoding() | 5406 fix_encoding.fix_encoding() |
| 5414 setup_color.init() | 5407 setup_color.init() |
| 5415 try: | 5408 try: |
| 5416 sys.exit(main(sys.argv[1:])) | 5409 sys.exit(main(sys.argv[1:])) |
| 5417 except KeyboardInterrupt: | 5410 except KeyboardInterrupt: |
| 5418 sys.stderr.write('interrupted\n') | 5411 sys.stderr.write('interrupted\n') |
| 5419 sys.exit(1) | 5412 sys.exit(1) |
| OLD | NEW |