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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
383 'changes': [{ | 383 'changes': [{ |
384 'author': {'email': owner_email}, | 384 'author': {'email': owner_email}, |
385 'revision': options.revision, | 385 'revision': options.revision, |
386 }], | 386 }], |
387 'properties': { | 387 'properties': { |
388 'category': category, | 388 'category': category, |
389 'issue': changelist.GetIssue(), | 389 'issue': changelist.GetIssue(), |
390 'patch_project': project, | 390 'patch_project': project, |
391 'patch_storage': 'rietveld', | 391 'patch_storage': 'rietveld', |
392 'patchset': patchset, | 392 'patchset': patchset, |
393 'reason': options.name, | 393 'reason': options.reason, |
394 'rietveld': codereview_url, | 394 'rietveld': codereview_url, |
395 }, | 395 }, |
396 } | 396 } |
397 if 'presubmit' in builder.lower(): | 397 if 'presubmit' in builder.lower(): |
398 parameters['properties']['dry_run'] = 'true' | 398 parameters['properties']['dry_run'] = 'true' |
399 if tests: | 399 if tests: |
400 parameters['properties']['testfilter'] = tests | 400 parameters['properties']['testfilter'] = tests |
401 if extra_properties: | 401 if extra_properties: |
402 parameters['properties'].update(extra_properties) | 402 parameters['properties'].update(extra_properties) |
403 if options.clobber: | 403 if options.clobber: |
(...skipping 4357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4761 help='Override which project to use. Projects are defined ' | 4761 help='Override which project to use. Projects are defined ' |
4762 'in recipe to determine to which repository or directory to ' | 4762 'in recipe to determine to which repository or directory to ' |
4763 'apply the patch') | 4763 'apply the patch') |
4764 group.add_option( | 4764 group.add_option( |
4765 '-p', '--property', dest='properties', action='append', default=[], | 4765 '-p', '--property', dest='properties', action='append', default=[], |
4766 help='Specify generic properties in the form -p key1=value1 -p ' | 4766 help='Specify generic properties in the form -p key1=value1 -p ' |
4767 'key2=value2 etc. The value will be treated as ' | 4767 'key2=value2 etc. The value will be treated as ' |
4768 'json if decodable, or as string otherwise. ' | 4768 'json if decodable, or as string otherwise. ' |
4769 'NOTE: using this may make your try job not usable for CQ, ' | 4769 'NOTE: using this may make your try job not usable for CQ, ' |
4770 'which will then schedule another try job with default properties') | 4770 'which will then schedule another try job with default properties') |
4771 # TODO(tandrii): if this even used? | |
qyearsley
2016/10/22 19:14:29
It's used for the "reason" string when triggering
tandrii(chromium)
2016/10/23 15:25:52
not necessary, ignored by CQ (though CQ sets it to
| |
4772 group.add_option( | 4771 group.add_option( |
4773 '-n', '--name', help='Try job name; default to current branch name') | 4772 '--reason', |
4773 help='Try job "reason" string; defaults to current branch name') | |
tandrii(chromium)
2016/10/23 15:25:52
i like this renaming, but please you remove defaul
qyearsley
2016/10/25 17:32:13
Do you mean let's only add it to try job propertie
tandrii(chromium)
2016/10/25 17:56:30
yes, PS#2 is exactly what I asked for :)
| |
4774 group.add_option( | 4774 group.add_option( |
4775 '--buildbucket-host', default='cr-buildbucket.appspot.com', | 4775 '--buildbucket-host', default='cr-buildbucket.appspot.com', |
4776 help='Host of buildbucket. The default host is %default.') | 4776 help='Host of buildbucket. The default host is %default.') |
4777 parser.add_option_group(group) | 4777 parser.add_option_group(group) |
4778 auth.add_auth_options(parser) | 4778 auth.add_auth_options(parser) |
4779 options, args = parser.parse_args(args) | 4779 options, args = parser.parse_args(args) |
4780 auth_config = auth.extract_auth_config_from_options(options) | 4780 auth_config = auth.extract_auth_config_from_options(options) |
4781 | 4781 |
4782 # Make sure that all properties are prop=value pairs. | 4782 # Make sure that all properties are prop=value pairs. |
4783 bad_params = [x for x in options.properties if '=' not in x] | 4783 bad_params = [x for x in options.properties if '=' not in x] |
(...skipping 10 matching lines...) Expand all Loading... | |
4794 if cl.IsGerrit(): | 4794 if cl.IsGerrit(): |
4795 parser.error( | 4795 parser.error( |
4796 'Not yet supported for Gerrit (http://crbug.com/599931).\n' | 4796 'Not yet supported for Gerrit (http://crbug.com/599931).\n' |
4797 'If your project has Commit Queue, dry run is a workaround:\n' | 4797 'If your project has Commit Queue, dry run is a workaround:\n' |
4798 ' git cl set-commit --dry-run') | 4798 ' git cl set-commit --dry-run') |
4799 | 4799 |
4800 error_message = cl.CannotTriggerTryJobReason() | 4800 error_message = cl.CannotTriggerTryJobReason() |
4801 if error_message: | 4801 if error_message: |
4802 parser.error('Can\'t trigger try jobs: %s') | 4802 parser.error('Can\'t trigger try jobs: %s') |
4803 | 4803 |
4804 if not options.name: | 4804 if not options.reason: |
tandrii(chromium)
2016/10/23 15:25:52
that is, let's get rid of these two lines.
| |
4805 options.name = cl.GetBranch() | 4805 options.reason = cl.GetBranch() |
4806 | 4806 |
4807 if options.bucket and options.master: | 4807 if options.bucket and options.master: |
4808 parser.error('Only one of --bucket and --master may be used.') | 4808 parser.error('Only one of --bucket and --master may be used.') |
4809 | 4809 |
4810 if options.bot and not options.master and not options.bucket: | 4810 if options.bot and not options.master and not options.bucket: |
4811 options.master, err_msg = GetBuilderMaster(options.bot) | 4811 options.master, err_msg = GetBuilderMaster(options.bot) |
4812 if err_msg: | 4812 if err_msg: |
4813 parser.error('Tryserver master cannot be found because: %s\n' | 4813 parser.error('Tryserver master cannot be found because: %s\n' |
4814 'Please manually specify the tryserver master' | 4814 'Please manually specify the tryserver master' |
4815 ', e.g. "-m tryserver.chromium.linux".' % err_msg) | 4815 ', e.g. "-m tryserver.chromium.linux".' % err_msg) |
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5414 if __name__ == '__main__': | 5414 if __name__ == '__main__': |
5415 # These affect sys.stdout so do it outside of main() to simplify mocks in | 5415 # These affect sys.stdout so do it outside of main() to simplify mocks in |
5416 # unit testing. | 5416 # unit testing. |
5417 fix_encoding.fix_encoding() | 5417 fix_encoding.fix_encoding() |
5418 setup_color.init() | 5418 setup_color.init() |
5419 try: | 5419 try: |
5420 sys.exit(main(sys.argv[1:])) | 5420 sys.exit(main(sys.argv[1:])) |
5421 except KeyboardInterrupt: | 5421 except KeyboardInterrupt: |
5422 sys.stderr.write('interrupted\n') | 5422 sys.stderr.write('interrupted\n') |
5423 sys.exit(1) | 5423 sys.exit(1) |
OLD | NEW |