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

Side by Side Diff: git_cl.py

Issue 15302014: Add |git cl description| to allow you to change the description in your favorite $EDITOR. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: Created 7 years, 7 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 json 10 import json
(...skipping 1102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1113 else: 1113 else:
1114 color = Fore.BLUE 1114 color = Fore.BLUE
1115 print '\n%s%s %s%s' % ( 1115 print '\n%s%s %s%s' % (
1116 color, message['date'].split('.', 1)[0], message['sender'], 1116 color, message['date'].split('.', 1)[0], message['sender'],
1117 Fore.RESET) 1117 Fore.RESET)
1118 if message['text'].strip(): 1118 if message['text'].strip():
1119 print '\n'.join(' ' + l for l in message['text'].splitlines()) 1119 print '\n'.join(' ' + l for l in message['text'].splitlines())
1120 return 0 1120 return 0
1121 1121
1122 1122
1123 def CMDdescription(parser, args):
1124 """Brings up the editor for the current CL's description."""
M-A Ruel 2013/05/17 18:46:00 The docstrings for commands start with a lower cas
Robert Sesek 2013/05/17 19:02:18 Done.
1125 cl = Changelist()
1126 if not cl.GetIssue():
1127 DieWithError('This branch has no associated changelist.')
1128 description = ChangeDescription(cl.GetDescription())
1129 description.prompt()
1130 cl.UpdateDescription(description.description)
M-A Ruel 2013/05/17 18:46:00 return 0
Robert Sesek 2013/05/17 19:02:18 Done.
1131
1132
1123 def CreateDescriptionFromLog(args): 1133 def CreateDescriptionFromLog(args):
1124 """Pulls out the commit log to use as a base for the CL description.""" 1134 """Pulls out the commit log to use as a base for the CL description."""
1125 log_args = [] 1135 log_args = []
1126 if len(args) == 1 and not args[0].endswith('.'): 1136 if len(args) == 1 and not args[0].endswith('.'):
1127 log_args = [args[0] + '..'] 1137 log_args = [args[0] + '..']
1128 elif len(args) == 1 and args[0].endswith('...'): 1138 elif len(args) == 1 and args[0].endswith('...'):
1129 log_args = [args[0][:-1]] 1139 log_args = [args[0][:-1]]
1130 elif len(args) == 2: 1140 elif len(args) == 2:
1131 log_args = [args[0] + '..' + args[1]] 1141 log_args = [args[0] + '..' + args[1]]
1132 else: 1142 else:
(...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after
2052 GenUsage(parser, 'help') 2062 GenUsage(parser, 'help')
2053 return CMDhelp(parser, argv) 2063 return CMDhelp(parser, argv)
2054 2064
2055 2065
2056 if __name__ == '__main__': 2066 if __name__ == '__main__':
2057 # These affect sys.stdout so do it outside of main() to simplify mocks in 2067 # These affect sys.stdout so do it outside of main() to simplify mocks in
2058 # unit testing. 2068 # unit testing.
2059 fix_encoding.fix_encoding() 2069 fix_encoding.fix_encoding()
2060 colorama.init() 2070 colorama.init()
2061 sys.exit(main(sys.argv[1:])) 2071 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