Revision: 20972
Author: [email protected]
Date: Fri Apr 25 11:33:19 2014 UTC
Log: Let releases script retrieve information about chromium branches.
BUG=
[email protected]
Review URL: https://codereview.chromium.org/238443005
http://code.google.com/p/v8/source/detail?r=20972
Modified:
/branches/bleeding_edge/tools/push-to-trunk/releases.py
/branches/bleeding_edge/tools/push-to-trunk/test_scripts.py
=======================================
--- /branches/bleeding_edge/tools/push-to-trunk/releases.py Tue Apr 15
12:00:53 2014 UTC
+++ /branches/bleeding_edge/tools/push-to-trunk/releases.py Fri Apr 25
11:33:19 2014 UTC
@@ -6,6 +6,10 @@
# This script retrieves the history of all V8 branches and trunk revisions
and
# their corresponding Chromium revisions.
+# Requires a chromium checkout with branch heads:
+# gclient sync --with_branch_heads
+# gclient fetch
+
import argparse
import csv
import itertools
@@ -87,6 +91,7 @@
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_rev either refers to a chromium svn revision or a chromium branch
number.
"""
range_lists = {}
cr_releases = FilterDuplicatesAndReverse(cr_releases)
@@ -174,6 +179,8 @@
"patches_merged": patches,
# Default for easier output formatting.
"chromium_revision": "",
+ # Default for easier output formatting.
+ "chromium_branch": "",
# 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.
"review_link": MatchSafe(REVIEW_LINK_RE.search(body)),
@@ -326,6 +333,64 @@
for revision, ranges in all_ranges.iteritems():
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):
MESSAGE = "Returning to V8 checkout."
REQUIRES = "chrome_path"
@@ -388,6 +453,7 @@
SwitchChromium,
UpdateChromiumCheckout,
RetrieveChromiumV8Releases,
+ RietrieveChromiumBranches,
SwitchV8,
CleanUp,
WriteOutput,
=======================================
--- /branches/bleeding_edge/tools/push-to-trunk/test_scripts.py Tue Apr 15
12:00:53 2014 UTC
+++ /branches/bleeding_edge/tools/push-to-trunk/test_scripts.py Fri Apr 25
11:33:19 2014 UTC
@@ -1228,6 +1228,11 @@
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], "",
+ cb=ResetDEPS(567)),
Git("checkout -f master", ""),
Git("branch -D %s" % TEST_CONFIG[BRANCHNAME], ""),
Git("checkout -f some_branch", ""),
@@ -1250,15 +1255,15 @@
expected_json = [
{"bleeding_edge": "", "patches_merged": "", "version": "3.22.3",
"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"},
{"patches_merged": "", "bleeding_edge": "", "version": "3.21.2",
"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"},
{"patches_merged": "12", "bleeding_edge": "", "version": "3.3.1.1",
"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"},
]
self.assertEquals(expected_json, json.loads(FileToText(json_output)))
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.