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 distutils.version import LooseVersion | 10 from distutils.version import LooseVersion |
(...skipping 2510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2521 place. | 2521 place. |
2522 """ | 2522 """ |
2523 log_desc = options.message or CreateDescriptionFromLog(args) | 2523 log_desc = options.message or CreateDescriptionFromLog(args) |
2524 git_command = ['commit', '--amend', '-m', log_desc] | 2524 git_command = ['commit', '--amend', '-m', log_desc] |
2525 RunGit(git_command) | 2525 RunGit(git_command) |
2526 new_log_desc = CreateDescriptionFromLog(args) | 2526 new_log_desc = CreateDescriptionFromLog(args) |
2527 if git_footers.get_footer_change_id(new_log_desc): | 2527 if git_footers.get_footer_change_id(new_log_desc): |
2528 print 'git-cl: Added Change-Id to commit message.' | 2528 print 'git-cl: Added Change-Id to commit message.' |
2529 return new_log_desc | 2529 return new_log_desc |
2530 else: | 2530 else: |
2531 print >> sys.stderr, 'ERROR: Gerrit commit-msg hook not available.' | 2531 DieWithError('ERROR: Gerrit commit-msg hook not installed.') |
2532 | 2532 |
2533 def SetCQState(self, new_state): | 2533 def SetCQState(self, new_state): |
2534 """Sets the Commit-Queue label assuming canonical CQ config for Gerrit.""" | 2534 """Sets the Commit-Queue label assuming canonical CQ config for Gerrit.""" |
2535 # TODO(tandrii): maybe allow configurability in codereview.settings or by | 2535 # TODO(tandrii): maybe allow configurability in codereview.settings or by |
2536 # self-discovery of label config for this CL using REST API. | 2536 # self-discovery of label config for this CL using REST API. |
2537 vote_map = { | 2537 vote_map = { |
2538 _CQState.NONE: 0, | 2538 _CQState.NONE: 0, |
2539 _CQState.DRY_RUN: 1, | 2539 _CQState.DRY_RUN: 1, |
2540 _CQState.COMMIT : 2, | 2540 _CQState.COMMIT : 2, |
2541 } | 2541 } |
(...skipping 2345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4887 if __name__ == '__main__': | 4887 if __name__ == '__main__': |
4888 # These affect sys.stdout so do it outside of main() to simplify mocks in | 4888 # These affect sys.stdout so do it outside of main() to simplify mocks in |
4889 # unit testing. | 4889 # unit testing. |
4890 fix_encoding.fix_encoding() | 4890 fix_encoding.fix_encoding() |
4891 setup_color.init() | 4891 setup_color.init() |
4892 try: | 4892 try: |
4893 sys.exit(main(sys.argv[1:])) | 4893 sys.exit(main(sys.argv[1:])) |
4894 except KeyboardInterrupt: | 4894 except KeyboardInterrupt: |
4895 sys.stderr.write('interrupted\n') | 4895 sys.stderr.write('interrupted\n') |
4896 sys.exit(1) | 4896 sys.exit(1) |
OLD | NEW |