Commit 566e9d01 authored by manukh's avatar manukh Committed by LUCI CQ

[git-cl] If set, use `options.title` for initial uploads.

Change-Id: Ia57b7a7b769d352e05820af0e40a52fcab471ddb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3736424Reviewed-by: 's avatarGavin Mak <gavinmak@google.com>
Commit-Queue: manuk hovanesian <manukh@chromium.org>
parent 4e6264cc
......@@ -1504,8 +1504,9 @@ class Changelist(object):
return change_description
def _GetTitleForUpload(self, options):
# When not squashing, just return options.title.
if not options.squash:
# When not squashing or options.title is provided, just return
# options.title.
if not options.squash or options.title:
return options.title
# On first upload, patchset title is always this string, while options.title
......@@ -1515,8 +1516,6 @@ class Changelist(object):
# When uploading subsequent patchsets, options.message is taken as the title
# if options.title is not provided.
if options.title:
return options.title
if options.message:
return options.message.strip()
......
......@@ -878,11 +878,11 @@ class TestGitCl(unittest.TestCase):
metrics_arguments.append('notify=NONE')
# If issue is given, then description is fetched from Gerrit instead.
if issue is None:
if squash:
title = 'Initial upload'
else:
if not title:
if not title:
if issue is None:
if squash:
title = 'Initial upload'
else:
calls += [
((['git', 'show', '-s', '--format=%s', 'HEAD'],), ''),
(('ask_for_data', 'Title for patchset []: '), 'User input'),
......@@ -1378,6 +1378,7 @@ class TestGitCl(unittest.TestCase):
['-f', '-t', 'title'],
'title\n\ndesc\n\nChange-Id: 123456789',
[],
title='title',
force=True,
squash=True,
log_description='desc',
......
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