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.""" | 8 """A git-command for integrating reviews on Rietveld.""" |
9 | 9 |
10 from distutils.version import LooseVersion | 10 from distutils.version import LooseVersion |
(...skipping 1210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1221 alignment = max(5, max(len(ShortBranchName(b)) for b in branches)) | 1221 alignment = max(5, max(len(ShortBranchName(b)) for b in branches)) |
1222 for branch in sorted(branches): | 1222 for branch in sorted(branches): |
1223 while branch not in tmp: | 1223 while branch not in tmp: |
1224 b, i, color = output.get() | 1224 b, i, color = output.get() |
1225 tmp[b] = (i, color) | 1225 tmp[b] = (i, color) |
1226 issue, color = tmp.pop(branch) | 1226 issue, color = tmp.pop(branch) |
1227 reset = Fore.RESET | 1227 reset = Fore.RESET |
1228 if not sys.stdout.isatty(): | 1228 if not sys.stdout.isatty(): |
1229 color = '' | 1229 color = '' |
1230 reset = '' | 1230 reset = '' |
1231 print ' %*s: %s%s%s' % ( | 1231 print ' %*s : %s%s%s' % ( |
1232 alignment, ShortBranchName(branch), color, issue, reset) | 1232 alignment, ShortBranchName(branch), color, issue, reset) |
1233 | 1233 |
1234 cl = Changelist() | 1234 cl = Changelist() |
1235 print | 1235 print |
1236 print 'Current branch:', | 1236 print 'Current branch:', |
1237 if not cl.GetIssue(): | 1237 if not cl.GetIssue(): |
1238 print 'no issue assigned.' | 1238 print 'no issue assigned.' |
1239 return 0 | 1239 return 0 |
1240 print cl.GetBranch() | 1240 print cl.GetBranch() |
1241 print 'Issue number: %s (%s)' % (cl.GetIssue(), cl.GetIssueURL()) | 1241 print 'Issue number: %s (%s)' % (cl.GetIssue(), cl.GetIssueURL()) |
(...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2368 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' | 2368 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' |
2369 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) | 2369 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) |
2370 | 2370 |
2371 | 2371 |
2372 if __name__ == '__main__': | 2372 if __name__ == '__main__': |
2373 # These affect sys.stdout so do it outside of main() to simplify mocks in | 2373 # These affect sys.stdout so do it outside of main() to simplify mocks in |
2374 # unit testing. | 2374 # unit testing. |
2375 fix_encoding.fix_encoding() | 2375 fix_encoding.fix_encoding() |
2376 colorama.init() | 2376 colorama.init() |
2377 sys.exit(main(sys.argv[1:])) | 2377 sys.exit(main(sys.argv[1:])) |
OLD | NEW |