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

Side by Side Diff: git_cl.py

Issue 1237483003: Add --display option to git cl description (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 5 years, 5 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 from distutils.version import LooseVersion 10 from distutils.version import LooseVersion
(...skipping 1798 matching lines...) Expand 10 before | Expand all | Expand 10 after
1809 print '\n%s%s %s%s' % ( 1809 print '\n%s%s %s%s' % (
1810 color, message['date'].split('.', 1)[0], message['sender'], 1810 color, message['date'].split('.', 1)[0], message['sender'],
1811 Fore.RESET) 1811 Fore.RESET)
1812 if message['text'].strip(): 1812 if message['text'].strip():
1813 print '\n'.join(' ' + l for l in message['text'].splitlines()) 1813 print '\n'.join(' ' + l for l in message['text'].splitlines())
1814 return 0 1814 return 0
1815 1815
1816 1816
1817 def CMDdescription(parser, args): 1817 def CMDdescription(parser, args):
1818 """Brings up the editor for the current CL's description.""" 1818 """Brings up the editor for the current CL's description."""
1819 parser.add_option('-d', '--display', action='store_true',
1820 help='Display the description instead of opening an editor')
1819 auth.add_auth_options(parser) 1821 auth.add_auth_options(parser)
1820 options, _ = parser.parse_args(args) 1822 options, _ = parser.parse_args(args)
1821 auth_config = auth.extract_auth_config_from_options(options) 1823 auth_config = auth.extract_auth_config_from_options(options)
1822 cl = Changelist(auth_config=auth_config) 1824 cl = Changelist(auth_config=auth_config)
1823 if not cl.GetIssue(): 1825 if not cl.GetIssue():
1824 DieWithError('This branch has no associated changelist.') 1826 DieWithError('This branch has no associated changelist.')
1825 description = ChangeDescription(cl.GetDescription()) 1827 description = ChangeDescription(cl.GetDescription())
1828 if options.display:
1829 print description.description
1830 return 0
1826 description.prompt() 1831 description.prompt()
1827 if cl.GetDescription() != description.description: 1832 if cl.GetDescription() != description.description:
1828 cl.UpdateDescription(description.description) 1833 cl.UpdateDescription(description.description)
1829 return 0 1834 return 0
1830 1835
1831 1836
1832 def CreateDescriptionFromLog(args): 1837 def CreateDescriptionFromLog(args):
1833 """Pulls out the commit log to use as a base for the CL description.""" 1838 """Pulls out the commit log to use as a base for the CL description."""
1834 log_args = [] 1839 log_args = []
1835 if len(args) == 1 and not args[0].endswith('.'): 1840 if len(args) == 1 and not args[0].endswith('.'):
(...skipping 1717 matching lines...) Expand 10 before | Expand all | Expand 10 after
3553 if __name__ == '__main__': 3558 if __name__ == '__main__':
3554 # These affect sys.stdout so do it outside of main() to simplify mocks in 3559 # These affect sys.stdout so do it outside of main() to simplify mocks in
3555 # unit testing. 3560 # unit testing.
3556 fix_encoding.fix_encoding() 3561 fix_encoding.fix_encoding()
3557 colorama.init() 3562 colorama.init()
3558 try: 3563 try:
3559 sys.exit(main(sys.argv[1:])) 3564 sys.exit(main(sys.argv[1:]))
3560 except KeyboardInterrupt: 3565 except KeyboardInterrupt:
3561 sys.stderr.write('interrupted\n') 3566 sys.stderr.write('interrupted\n')
3562 sys.exit(1) 3567 sys.exit(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