Generate patchset name from commit subject
BUG=672332
Change-Id: If9c662f11b217a52cac7c9c47ad9f3d978148c2e
Reviewed-on: https://chromium-review.googlesource.com/419330
Commit-Queue: Aaron Gable <agable@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
diff --git a/git_cl.py b/git_cl.py
index 46af2bc..be339c0 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -2934,16 +2934,20 @@
print('Adding self-LGTM (Code-Review +1) because of TBRs')
refspec_opts.append('l=Code-Review+1')
- if options.title:
- if not re.match(r'^[\w ]+$', options.title):
- options.title = re.sub(r'[^\w ]', '', options.title)
+ title = options.title
+ if not title:
+ default = RunGit(['show', '-s', '--format=%s', 'HEAD']).strip()
+ title = ask_for_data('Title for patchset [%s]: ' % default) or default
+ if title:
+ if not re.match(r'^[\w ]+$', title):
+ title = re.sub(r'[^\w ]', '', title)
print('WARNING: Patchset title may only contain alphanumeric chars '
- 'and spaces. Cleaned up title:\n%s' % options.title)
+ 'and spaces. Cleaned up title:\n%s' % title)
if not options.force:
ask_for_data('Press enter to continue, Ctrl+C to abort')
# Per doc, spaces must be converted to underscores, and Gerrit will do the
# reverse on its side.
- refspec_opts.append('m=' + options.title.replace(' ', '_'))
+ refspec_opts.append('m=' + title.replace(' ', '_'))
if options.send_mail:
if not change_desc.get_reviewers():