Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(211)

Side by Side Diff: git_cl.py

Issue 9959073: Allow longer branch names to be center justified with git cl status. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 logging 10 import logging
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 help='print only specific field (desc|id|patch|url)') 793 help='print only specific field (desc|id|patch|url)')
794 (options, args) = parser.parse_args(args) 794 (options, args) = parser.parse_args(args)
795 795
796 # TODO: maybe make show_branches a flag if necessary. 796 # TODO: maybe make show_branches a flag if necessary.
797 show_branches = not options.field 797 show_branches = not options.field
798 798
799 if show_branches: 799 if show_branches:
800 branches = RunGit(['for-each-ref', '--format=%(refname)', 'refs/heads']) 800 branches = RunGit(['for-each-ref', '--format=%(refname)', 'refs/heads'])
801 if branches: 801 if branches:
802 print 'Branches associated with reviews:' 802 print 'Branches associated with reviews:'
803 for branch in sorted(branches.splitlines()): 803 changes = (Changelist(branchref=b) for b in branches.splitlines())
804 cl = Changelist(branchref=branch) 804 branches = dict((cl.GetBranch(), cl.GetIssue()) for cl in changes)
805 print " %10s: %s" % (cl.GetBranch(), cl.GetIssue()) 805 alignment = max(5, max(len(b) for b in branches))
806 for branch in sorted(branches):
807 print " %*s: %s" % (alignment, branch, branches[branch])
806 808
807 cl = Changelist() 809 cl = Changelist()
808 if options.field: 810 if options.field:
809 if options.field.startswith('desc'): 811 if options.field.startswith('desc'):
810 print cl.GetDescription() 812 print cl.GetDescription()
811 elif options.field == 'id': 813 elif options.field == 'id':
812 issueid = cl.GetIssue() 814 issueid = cl.GetIssue()
813 if issueid: 815 if issueid:
814 print issueid 816 print issueid
815 elif options.field == 'patch': 817 elif options.field == 'patch':
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
1519 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) 1521 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)))
1520 1522
1521 # Not a known command. Default to help. 1523 # Not a known command. Default to help.
1522 GenUsage(parser, 'help') 1524 GenUsage(parser, 'help')
1523 return CMDhelp(parser, argv) 1525 return CMDhelp(parser, argv)
1524 1526
1525 1527
1526 if __name__ == '__main__': 1528 if __name__ == '__main__':
1527 fix_encoding.fix_encoding() 1529 fix_encoding.fix_encoding()
1528 sys.exit(main(sys.argv[1:])) 1530 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698