git-cl: Set the right Change-Id footer automatically.
If the Change-Id in the description is different from the one fetched
from Gerrit, automatically set the right one instead of asking the
user to do so.
Change-Id: I0f681d9e7d98f3ed50adc4b6e4929981530e901c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2101368
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Anthony Polito <apolito@google.com>
diff --git a/tests/git_cl_test.py b/tests/git_cl_test.py
index 0aa29d9..a75e814 100755
--- a/tests/git_cl_test.py
+++ b/tests/git_cl_test.py
@@ -887,19 +887,16 @@
(('DownloadGerritHook', False), ''),
]
if squash:
- if force or not issue:
- if not force:
- calls += [
- ((['RunEditor'],), description),
- ]
+ if not force and not issue:
+ calls += [
+ ((['RunEditor'],), description),
+ ]
# user wants to edit description
if edit_description:
calls += [
((['RunEditor'],), edit_description),
]
ref_to_push = 'abcdef0123456789'
- calls += [
- ]
if custom_cl_base is None:
calls += [
@@ -1322,18 +1319,18 @@
original_title='Initial upload',
change_id='Ixxx')
- def test_gerrit_upload_force_sets_bug_if_wrong_changeid(self):
+ def test_gerrit_upload_corrects_wrong_change_id(self):
self._run_gerrit_upload_test(
- ['-b', '10000', '-f', '-m', 'Title'],
- u'desc=\n\nChange-Id: Ixxxx\n\nChange-Id: Izzzz\nBug: 10000',
+ ['-b', '10000', '-m', 'Title', '--edit-description'],
+ u'desc=\n\nBug: 10000\nChange-Id: Ixxxx',
[],
- force=True,
issue='123456',
expected_upstream_ref='origin/master',
+ edit_description='desc=\n\nBug: 10000\nChange-Id: Izzzz',
fetched_description='desc=\n\nChange-Id: Ixxxx',
original_title='Title',
title='Title',
- change_id='Izzzz')
+ change_id='Ixxxx')
def test_gerrit_upload_force_sets_fixed(self):
self._run_gerrit_upload_test(