Commit 15c269b7 authored by machenbach's avatar machenbach Committed by Commit bot

Include range summary when rolling into chromium.

BUG=chromium:457022
TBR=tandrii@chromium.org
NOTRY=true
LOG=n

TEST=./script_test.py

Review URL: https://codereview.chromium.org/918953003

Cr-Commit-Position: refs/heads/master@{#26659}
parent 29684963
...@@ -52,7 +52,7 @@ class DetectLastRoll(Step): ...@@ -52,7 +52,7 @@ class DetectLastRoll(Step):
exec(FileToText(os.path.join(self._options.chromium, "DEPS"))) exec(FileToText(os.path.join(self._options.chromium, "DEPS")))
# The revision rolled last. # The revision rolled last.
last_roll = vars['v8_revision'] self["last_roll"] = vars['v8_revision']
# TODO(machenbach): It is possible that the auto-push script made a new # TODO(machenbach): It is possible that the auto-push script made a new
# fast-forward release (e.g. 4.2.3) while somebody patches the last # fast-forward release (e.g. 4.2.3) while somebody patches the last
...@@ -60,11 +60,11 @@ class DetectLastRoll(Step): ...@@ -60,11 +60,11 @@ class DetectLastRoll(Step):
# the fast-forward release. Should there be a way to prioritize the # the fast-forward release. Should there be a way to prioritize the
# patched version? # patched version?
if latest_release == last_roll: if latest_release == self["last_roll"]:
# We always try to roll if the latest revision is not the revision in # We always try to roll if the latest revision is not the revision in
# chromium. # chromium.
print("There is no newer v8 revision than the one in Chromium (%s)." print("There is no newer v8 revision than the one in Chromium (%s)."
% last_roll) % self["last_roll"])
return True return True
...@@ -95,6 +95,7 @@ class RollChromium(Step): ...@@ -95,6 +95,7 @@ class RollChromium(Step):
"--author", self._options.author, "--author", self._options.author,
"--reviewer", self._options.reviewer, "--reviewer", self._options.reviewer,
"--chromium", self._options.chromium, "--chromium", self._options.chromium,
"--last-roll", self["last_roll"],
"--use-commit-queue", "--use-commit-queue",
] ]
if self._options.sheriff: if self._options.sheriff:
......
...@@ -10,6 +10,10 @@ import sys ...@@ -10,6 +10,10 @@ import sys
from common_includes import * from common_includes import *
ROLL_SUMMARY = ("Summary of changes available at:\n"
"https://chromium.googlesource.com/v8/v8/+log/%s..%s")
class Preparation(Step): class Preparation(Step):
MESSAGE = "Preparation." MESSAGE = "Preparation."
...@@ -27,6 +31,20 @@ class DetectLastPush(Step): ...@@ -27,6 +31,20 @@ class DetectLastPush(Step):
self["push_title"] = self.GitLog(n=1, format="%s", self["push_title"] = self.GitLog(n=1, format="%s",
git_hash=self["last_push"]) git_hash=self["last_push"])
# The master revision this release is based on.
self["push_base"] = self.GetLatestReleaseBase()
# FIXME(machenbach): Manually specifying a revision doesn't work at the
# moment. Needs more complicated logic to find the correct push_base above.
# Maybe delete that parameter entirely?
assert not self._options.last_push
# Determine the master revision of the last roll.
version = self.GetVersionTag(self._options.last_roll)
assert version
self["last_rolled_base"] = self.GetLatestReleaseBase(version=version)
assert self["last_rolled_base"]
class SwitchChromium(Step): class SwitchChromium(Step):
MESSAGE = "Switch to Chromium checkout." MESSAGE = "Switch to Chromium checkout."
...@@ -69,13 +87,17 @@ class UploadCL(Step): ...@@ -69,13 +87,17 @@ class UploadCL(Step):
cwd=self._options.chromium) is None: cwd=self._options.chromium) is None:
self.Die("Failed to create deps for %s" % self["last_push"]) self.Die("Failed to create deps for %s" % self["last_push"])
commit_title = "Update V8 to %s." % self["push_title"].lower() message = []
sheriff = "" message.append("Update V8 to %s." % self["push_title"].lower())
message.append(
ROLL_SUMMARY % (self["last_rolled_base"][:8], self["push_base"][:8]))
if self["sheriff"]: if self["sheriff"]:
sheriff = ("\n\nPlease reply to the V8 sheriff %s in case of problems." message.append("Please reply to the V8 sheriff %s in case of problems."
% self["sheriff"]) % self["sheriff"])
self.GitCommit("%s%s\n\nTBR=%s" % message.append("TBR=%s" % self._options.reviewer)
(commit_title, sheriff, self._options.reviewer), self.GitCommit("\n\n".join(message),
author=self._options.author, author=self._options.author,
cwd=self._options.chromium) cwd=self._options.chromium)
if not self._options.dry_run: if not self._options.dry_run:
...@@ -119,6 +141,8 @@ class ChromiumRoll(ScriptsBase): ...@@ -119,6 +141,8 @@ class ChromiumRoll(ScriptsBase):
"directory to automate the V8 roll.")) "directory to automate the V8 roll."))
parser.add_argument("-l", "--last-push", parser.add_argument("-l", "--last-push",
help="The git commit ID of the last candidates push.") help="The git commit ID of the last candidates push.")
parser.add_argument("--last-roll", required=True,
help="The git commit ID of the last rolled version.")
parser.add_argument("--use-commit-queue", parser.add_argument("--use-commit-queue",
help="Check the CQ bit on upload.", help="Check the CQ bit on upload.",
default=False, action="store_true") default=False, action="store_true")
......
...@@ -47,6 +47,7 @@ from git_recipes import GitFailedException ...@@ -47,6 +47,7 @@ from git_recipes import GitFailedException
CHANGELOG_FILE = "ChangeLog" CHANGELOG_FILE = "ChangeLog"
PUSH_MSG_GIT_RE = re.compile(r".* \(based on (?P<git_rev>[a-fA-F0-9]+)\)$") PUSH_MSG_GIT_RE = re.compile(r".* \(based on (?P<git_rev>[a-fA-F0-9]+)\)$")
PUSH_MSG_NEW_RE = re.compile(r"^Version \d+\.\d+\.\d+$")
VERSION_FILE = os.path.join("src", "version.cc") VERSION_FILE = os.path.join("src", "version.cc")
VERSION_RE = re.compile(r"^\d+\.\d+\.\d+(?:\.\d+)?$") VERSION_RE = re.compile(r"^\d+\.\d+\.\d+(?:\.\d+)?$")
...@@ -601,6 +602,13 @@ class Step(GitRecipesMixin): ...@@ -601,6 +602,13 @@ class Step(GitRecipesMixin):
except GitFailedException: except GitFailedException:
self.WaitForResolvingConflicts(patch_file) self.WaitForResolvingConflicts(patch_file)
def GetVersionTag(self, revision):
tag = self.Git("describe --tags %s" % revision).strip()
if VERSION_RE.match(tag):
return tag
else:
return None
def GetRecentReleases(self, max_age): def GetRecentReleases(self, max_age):
# Make sure tags are fetched. # Make sure tags are fetched.
self.Git("fetch origin +refs/tags/*:refs/tags/*") self.Git("fetch origin +refs/tags/*:refs/tags/*")
...@@ -612,12 +620,8 @@ class Step(GitRecipesMixin): ...@@ -612,12 +620,8 @@ class Step(GitRecipesMixin):
revisions = self.Git("rev-list --max-age=%d --tags" % revisions = self.Git("rev-list --max-age=%d --tags" %
int(time_now - max_age)).strip() int(time_now - max_age)).strip()
def IsTagged(revision):
return VERSION_RE.match(
self.Git("describe --tags %s" % revision).strip())
# Filter out revisions who's tag is off by one or more commits. # Filter out revisions who's tag is off by one or more commits.
return filter(IsTagged, revisions.splitlines()) return filter(lambda r: self.GetVersionTag(r), revisions.splitlines())
def GetLatestVersion(self): def GetLatestVersion(self):
# Use cached version if available. # Use cached version if available.
...@@ -643,11 +647,11 @@ class Step(GitRecipesMixin): ...@@ -643,11 +647,11 @@ class Step(GitRecipesMixin):
assert latest_hash assert latest_hash
return latest_hash return latest_hash
def GetLatestReleaseBase(self): def GetLatestReleaseBase(self, version=None):
"""The latest release base is the latest revision that is covered in the """The latest release base is the latest revision that is covered in the
last change log file. It doesn't include cherry-picked patches. last change log file. It doesn't include cherry-picked patches.
""" """
latest_version = self.GetLatestVersion() latest_version = version or self.GetLatestVersion()
# Strip patch level if it exists. # Strip patch level if it exists.
latest_version = ".".join(latest_version.split(".")[:3]) latest_version = ".".join(latest_version.split(".")[:3])
...@@ -656,14 +660,21 @@ class Step(GitRecipesMixin): ...@@ -656,14 +660,21 @@ class Step(GitRecipesMixin):
latest_hash = self.GitLog(n=1, format="%H", branch=latest_version) latest_hash = self.GitLog(n=1, format="%H", branch=latest_version)
assert latest_hash assert latest_hash
match = PUSH_MSG_GIT_RE.match( title = self.GitLog(n=1, format="%s", git_hash=latest_hash)
self.GitLog(n=1, format="%s", git_hash=latest_hash)) match = PUSH_MSG_GIT_RE.match(title)
if match: if match:
# Legacy: In the old process there's one level of indirection. The # Legacy: In the old process there's one level of indirection. The
# version is on the candidates branch and points to the real release # version is on the candidates branch and points to the real release
# base on master through the commit message. # base on master through the commit message.
latest_hash = match.group("git_rev") return match.group("git_rev")
return latest_hash match = PUSH_MSG_NEW_RE.match(title)
if match:
# This is a new-style v8 version branched from master. The commit
# "latest_hash" is the version-file change. Its parent is the release
# base on master.
return self.GitLog(n=1, format="%H", git_hash="%s^" % latest_hash)
self.Die("Unknown latest release: %s" % latest_hash)
def ArrayToVersion(self, prefix): def ArrayToVersion(self, prefix):
return ".".join([self[prefix + "major"], return ".".join([self[prefix + "major"],
......
...@@ -929,8 +929,8 @@ Performance and stability improvements on all platforms.""" ...@@ -929,8 +929,8 @@ Performance and stability improvements on all platforms."""
Cmd("git checkout -f origin/master -- src/version.cc", Cmd("git checkout -f origin/master -- src/version.cc",
"", cb=self.WriteFakeVersionFile), "", cb=self.WriteFakeVersionFile),
Cmd("git log -1 --format=%H 3.22.4", "release_hash\n"), Cmd("git log -1 --format=%H 3.22.4", "release_hash\n"),
Cmd("git log -1 --format=%s release_hash", Cmd("git log -1 --format=%s release_hash", "Version 3.22.4\n"),
"Version 3.22.4 (based on abc3)\n"), Cmd("git log -1 --format=%H release_hash^", "abc3\n"),
Cmd("git log --format=%H abc3..push_hash", "rev1\n"), Cmd("git log --format=%H abc3..push_hash", "rev1\n"),
Cmd("git log -1 --format=%s rev1", "Log text 1.\n"), Cmd("git log -1 --format=%s rev1", "Log text 1.\n"),
Cmd("git log -1 --format=%B rev1", "Text\nLOG=YES\nBUG=v8:321\nText\n"), Cmd("git log -1 --format=%B rev1", "Text\nLOG=YES\nBUG=v8:321\nText\n"),
...@@ -1017,7 +1017,15 @@ def get_list(): ...@@ -1017,7 +1017,15 @@ def get_list():
Cmd("git tag", self.TAGS), Cmd("git tag", self.TAGS),
Cmd("git log -1 --format=%H 3.22.4", "push_hash\n"), Cmd("git log -1 --format=%H 3.22.4", "push_hash\n"),
Cmd("git log -1 --format=%s push_hash", Cmd("git log -1 --format=%s push_hash",
"Version 3.22.5 (based on abc)\n"), "Version 3.22.4 (based on abc)\n"),
Cmd("git log -1 --format=%H 3.22.4", "push_hash\n"),
Cmd("git log -1 --format=%s push_hash",
"Version 3.22.4 (based on abc)"),
Cmd("git describe --tags last_roll_hsh", "3.22.2.1"),
Cmd("git log -1 --format=%H 3.22.2", "last_roll_base_hash"),
Cmd("git log -1 --format=%s last_roll_base_hash", "Version 3.22.2"),
Cmd("git log -1 --format=%H last_roll_base_hash^",
"last_roll_master_hash"),
URL("https://chromium-build.appspot.com/p/chromium/sheriff_v8.js", URL("https://chromium-build.appspot.com/p/chromium/sheriff_v8.js",
"document.write('g_name')"), "document.write('g_name')"),
Cmd("git status -s -uno", "", cwd=chrome_dir), Cmd("git status -s -uno", "", cwd=chrome_dir),
...@@ -1027,8 +1035,10 @@ def get_list(): ...@@ -1027,8 +1035,10 @@ def get_list():
Cmd("git fetch origin", ""), Cmd("git fetch origin", ""),
Cmd("git new-branch v8-roll-push_hash", "", cwd=chrome_dir), Cmd("git new-branch v8-roll-push_hash", "", cwd=chrome_dir),
Cmd("roll-dep v8 push_hash", "rolled", cb=WriteDeps, cwd=chrome_dir), Cmd("roll-dep v8 push_hash", "rolled", cb=WriteDeps, cwd=chrome_dir),
Cmd(("git commit -am \"Update V8 to version 3.22.5 " Cmd(("git commit -am \"Update V8 to version 3.22.4 "
"(based on abc).\n\n" "(based on abc).\n\n"
"Summary of changes available at:\n"
"https://chromium.googlesource.com/v8/v8/+log/last_rol..abc\n\n"
"Please reply to the V8 sheriff c_name@chromium.org in " "Please reply to the V8 sheriff c_name@chromium.org in "
"case of problems.\n\nTBR=c_name@chromium.org\" " "case of problems.\n\nTBR=c_name@chromium.org\" "
"--author \"author@chromium.org <author@chromium.org>\""), "--author \"author@chromium.org <author@chromium.org>\""),
...@@ -1040,7 +1050,8 @@ def get_list(): ...@@ -1040,7 +1050,8 @@ def get_list():
args = ["-a", "author@chromium.org", "-c", chrome_dir, args = ["-a", "author@chromium.org", "-c", chrome_dir,
"--sheriff", "--googlers-mapping", googlers_mapping_py, "--sheriff", "--googlers-mapping", googlers_mapping_py,
"-r", "reviewer@chromium.org"] "-r", "reviewer@chromium.org",
"--last-roll", "last_roll_hsh"]
ChromiumRoll(TEST_CONFIG, self).Run(args) ChromiumRoll(TEST_CONFIG, self).Run(args)
deps = FileToText(os.path.join(chrome_dir, "DEPS")) deps = FileToText(os.path.join(chrome_dir, "DEPS"))
......
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