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 4724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4735 auth.add_auth_options(parser) | 4735 auth.add_auth_options(parser) |
4736 options, args = parser.parse_args(args) | 4736 options, args = parser.parse_args(args) |
4737 auth_config = auth.extract_auth_config_from_options(options) | 4737 auth_config = auth.extract_auth_config_from_options(options) |
4738 if args: | 4738 if args: |
4739 parser.error('Unrecognized args: %s' % ' '.join(args)) | 4739 parser.error('Unrecognized args: %s' % ' '.join(args)) |
4740 if options.dry_run and options.clear: | 4740 if options.dry_run and options.clear: |
4741 parser.error('Make up your mind: both --dry-run and --clear not allowed') | 4741 parser.error('Make up your mind: both --dry-run and --clear not allowed') |
4742 | 4742 |
4743 cl = Changelist(auth_config=auth_config) | 4743 cl = Changelist(auth_config=auth_config) |
4744 if options.clear: | 4744 if options.clear: |
4745 state = _CQState.CLEAR | 4745 state = _CQState.NONE |
4746 elif options.dry_run: | 4746 elif options.dry_run: |
4747 state = _CQState.DRY_RUN | 4747 state = _CQState.DRY_RUN |
4748 else: | 4748 else: |
4749 state = _CQState.COMMIT | 4749 state = _CQState.COMMIT |
4750 if not cl.GetIssue(): | 4750 if not cl.GetIssue(): |
4751 parser.error('Must upload the issue first') | 4751 parser.error('Must upload the issue first') |
4752 cl._codereview_impl.SetCQState(state) | 4752 cl._codereview_impl.SetCQState(state) |
4753 return 0 | 4753 return 0 |
4754 | 4754 |
4755 | 4755 |
(...skipping 347 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 |