| 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 2120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2131 * 'closed' - abandoned | 2131 * 'closed' - abandoned |
| 2132 """ | 2132 """ |
| 2133 if not self.GetIssue(): | 2133 if not self.GetIssue(): |
| 2134 return None | 2134 return None |
| 2135 | 2135 |
| 2136 try: | 2136 try: |
| 2137 data = self._GetChangeDetail(['DETAILED_LABELS', 'CURRENT_REVISION']) | 2137 data = self._GetChangeDetail(['DETAILED_LABELS', 'CURRENT_REVISION']) |
| 2138 except httplib.HTTPException: | 2138 except httplib.HTTPException: |
| 2139 return 'error' | 2139 return 'error' |
| 2140 | 2140 |
| 2141 if data['status'] == 'ABANDONED': | 2141 if data['status'] in ('ABANDONED', 'MERGED'): |
| 2142 return 'closed' | 2142 return 'closed' |
| 2143 | 2143 |
| 2144 cq_label = data['labels'].get('Commit-Queue', {}) | 2144 cq_label = data['labels'].get('Commit-Queue', {}) |
| 2145 if cq_label: | 2145 if cq_label: |
| 2146 # Vote value is a stringified integer, which we expect from 0 to 2. | 2146 # Vote value is a stringified integer, which we expect from 0 to 2. |
| 2147 vote_value = cq_label.get('value', '0') | 2147 vote_value = cq_label.get('value', '0') |
| 2148 vote_text = cq_label.get('values', {}).get(vote_value, '') | 2148 vote_text = cq_label.get('values', {}).get(vote_value, '') |
| 2149 if vote_text.lower() == 'commit': | 2149 if vote_text.lower() == 'commit': |
| 2150 return 'commit' | 2150 return 'commit' |
| 2151 | 2151 |
| (...skipping 2749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4901 if __name__ == '__main__': | 4901 if __name__ == '__main__': |
| 4902 # These affect sys.stdout so do it outside of main() to simplify mocks in | 4902 # These affect sys.stdout so do it outside of main() to simplify mocks in |
| 4903 # unit testing. | 4903 # unit testing. |
| 4904 fix_encoding.fix_encoding() | 4904 fix_encoding.fix_encoding() |
| 4905 setup_color.init() | 4905 setup_color.init() |
| 4906 try: | 4906 try: |
| 4907 sys.exit(main(sys.argv[1:])) | 4907 sys.exit(main(sys.argv[1:])) |
| 4908 except KeyboardInterrupt: | 4908 except KeyboardInterrupt: |
| 4909 sys.stderr.write('interrupted\n') | 4909 sys.stderr.write('interrupted\n') |
| 4910 sys.exit(1) | 4910 sys.exit(1) |
| OLD | NEW |