Commit 2d8a2074 authored by Andrii Shyshkalov's avatar Andrii Shyshkalov Committed by Commit Bot

Gerrit git cl upload: if -m is given, don't prompt for patchset title.

R=sergiyb@chromium.org
BUG=697625

Change-Id: I493bcc9212baf9030270cb71cf75ac969a67f2a0
Reviewed-on: https://chromium-review.googlesource.com/472724
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: 's avatarSergiy Byelozyorov <sergiyb@chromium.org>
parent 4956f798
......@@ -2827,7 +2827,14 @@ class _GerritChangelistImpl(_ChangelistCodereviewBase):
'failed to fetch description from current Gerrit change %d\n'
'%s' % (self.GetIssue(), self.GetIssueURL()))
if not title:
default_title = RunGit(['show', '-s', '--format=%s', 'HEAD']).strip()
if options.message:
# For compatibility with Rietveld, if -m|--message is given on
# command line, title should be the first line of that message,
# which shouldn't be confused with CL description.
default_title = options.message.strip().split()[0]
else:
default_title = RunGit(
['show', '-s', '--format=%s', 'HEAD']).strip()
if options.force:
title = default_title
else:
......@@ -2940,6 +2947,10 @@ class _GerritChangelistImpl(_ChangelistCodereviewBase):
print('Adding self-LGTM (Code-Review +1) because of TBRs')
refspec_opts.append('l=Code-Review+1')
# TODO(tandrii): options.message should be posted as a comment
# if --send-email is set on non-initial upload as Rietveld used to do it.
if title:
if not re.match(r'^[\w ]+$', title):
title = re.sub(r'[^\w ]', '', title)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment