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 json | 10 import json |
(...skipping 1102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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.""" |
| 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) |
| 1131 return 0 |
| 1132 |
| 1133 |
1123 def CreateDescriptionFromLog(args): | 1134 def CreateDescriptionFromLog(args): |
1124 """Pulls out the commit log to use as a base for the CL description.""" | 1135 """Pulls out the commit log to use as a base for the CL description.""" |
1125 log_args = [] | 1136 log_args = [] |
1126 if len(args) == 1 and not args[0].endswith('.'): | 1137 if len(args) == 1 and not args[0].endswith('.'): |
1127 log_args = [args[0] + '..'] | 1138 log_args = [args[0] + '..'] |
1128 elif len(args) == 1 and args[0].endswith('...'): | 1139 elif len(args) == 1 and args[0].endswith('...'): |
1129 log_args = [args[0][:-1]] | 1140 log_args = [args[0][:-1]] |
1130 elif len(args) == 2: | 1141 elif len(args) == 2: |
1131 log_args = [args[0] + '..' + args[1]] | 1142 log_args = [args[0] + '..' + args[1]] |
1132 else: | 1143 else: |
(...skipping 947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2080 GenUsage(parser, 'help') | 2091 GenUsage(parser, 'help') |
2081 return CMDhelp(parser, argv) | 2092 return CMDhelp(parser, argv) |
2082 | 2093 |
2083 | 2094 |
2084 if __name__ == '__main__': | 2095 if __name__ == '__main__': |
2085 # These affect sys.stdout so do it outside of main() to simplify mocks in | 2096 # These affect sys.stdout so do it outside of main() to simplify mocks in |
2086 # unit testing. | 2097 # unit testing. |
2087 fix_encoding.fix_encoding() | 2098 fix_encoding.fix_encoding() |
2088 colorama.init() | 2099 colorama.init() |
2089 sys.exit(main(sys.argv[1:])) | 2100 sys.exit(main(sys.argv[1:])) |
OLD | NEW |