Commit 8c90d03f authored by Andrii Shyshkalov's avatar Andrii Shyshkalov Committed by Commit Bot

[git-cl] refactor Change-Id manipulation in squash upload mode.

R=iannucci@chromium.org

Bug:

Change-Id: Ia1729175c9f10d7c89388bf1e227904e76cbb16c
Reviewed-on: https://chromium-review.googlesource.com/482319Reviewed-by: 's avatarRobbie Iannucci <iannucci@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
parent db02dd05
......@@ -2875,6 +2875,7 @@ class _GerritChangelistImpl(_ChangelistCodereviewBase):
if options.title:
message = options.title + '\n\n' + message
change_desc = ChangeDescription(message)
if not options.force:
change_desc.prompt(bug=options.bug)
# On first upload, patchset title is always this string, while
......@@ -2883,16 +2884,15 @@ class _GerritChangelistImpl(_ChangelistCodereviewBase):
automatic_title = True
if not change_desc.description:
DieWithError("Description is empty. Aborting...")
message = change_desc.description
change_ids = git_footers.get_footer_change_id(message)
change_ids = git_footers.get_footer_change_id(change_desc.description)
if len(change_ids) > 1:
DieWithError('too many Change-Id footers, at most 1 allowed.')
if not change_ids:
# Generate the Change-Id automatically.
message = git_footers.add_footer_change_id(
message, GenerateGerritChangeId(message))
change_desc.set_description(message)
change_ids = git_footers.get_footer_change_id(message)
change_desc.set_description(git_footers.add_footer_change_id(
change_desc.description,
GenerateGerritChangeId(change_desc.description)))
change_ids = git_footers.get_footer_change_id(change_desc.description)
assert len(change_ids) == 1
change_id = change_ids[0]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment