Revert "git-cl: Refactor CMDUploadChange"
This reverts commit 9f29465e529150fb4e63c2f8930c61d5d2af633c.
Reason for revert:
line 2302, in CMDUploadChange
change_id = change_ids[0]
IndexError: list index out of range
Original change's description:
> git-cl: Refactor CMDUploadChange
>
> Changes:
> - Add _GetDescriptionForUpload and _GetTitleForUpload.
> - Add ensure_change_id to ChangeDescription, that ensures the
> description has a particular Change-Id.
> - If more than a Change-Id was entered on new issue upload, remove
> all, and add a new one.
>
> Change-Id: I0eae474eb07ea3036973b18571f72a80da425b21
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2101811
> Reviewed-by: Josip Sokcevic <sokcevic@google.com>
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
TBR=ehmaldonado@chromium.org,apolito@google.com,infra-scoped@luci-project-accounts.iam.gserviceaccount.com,sokcevic@google.com
Change-Id: Ibb76539066c103ec951fa8d02684bc10f84549bf
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2103531
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
diff --git a/tests/git_cl_test.py b/tests/git_cl_test.py
index 71ccb58..9b3cdb0 100755
--- a/tests/git_cl_test.py
+++ b/tests/git_cl_test.py
@@ -868,6 +868,17 @@
self.mockGit.config['gerrit.override-squash-uploads'] = (
'true' if squash_mode == 'override_squash' else 'false')
+ # If issue is given, then description is fetched from Gerrit instead.
+ if issue is None:
+ if squash:
+ title = 'Initial_upload'
+ else:
+ if not title:
+ calls += [
+ ((['git', 'show', '-s', '--format=%s', 'HEAD'],), ''),
+ (('ask_for_data', 'Title for patchset []: '), 'User input'),
+ ]
+ title = 'User_input'
if not git_footers.get_footer_change_id(description) and not squash:
calls += [
(('DownloadGerritHook', False), ''),
@@ -934,17 +945,6 @@
ref_suffix = '%notify=NONE'
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:
- calls += [
- ((['git', 'show', '-s', '--format=%s', 'HEAD'],), ''),
- (('ask_for_data', 'Title for patchset []: '), 'User input'),
- ]
- title = 'User_input'
if title:
ref_suffix += ',m=' + title
metrics_arguments.append('m')
@@ -1297,7 +1297,7 @@
self._run_gerrit_upload_test(
['-r', 'foo@example.com', '--send-mail'],
'desc ✔\n\nBUG=\n\nChange-Id: I123456789',
- reviewers=['foo@example.com'],
+ ['foo@example.com'],
squash=False,
squash_mode='override_nosquash',
notify=True,