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 4713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4724 auth.add_auth_options(parser) | 4724 auth.add_auth_options(parser) |
4725 _add_codereview_select_options(parser) | 4725 _add_codereview_select_options(parser) |
4726 options, args = parser.parse_args(args) | 4726 options, args = parser.parse_args(args) |
4727 _process_codereview_select_options(parser, options) | 4727 _process_codereview_select_options(parser, options) |
4728 auth_config = auth.extract_auth_config_from_options(options) | 4728 auth_config = auth.extract_auth_config_from_options(options) |
4729 if args: | 4729 if args: |
4730 parser.error('Unrecognized args: %s' % ' '.join(args)) | 4730 parser.error('Unrecognized args: %s' % ' '.join(args)) |
4731 if options.dry_run and options.clear: | 4731 if options.dry_run and options.clear: |
4732 parser.error('Make up your mind: both --dry-run and --clear not allowed') | 4732 parser.error('Make up your mind: both --dry-run and --clear not allowed') |
4733 | 4733 |
4734 cl = Changelist(auth_config=auth_config) | 4734 cl = Changelist(auth_config=auth_config, codereview=options.forced_codereview) |
4735 if options.clear: | 4735 if options.clear: |
4736 state = _CQState.NONE | 4736 state = _CQState.NONE |
4737 elif options.dry_run: | 4737 elif options.dry_run: |
4738 state = _CQState.DRY_RUN | 4738 state = _CQState.DRY_RUN |
4739 else: | 4739 else: |
4740 state = _CQState.COMMIT | 4740 state = _CQState.COMMIT |
4741 if not cl.GetIssue(): | 4741 if not cl.GetIssue(): |
4742 parser.error('Must upload the issue first') | 4742 parser.error('Must upload the issue first') |
4743 cl.SetCQState(state) | 4743 cl.SetCQState(state) |
4744 return 0 | 4744 return 0 |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5103 if __name__ == '__main__': | 5103 if __name__ == '__main__': |
5104 # These affect sys.stdout so do it outside of main() to simplify mocks in | 5104 # These affect sys.stdout so do it outside of main() to simplify mocks in |
5105 # unit testing. | 5105 # unit testing. |
5106 fix_encoding.fix_encoding() | 5106 fix_encoding.fix_encoding() |
5107 setup_color.init() | 5107 setup_color.init() |
5108 try: | 5108 try: |
5109 sys.exit(main(sys.argv[1:])) | 5109 sys.exit(main(sys.argv[1:])) |
5110 except KeyboardInterrupt: | 5110 except KeyboardInterrupt: |
5111 sys.stderr.write('interrupted\n') | 5111 sys.stderr.write('interrupted\n') |
5112 sys.exit(1) | 5112 sys.exit(1) |
OLD | NEW |