From a5a1eea537ca2d82a0296dd703e038af7eee2fde Mon Sep 17 00:00:00 2001 From: Andrii Shyshkalov Date: Wed, 14 Dec 2016 14:21:32 +0000 Subject: [PATCH] Revert "Generate patchset name from commit subject" This reverts commit 947f2ee80883852e73fbe6fb2b624f354cebd800. Reason for revert: unnecessarily sets the title for the first upload, which isn't done for Rietveld. Original change's description: > Generate patchset name from commit subject > > BUG=672332 > > Change-Id: If9c662f11b217a52cac7c9c47ad9f3d978148c2e > Reviewed-on: https://chromium-review.googlesource.com/419330 > Commit-Queue: Aaron Gable > Reviewed-by: Andrii Shyshkalov > TBR=agable@chromium.org,tandrii@chromium.org,chromium-reviews@chromium.org BUG=672332 NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Change-Id: I9dcec1b02c8f16ceca8338acef4a1fc174aef35c Reviewed-on: https://chromium-review.googlesource.com/419517 Commit-Queue: Andrii Shyshkalov Reviewed-by: Andrii Shyshkalov --- git_cl.py | 14 +++++--------- tests/git_cl_test.py | 19 +++---------------- 2 files changed, 8 insertions(+), 25 deletions(-) diff --git a/git_cl.py b/git_cl.py index be339c0ef8..46af2bce17 100755 --- a/git_cl.py +++ b/git_cl.py @@ -2934,20 +2934,16 @@ class _GerritChangelistImpl(_ChangelistCodereviewBase): print('Adding self-LGTM (Code-Review +1) because of TBRs') refspec_opts.append('l=Code-Review+1') - 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) + if options.title: + if not re.match(r'^[\w ]+$', options.title): + options.title = re.sub(r'[^\w ]', '', options.title) print('WARNING: Patchset title may only contain alphanumeric chars ' - 'and spaces. Cleaned up title:\n%s' % title) + 'and spaces. Cleaned up title:\n%s' % options.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=' + title.replace(' ', '_')) + refspec_opts.append('m=' + options.title.replace(' ', '_')) if options.send_mail: if not change_desc.get_reviewers(): diff --git a/tests/git_cl_test.py b/tests/git_cl_test.py index 81540a9d33..d68129daef 100755 --- a/tests/git_cl_test.py +++ b/tests/git_cl_test.py @@ -1338,7 +1338,7 @@ class TestGitCl(TestCase): def _gerrit_upload_calls(cls, description, reviewers, squash, squash_mode='default', expected_upstream_ref='origin/refs/heads/master', - ref_suffix='', title=None, notify=False, + ref_suffix='', notify=False, post_amend_description=None, issue=None, cc=None): if post_amend_description is None: post_amend_description = description @@ -1409,18 +1409,6 @@ class TestGitCl(TestCase): expected_upstream_ref + '..' + ref_to_push],), ''), ] - - if not title: - calls += [ - ((['git', 'show', '-s', '--format=%s', 'HEAD'],), ''), - (('Title for patchset []: ',), ''), - ] - else: - 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 @@ -1474,7 +1462,6 @@ class TestGitCl(TestCase): squash_mode=None, expected_upstream_ref='origin/refs/heads/master', ref_suffix='', - title=None, notify=False, post_amend_description=None, issue=None, @@ -1507,7 +1494,7 @@ class TestGitCl(TestCase): description, reviewers, squash, squash_mode=squash_mode, expected_upstream_ref=expected_upstream_ref, - ref_suffix=ref_suffix, title=title, notify=notify, + ref_suffix=ref_suffix, notify=notify, post_amend_description=post_amend_description, issue=issue, cc=cc) # Uncomment when debugging. @@ -1547,7 +1534,7 @@ class TestGitCl(TestCase): 'desc\n\nBUG=\n\nChange-Id: I123456789', squash=False, squash_mode='override_nosquash', - title='Dont_put_bad_chars') + ref_suffix='%m=Dont_put_bad_chars') self.assertIn( 'WARNING: Patchset title may only contain alphanumeric chars ' 'and spaces. Cleaned up title:\nDont put bad chars\n',