Generate patchset name from commit subject
This is a reland of 947f2ee80883852e73fbe6fb2b624f354cebd800,
which was reverted in a5a1eea537ca2d82a0296dd703e038af7eee2fde
BUG=672332
Change-Id: If33c54e500fbeac11f60d81a19549880506c63d8
Reviewed-on: https://chromium-review.googlesource.com/419737
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
diff --git a/tests/git_cl_test.py b/tests/git_cl_test.py
index 68186da..198afb1 100755
--- a/tests/git_cl_test.py
+++ b/tests/git_cl_test.py
@@ -1364,7 +1364,7 @@
def _gerrit_upload_calls(cls, description, reviewers, squash,
squash_mode='default',
expected_upstream_ref='origin/refs/heads/master',
- ref_suffix='', notify=False,
+ ref_suffix='', title=None, notify=False,
post_amend_description=None, issue=None, cc=None):
if post_amend_description is None:
post_amend_description = description
@@ -1435,6 +1435,22 @@
expected_upstream_ref + '..' + ref_to_push],), ''),
]
+
+ if not title:
+ if issue:
+ calls += [
+ ((['git', 'show', '-s', '--format=%s', 'HEAD'],), ''),
+ (('Title for patchset []: ',), 'User input'),
+ ]
+ title = 'User_input'
+ else:
+ title = 'Initial_upload'
+ if title:
+ if ref_suffix:
+ ref_suffix += ',m=' + title
+ else:
+ ref_suffix = '%m=' + title
+
notify_suffix = 'notify=%s' % ('ALL' if notify else 'NONE')
if ref_suffix:
ref_suffix += ',' + notify_suffix
@@ -1488,6 +1504,7 @@
squash_mode=None,
expected_upstream_ref='origin/refs/heads/master',
ref_suffix='',
+ title=None,
notify=False,
post_amend_description=None,
issue=None,
@@ -1520,7 +1537,7 @@
description, reviewers, squash,
squash_mode=squash_mode,
expected_upstream_ref=expected_upstream_ref,
- ref_suffix=ref_suffix, notify=notify,
+ ref_suffix=ref_suffix, title=title, notify=notify,
post_amend_description=post_amend_description,
issue=issue, cc=cc)
# Uncomment when debugging.
@@ -1560,7 +1577,7 @@
'desc\n\nBUG=\n\nChange-Id: I123456789',
squash=False,
squash_mode='override_nosquash',
- ref_suffix='%m=Dont_put_bad_chars')
+ title='Dont_put_bad_chars')
self.assertIn(
'WARNING: Patchset title may only contain alphanumeric chars '
'and spaces. Cleaned up title:\nDont put bad chars\n',