Chromium Code Reviews| Index: git_cl.py |
| diff --git a/git_cl.py b/git_cl.py |
| index 0acb9cd59ba2f67a73dc357a21e5ef0d2f851b14..ab47c49f3e42bd3c4d87be0772bad34936bd2451 100755 |
| --- a/git_cl.py |
| +++ b/git_cl.py |
| @@ -3269,6 +3269,8 @@ def CMDdescription(parser, args): |
| """Brings up the editor for the current CL's description.""" |
| parser.add_option('-d', '--display', action='store_true', |
| help='Display the description instead of opening an editor') |
| + parser.add_option('-n', '--new-description', |
| + help='New description to set for this issue (- for stdin)') |
| _add_codereview_select_options(parser) |
| auth.add_auth_options(parser) |
| @@ -3292,10 +3294,22 @@ def CMDdescription(parser, args): |
| if not cl.GetIssue(): |
| DieWithError('This branch has no associated changelist.') |
| description = ChangeDescription(cl.GetDescription()) |
| + |
| if options.display: |
| print description.description |
| return 0 |
| - description.prompt() |
| + |
| + if options.new_description: |
| + text = options.new_description |
| + if text == '-': |
| + text = '' |
| + for line in sys.stdin: |
| + text += line + '\n' |
|
tandrii(chromium)
2016/04/28 05:13:56
one liner instead of three is faster:
text = '\n'
martiniss
2016/04/28 20:51:38
Fixed. I had to make another mock in the tests, so
|
| + |
| + description.set_description(text) |
| + else: |
| + description.prompt() |
| + |
| if cl.GetDescription() != description.description: |
| cl.UpdateDescription(description.description) |
| return 0 |