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 2578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2589 RunGit(git_command) | 2589 RunGit(git_command) |
2590 new_log_desc = CreateDescriptionFromLog(args) | 2590 new_log_desc = CreateDescriptionFromLog(args) |
2591 if git_footers.get_footer_change_id(new_log_desc): | 2591 if git_footers.get_footer_change_id(new_log_desc): |
2592 print('git-cl: Added Change-Id to commit message.') | 2592 print('git-cl: Added Change-Id to commit message.') |
2593 return new_log_desc | 2593 return new_log_desc |
2594 else: | 2594 else: |
2595 DieWithError('ERROR: Gerrit commit-msg hook not installed.') | 2595 DieWithError('ERROR: Gerrit commit-msg hook not installed.') |
2596 | 2596 |
2597 def SetCQState(self, new_state): | 2597 def SetCQState(self, new_state): |
2598 """Sets the Commit-Queue label assuming canonical CQ config for Gerrit.""" | 2598 """Sets the Commit-Queue label assuming canonical CQ config for Gerrit.""" |
2599 # TODO(tandrii): maybe allow configurability in codereview.settings or by | |
2600 # self-discovery of label config for this CL using REST API. | |
2601 vote_map = { | 2599 vote_map = { |
2602 _CQState.NONE: 0, | 2600 _CQState.NONE: 0, |
2603 _CQState.DRY_RUN: 1, | 2601 _CQState.DRY_RUN: 1, |
2604 _CQState.COMMIT : 2, | 2602 _CQState.COMMIT : 2, |
2605 } | 2603 } |
2606 gerrit_util.SetReview(self._GetGerritHost(), self.GetIssue(), | 2604 gerrit_util.SetReview(self._GetGerritHost(), self.GetIssue(), |
2607 labels={'Commit-Queue': vote_map[new_state]}) | 2605 labels={'Commit-Queue': vote_map[new_state]}) |
2608 | 2606 |
2609 | 2607 |
2610 _CODEREVIEW_IMPLEMENTATIONS = { | 2608 _CODEREVIEW_IMPLEMENTATIONS = { |
(...skipping 2495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5106 if __name__ == '__main__': | 5104 if __name__ == '__main__': |
5107 # These affect sys.stdout so do it outside of main() to simplify mocks in | 5105 # These affect sys.stdout so do it outside of main() to simplify mocks in |
5108 # unit testing. | 5106 # unit testing. |
5109 fix_encoding.fix_encoding() | 5107 fix_encoding.fix_encoding() |
5110 setup_color.init() | 5108 setup_color.init() |
5111 try: | 5109 try: |
5112 sys.exit(main(sys.argv[1:])) | 5110 sys.exit(main(sys.argv[1:])) |
5113 except KeyboardInterrupt: | 5111 except KeyboardInterrupt: |
5114 sys.stderr.write('interrupted\n') | 5112 sys.stderr.write('interrupted\n') |
5115 sys.exit(1) | 5113 sys.exit(1) |
OLD | NEW |