[release] Force branch commit messages on upload

Gerrit seems to concatenate several commit messages on uploading branch
creation CLs. Now we pass the commit message of the branch commit to
the upload script to prevent this.

NOTRY=true

Bug: v8:8546
Change-Id: Ia4673261aad2f40bcda4384889a0428039adae74
Reviewed-on: https://chromium-review.googlesource.com/c/1367454
Reviewed-by: Sergiy Belozorov <sergiyb@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58092}
This commit is contained in:
Michael Achenbach 2018-12-07 13:28:46 +01:00 committed by Commit Bot
parent 8799f78080
commit a3496f4afb
3 changed files with 10 additions and 5 deletions

View File

@ -207,8 +207,7 @@ class CommitBranch(Step):
self["commit_title"] = text.splitlines()[0] self["commit_title"] = text.splitlines()[0]
TextToFile(text, self.Config("COMMITMSG_FILE")) TextToFile(text, self.Config("COMMITMSG_FILE"))
self.GitCommit(file_name = self.Config("COMMITMSG_FILE")) self.GitCommit(file_name=self.Config("COMMITMSG_FILE"))
os.remove(self.Config("COMMITMSG_FILE"))
os.remove(self.Config("CHANGELOG_ENTRY_FILE")) os.remove(self.Config("CHANGELOG_ENTRY_FILE"))
@ -221,13 +220,16 @@ class LandBranch(Step):
else: else:
self.GitUpload(force=True, self.GitUpload(force=True,
bypass_hooks=True, bypass_hooks=True,
no_autocc=True) no_autocc=True,
message_file=self.Config("COMMITMSG_FILE"))
cmd = "cl land --bypass-hooks -f" cmd = "cl land --bypass-hooks -f"
if self._options.dry_run: if self._options.dry_run:
print "Dry run. Command:\ngit %s" % cmd print "Dry run. Command:\ngit %s" % cmd
else: else:
self.Git(cmd) self.Git(cmd)
os.remove(self.Config("COMMITMSG_FILE"))
class TagRevision(Step): class TagRevision(Step):
MESSAGE = "Tag the new revision." MESSAGE = "Tag the new revision."

View File

@ -207,7 +207,7 @@ class GitRecipesMixin(object):
def GitUpload(self, reviewer="", force=False, cq=False, def GitUpload(self, reviewer="", force=False, cq=False,
cq_dry_run=False, bypass_hooks=False, cc="", tbr_reviewer="", cq_dry_run=False, bypass_hooks=False, cc="", tbr_reviewer="",
no_autocc=False, **kwargs): no_autocc=False, message_file=None, **kwargs):
args = ["cl upload --send-mail"] args = ["cl upload --send-mail"]
if reviewer: if reviewer:
args += ["-r", Quoted(reviewer)] args += ["-r", Quoted(reviewer)]
@ -225,6 +225,8 @@ class GitRecipesMixin(object):
args.append("--no-autocc") args.append("--no-autocc")
if cc: if cc:
args += ["--cc", Quoted(cc)] args += ["--cc", Quoted(cc)]
if message_file:
args += ["--message-file", Quoted(message_file)]
args += ["--gerrit"] args += ["--gerrit"]
# TODO(machenbach): Check output in forced mode. Verify that all required # TODO(machenbach): Check output in forced mode. Verify that all required
# base files were uploaded, if not retry. # base files were uploaded, if not retry.

View File

@ -934,7 +934,8 @@ TBR=reviewer@chromium.org"""
Cmd("git commit -aF \"%s\"" % TEST_CONFIG["COMMITMSG_FILE"], "", Cmd("git commit -aF \"%s\"" % TEST_CONFIG["COMMITMSG_FILE"], "",
cb=CheckVersionCommit), cb=CheckVersionCommit),
Cmd("git cl upload --send-mail " Cmd("git cl upload --send-mail "
"-f --bypass-hooks --no-autocc --gerrit", ""), "-f --bypass-hooks --no-autocc --message-file "
"\"%s\" --gerrit" % TEST_CONFIG["COMMITMSG_FILE"], ""),
Cmd("git cl land --bypass-hooks -f", ""), Cmd("git cl land --bypass-hooks -f", ""),
Cmd("git fetch", ""), Cmd("git fetch", ""),
Cmd("git log -1 --format=%H --grep=" Cmd("git log -1 --format=%H --grep="