Remove commits-to-cherry-pick only after a cherry-pick is created

If `git cl cherry-pick` fails to cherry-pick a CL, it should print
out the commit it failed to cherry-pick. Right now, that commit
is missing from the "print_any_remaining_commits" output
since commits get popped from the dict regardless of whether or
not a CL is created.

Bug: 364375259
Change-Id: Iac61f50b8f8f226b9e70bc2d0fa235f39c27d91e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5829953
Auto-Submit: Gavin Mak <gavinmak@google.com>
Reviewed-by: Scott Lee <ddoman@chromium.org>
Commit-Queue: Scott Lee <ddoman@chromium.org>
changes/53/5829953/4
Gavin Mak 1 year ago committed by LUCI CQ
parent 5eca5541e8
commit 43691064b4

@ -4583,7 +4583,6 @@ def CMDcherry_pick(parser, args):
# to cherry pick each commit individually and create a chain of CLs.
parent_change_num = options.parent_change_num
for change_id, orig_message in change_ids_to_message.items():
change_ids_to_commit.pop(change_id)
message = _create_commit_message(orig_message, options.bug)
orig_subj_line = orig_message.splitlines()[0]
@ -4600,6 +4599,7 @@ def CMDcherry_pick(parser, args):
print_any_remaining_commits()
return 1
change_ids_to_commit.pop(change_id)
new_change_id = new_change_info['id']
new_change_num = new_change_info['_number']
new_change_url = gerrit_util.GetChangePageUrl(host, new_change_num)

Loading…
Cancel
Save