| 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 import difflib | 10 import difflib |
| (...skipping 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1047 show_branches = not options.field | 1047 show_branches = not options.field |
| 1048 | 1048 |
| 1049 if show_branches: | 1049 if show_branches: |
| 1050 branches = RunGit(['for-each-ref', '--format=%(refname)', 'refs/heads']) | 1050 branches = RunGit(['for-each-ref', '--format=%(refname)', 'refs/heads']) |
| 1051 if branches: | 1051 if branches: |
| 1052 changes = (Changelist(branchref=b) for b in branches.splitlines()) | 1052 changes = (Changelist(branchref=b) for b in branches.splitlines()) |
| 1053 branches = dict((cl.GetBranch(), cl.GetIssueURL()) for cl in changes) | 1053 branches = dict((cl.GetBranch(), cl.GetIssueURL()) for cl in changes) |
| 1054 alignment = max(5, max(len(b) for b in branches)) | 1054 alignment = max(5, max(len(b) for b in branches)) |
| 1055 print 'Branches associated with reviews:' | 1055 print 'Branches associated with reviews:' |
| 1056 for branch in sorted(branches): | 1056 for branch in sorted(branches): |
| 1057 print " %*s: %s" % (alignment, branch, branches[branch] or '') | 1057 print " %*s: %s" % (alignment, branch, branches[branch]) |
| 1058 | 1058 |
| 1059 cl = Changelist() | 1059 cl = Changelist() |
| 1060 if options.field: | 1060 if options.field: |
| 1061 if options.field.startswith('desc'): | 1061 if options.field.startswith('desc'): |
| 1062 print cl.GetDescription() | 1062 print cl.GetDescription() |
| 1063 elif options.field == 'id': | 1063 elif options.field == 'id': |
| 1064 issueid = cl.GetIssue() | 1064 issueid = cl.GetIssue() |
| 1065 if issueid: | 1065 if issueid: |
| 1066 print issueid | 1066 print issueid |
| 1067 elif options.field == 'patch': | 1067 elif options.field == 'patch': |
| (...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2142 GenUsage(parser, 'help') | 2142 GenUsage(parser, 'help') |
| 2143 return CMDhelp(parser, argv) | 2143 return CMDhelp(parser, argv) |
| 2144 | 2144 |
| 2145 | 2145 |
| 2146 if __name__ == '__main__': | 2146 if __name__ == '__main__': |
| 2147 # These affect sys.stdout so do it outside of main() to simplify mocks in | 2147 # These affect sys.stdout so do it outside of main() to simplify mocks in |
| 2148 # unit testing. | 2148 # unit testing. |
| 2149 fix_encoding.fix_encoding() | 2149 fix_encoding.fix_encoding() |
| 2150 colorama.init() | 2150 colorama.init() |
| 2151 sys.exit(main(sys.argv[1:])) | 2151 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |