[release] Fix merge_to_branch regarding gerrit bug footer.

Also only use unique bug numbers in generated commit message.

NOTRY=true

Bug: v8:6482
Change-Id: Ie0d14640053bacb907d18e6ccb5b4d0b6ecbf661
Reviewed-on: https://chromium-review.googlesource.com/532914
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45899}
This commit is contained in:
Michael Achenbach 2017-06-13 11:59:42 +02:00 committed by Commit Bot
parent f52c8f9f28
commit 795f753075
2 changed files with 9 additions and 3 deletions

View File

@ -31,6 +31,7 @@ from collections import OrderedDict
import sys
from common_includes import *
from git_recipes import GetCommitMessageFooterMap
def IsSvnNumber(rev):
return rev.isdigit() and len(rev) < 8
@ -134,8 +135,13 @@ class CreateCommitMessage(Step):
msg = self.GitLog(n=1, git_hash=commit_hash)
for bug in re.findall(r"^[ \t]*BUG[ \t]*=[ \t]*(.*?)[ \t]*$", msg, re.M):
bugs.extend(s.strip() for s in bug.split(","))
bug_aggregate = ",".join(sorted(filter(lambda s: s and s != "none", bugs)))
gerrit_bug = GetCommitMessageFooterMap(msg).get('Bug', '')
bugs.extend(s.strip() for s in gerrit_bug.split(","))
bug_aggregate = ",".join(
sorted(filter(lambda s: s and s != "none", set(bugs))))
if bug_aggregate:
# TODO(machenbach): Use proper gerrit footer for bug after switch to
# gerrit. Keep BUG= for now for backwards-compatibility.
msg_pieces.append("BUG=%s\nLOG=N\n" % bug_aggregate)
msg_pieces.append("NOTRY=true\nNOPRESUBMIT=true\nNOTREECHECKS=true\n")

View File

@ -1626,8 +1626,8 @@ NOTREECHECKS=true
Cmd("git log -1 --format=%s ab56789", "Revert \"Something\""),
Cmd("git log -1 ab12345", "Title4\nBUG=123\nBUG=234"),
Cmd("git log -1 ab23456", "Title2\n BUG = v8:123,345"),
Cmd("git log -1 ab34567", "Title3\nLOG=n\nBUG=567, 456"),
Cmd("git log -1 ab45678", "Title1\nBUG="),
Cmd("git log -1 ab34567", "Title3\nLOG=n\nBug: 567, 456,345"),
Cmd("git log -1 ab45678", "Title1\nBug:"),
Cmd("git log -1 ab56789", "Revert \"Something\"\nBUG=none"),
Cmd("git log -1 -p ab12345", "patch4"),
Cmd(("git apply --index --reject \"%s\"" %