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

Side by Side Diff: git_cl.py

Issue 2307463002: git_cl: Enable updating description from local. (Closed)
Patch Set: git_cl: Enable updating description from local. Created 4 years, 3 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
« 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 and Gerrit.""" 8 """A git-command for integrating reviews on Rietveld and Gerrit."""
9 9
10 from __future__ import print_function 10 from __future__ import print_function
(...skipping 3562 matching lines...) Expand 10 before | Expand all | Expand 10 after
3573 json.dump(summary, f) 3573 json.dump(summary, f)
3574 return 0 3574 return 0
3575 3575
3576 3576
3577 @subcommand.usage('[codereview url or issue id]') 3577 @subcommand.usage('[codereview url or issue id]')
3578 def CMDdescription(parser, args): 3578 def CMDdescription(parser, args):
3579 """Brings up the editor for the current CL's description.""" 3579 """Brings up the editor for the current CL's description."""
3580 parser.add_option('-d', '--display', action='store_true', 3580 parser.add_option('-d', '--display', action='store_true',
3581 help='Display the description instead of opening an editor') 3581 help='Display the description instead of opening an editor')
3582 parser.add_option('-n', '--new-description', 3582 parser.add_option('-n', '--new-description',
3583 help='New description to set for this issue (- for stdin)') 3583 help='New description to set for this issue (- for stdin, '
3584 '+ to load from local commit HEAD)')
3584 3585
3585 _add_codereview_select_options(parser) 3586 _add_codereview_select_options(parser)
3586 auth.add_auth_options(parser) 3587 auth.add_auth_options(parser)
3587 options, args = parser.parse_args(args) 3588 options, args = parser.parse_args(args)
3588 _process_codereview_select_options(parser, options) 3589 _process_codereview_select_options(parser, options)
3589 3590
3590 target_issue = None 3591 target_issue = None
3591 if len(args) > 0: 3592 if len(args) > 0:
3592 target_issue = ParseIssueNumberArgument(args[0]) 3593 target_issue = ParseIssueNumberArgument(args[0])
3593 if not target_issue.valid: 3594 if not target_issue.valid:
(...skipping 18 matching lines...) Expand all
3612 description = ChangeDescription(cl.GetDescription()) 3613 description = ChangeDescription(cl.GetDescription())
3613 3614
3614 if options.display: 3615 if options.display:
3615 print(description.description) 3616 print(description.description)
3616 return 0 3617 return 0
3617 3618
3618 if options.new_description: 3619 if options.new_description:
3619 text = options.new_description 3620 text = options.new_description
3620 if text == '-': 3621 if text == '-':
3621 text = '\n'.join(l.rstrip() for l in sys.stdin) 3622 text = '\n'.join(l.rstrip() for l in sys.stdin)
3623 elif text == '+':
3624 base_branch = cl.GetCommonAncestorWithUpstream()
3625 merge_base = RunGit(['merge-base', base_branch, 'HEAD']).strip()
3626 text = CreateDescriptionFromLog([merge_base])
agable 2016/09/02 16:43:00 This produces a commit message which is not of the
dnj 2016/09/02 17:31:40 I don't think this is correct. When I run the comm
agable 2016/09/02 17:43:39 Ah. We develop differently. I often have 2-10 comm
dnj 2016/09/02 18:05:55 I revised this to do the same thing "git cl upload
3622 3627
3623 description.set_description(text) 3628 description.set_description(text)
3624 else: 3629 else:
3625 description.prompt() 3630 description.prompt()
3626 3631
3627 if cl.GetDescription() != description.description: 3632 if cl.GetDescription() != description.description:
3628 cl.UpdateDescription(description.description) 3633 cl.UpdateDescription(description.description)
3629 return 0 3634 return 0
3630 3635
3631 3636
(...skipping 1593 matching lines...) Expand 10 before | Expand all | Expand 10 after
5225 if __name__ == '__main__': 5230 if __name__ == '__main__':
5226 # These affect sys.stdout so do it outside of main() to simplify mocks in 5231 # These affect sys.stdout so do it outside of main() to simplify mocks in
5227 # unit testing. 5232 # unit testing.
5228 fix_encoding.fix_encoding() 5233 fix_encoding.fix_encoding()
5229 setup_color.init() 5234 setup_color.init()
5230 try: 5235 try:
5231 sys.exit(main(sys.argv[1:])) 5236 sys.exit(main(sys.argv[1:]))
5232 except KeyboardInterrupt: 5237 except KeyboardInterrupt:
5233 sys.stderr.write('interrupted\n') 5238 sys.stderr.write('interrupted\n')
5234 sys.exit(1) 5239 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