Adding --skip-title option to git cl upload

Adding an optional --skip-title argument to git cl upload to
automatically use the latest commit message as the patch title, without
requiring the user to hit "enter" to accept.

Change-Id: I0e37b68c809d907a4f980f2be59865e14b1a2db2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2297803
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Mario Bianucci <mabian@microsoft.com>
changes/03/2297803/5
Mario Bianucci 5 years ago committed by LUCI CQ
parent dc3f2b55c3
commit cebfb4e614

@ -1373,7 +1373,7 @@ class Changelist(object):
# Use the subject of the last commit as title by default.
title = RunGit(['show', '-s', '--format=%s', 'HEAD']).strip()
if options.force:
if options.force or options.skip_title:
return title
user_title = gclient_utils.AskForData('Title for patchset [%s]: ' % title)
return user_title or title
@ -3989,6 +3989,10 @@ def CMDupload(parser, args):
help='file which contains message for patchset')
parser.add_option('--title', '-t', dest='title',
help='title for patchset')
parser.add_option('-T', '--skip-title', action='store_true',
dest='skip_title',
help='Use the most recent commit message as the title of '
'the patchset')
parser.add_option('-r', '--reviewers',
action='append', default=[],
help='reviewer email addresses')
@ -4096,6 +4100,9 @@ def CMDupload(parser, args):
parser.error('Only one of --use-commit-queue, --cq-dry-run, or '
'--retry-failed is allowed.')
if options.skip_title and options.title:
parser.error('Only one of --title and --skip-title allowed.')
if options.use_commit_queue:
options.send_mail = True

Loading…
Cancel
Save