Let releases script retrieve information about chromium branches.

BUG=
R=jarin@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20972 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent d557425a
...@@ -6,6 +6,10 @@ ...@@ -6,6 +6,10 @@
# This script retrieves the history of all V8 branches and trunk revisions and # This script retrieves the history of all V8 branches and trunk revisions and
# their corresponding Chromium revisions. # their corresponding Chromium revisions.
# Requires a chromium checkout with branch heads:
# gclient sync --with_branch_heads
# gclient fetch
import argparse import argparse
import csv import csv
import itertools import itertools
...@@ -87,6 +91,7 @@ def BuildRevisionRanges(cr_releases): ...@@ -87,6 +91,7 @@ def BuildRevisionRanges(cr_releases):
entry is the only one of the form R1, as there is no end range. entry is the only one of the form R1, as there is no end range.
cr_releases is a list of [cr_rev, v8_rev] reverse-sorted by cr_rev. cr_releases is a list of [cr_rev, v8_rev] reverse-sorted by cr_rev.
cr_rev either refers to a chromium svn revision or a chromium branch number.
""" """
range_lists = {} range_lists = {}
cr_releases = FilterDuplicatesAndReverse(cr_releases) cr_releases = FilterDuplicatesAndReverse(cr_releases)
...@@ -174,6 +179,8 @@ class RetrieveV8Releases(Step): ...@@ -174,6 +179,8 @@ class RetrieveV8Releases(Step):
"patches_merged": patches, "patches_merged": patches,
# Default for easier output formatting. # Default for easier output formatting.
"chromium_revision": "", "chromium_revision": "",
# Default for easier output formatting.
"chromium_branch": "",
# Link to the CL on code review. Trunk pushes are not uploaded, so this # Link to the CL on code review. Trunk pushes are not uploaded, so this
# field will be populated below with the recent roll CL link. # field will be populated below with the recent roll CL link.
"review_link": MatchSafe(REVIEW_LINK_RE.search(body)), "review_link": MatchSafe(REVIEW_LINK_RE.search(body)),
...@@ -326,6 +333,64 @@ class RetrieveChromiumV8Releases(Step): ...@@ -326,6 +333,64 @@ class RetrieveChromiumV8Releases(Step):
for revision, ranges in all_ranges.iteritems(): for revision, ranges in all_ranges.iteritems():
trunk_dict.get(revision, {})["chromium_revision"] = ranges trunk_dict.get(revision, {})["chromium_revision"] = ranges
# TODO(machenbach): Unify common code with method above.
class RietrieveChromiumBranches(Step):
MESSAGE = "Retrieve Chromium branch information."
REQUIRES = "chrome_path"
def RunStep(self):
os.chdir(self["chrome_path"])
trunk_releases = filter(lambda r: r["branch"] == "trunk", self["releases"])
if not trunk_releases: # pragma: no cover
print "No trunk releases detected. Skipping chromium history."
return True
oldest_v8_rev = int(trunk_releases[-1]["revision"])
# Filter out irrelevant branches.
branches = filter(lambda r: re.match(r"branch-heads/\d+", r),
self.GitRemotes())
# Transform into pure branch numbers.
branches = map(lambda r: int(re.match(r"branch-heads/(\d+)", r).group(1)),
branches)
branches = sorted(branches, reverse=True)
cr_branches = []
try:
for branch in branches:
if not self.GitCheckoutFileSafe(self._config[DEPS_FILE],
"branch-heads/%d" % branch):
break # pragma: no cover
deps = FileToText(self.Config(DEPS_FILE))
match = DEPS_RE.search(deps)
if match:
v8_rev = match.group(1)
cr_branches.append([str(branch), v8_rev])
# Stop after reaching beyond the last v8 revision we want to update.
# We need a small buffer for possible revert/reland frenzies.
# TODO(machenbach): Subtraction is not git friendly.
if int(v8_rev) < oldest_v8_rev - 100:
break # pragma: no cover
# Allow Ctrl-C interrupt.
except (KeyboardInterrupt, SystemExit): # pragma: no cover
pass
# Clean up.
self.GitCheckoutFileSafe(self._config[DEPS_FILE], "HEAD")
# Add the chromium branches to the v8 trunk releases.
all_ranges = BuildRevisionRanges(cr_branches)
trunk_dict = dict((r["revision"], r) for r in trunk_releases)
for revision, ranges in all_ranges.iteritems():
trunk_dict.get(revision, {})["chromium_branch"] = ranges
class SwitchV8(Step): class SwitchV8(Step):
MESSAGE = "Returning to V8 checkout." MESSAGE = "Returning to V8 checkout."
REQUIRES = "chrome_path" REQUIRES = "chrome_path"
...@@ -388,6 +453,7 @@ class Releases(ScriptsBase): ...@@ -388,6 +453,7 @@ class Releases(ScriptsBase):
SwitchChromium, SwitchChromium,
UpdateChromiumCheckout, UpdateChromiumCheckout,
RetrieveChromiumV8Releases, RetrieveChromiumV8Releases,
RietrieveChromiumBranches,
SwitchV8, SwitchV8,
CleanUp, CleanUp,
WriteOutput, WriteOutput,
......
...@@ -1226,6 +1226,11 @@ LOG=N ...@@ -1226,6 +1226,11 @@ LOG=N
Git("checkout -f c_hash2 -- %s" % TEST_CONFIG[DEPS_FILE], "", Git("checkout -f c_hash2 -- %s" % TEST_CONFIG[DEPS_FILE], "",
cb=ResetDEPS(345)), cb=ResetDEPS(345)),
Git("svn find-rev c_hash2", "4567"), Git("svn find-rev c_hash2", "4567"),
Git("checkout -f HEAD -- %s" % TEST_CONFIG[DEPS_FILE], "",
cb=ResetDEPS(567)),
Git("branch -r", " weird/123\n branch-heads/7\n"),
Git("checkout -f branch-heads/7 -- %s" % TEST_CONFIG[DEPS_FILE], "",
cb=ResetDEPS(345)),
Git("checkout -f HEAD -- %s" % TEST_CONFIG[DEPS_FILE], "", Git("checkout -f HEAD -- %s" % TEST_CONFIG[DEPS_FILE], "",
cb=ResetDEPS(567)), cb=ResetDEPS(567)),
Git("checkout -f master", ""), Git("checkout -f master", ""),
...@@ -1250,15 +1255,15 @@ LOG=N ...@@ -1250,15 +1255,15 @@ LOG=N
expected_json = [ expected_json = [
{"bleeding_edge": "", "patches_merged": "", "version": "3.22.3", {"bleeding_edge": "", "patches_merged": "", "version": "3.22.3",
"chromium_revision": "4567", "branch": "trunk", "revision": "345", "chromium_revision": "4567", "branch": "trunk", "revision": "345",
"review_link": "", "date": "", "review_link": "", "date": "", "chromium_branch": "7",
"revision_link": "https://code.google.com/p/v8/source/detail?r=345"}, "revision_link": "https://code.google.com/p/v8/source/detail?r=345"},
{"patches_merged": "", "bleeding_edge": "", "version": "3.21.2", {"patches_merged": "", "bleeding_edge": "", "version": "3.21.2",
"chromium_revision": "", "branch": "3.21", "revision": "123", "chromium_revision": "", "branch": "3.21", "revision": "123",
"review_link": "", "date": "03:15", "review_link": "", "date": "03:15", "chromium_branch": "",
"revision_link": "https://code.google.com/p/v8/source/detail?r=123"}, "revision_link": "https://code.google.com/p/v8/source/detail?r=123"},
{"patches_merged": "12", "bleeding_edge": "", "version": "3.3.1.1", {"patches_merged": "12", "bleeding_edge": "", "version": "3.3.1.1",
"chromium_revision": "", "branch": "3.3", "revision": "234", "chromium_revision": "", "branch": "3.3", "revision": "234",
"review_link": "fake.com", "date": "18:15", "review_link": "fake.com", "date": "18:15", "chromium_branch": "",
"revision_link": "https://code.google.com/p/v8/source/detail?r=234"}, "revision_link": "https://code.google.com/p/v8/source/detail?r=234"},
] ]
self.assertEquals(expected_json, json.loads(FileToText(json_output))) self.assertEquals(expected_json, json.loads(FileToText(json_output)))
......
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