Revision: 23357
Author: [email protected]
Date: Mon Aug 25 13:39:43 2014 UTC
Log: Teach v8rel script to read git hashes from DEPS.
The chromium DEPS file can refer to v8 git hashes now. These
are converted back into svn revision numbers for the v8
releases spreadsheet.
The DEPS file's quotation mark policy changed which affects
the regexp for retrieving the v8 revision ("->').
TEST=script_test.py
TEST=tools/push-to-trunk/releases.py -c /path/to/chromium/src --branch
recent
[email protected]
Review URL: https://codereview.chromium.org/500023003
https://code.google.com/p/v8/source/detail?r=23357
Modified:
/branches/bleeding_edge/tools/push-to-trunk/git_recipes.py
/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/git_recipes.py Mon Jul 21
12:13:36 2014 UTC
+++ /branches/bleeding_edge/tools/push-to-trunk/git_recipes.py Mon Aug 25
13:39:43 2014 UTC
@@ -28,6 +28,9 @@
import re
+SHA1_RE = re.compile('^[a-fA-F0-9]{40}$')
+GIT_SVN_ID_RE = re.compile('^git-svn-id: .*@([0-9]+) .*$')
+
class GitFailedException(Exception):
pass
@@ -185,6 +188,20 @@
def GitPull(self):
self.Git("pull")
+ def GitFetchOrigin(self):
+ self.Git("fetch origin")
+
+ def GitConvertToSVNRevision(self, git_hash):
+ result = self.Git(MakeArgs(["rev-list", "-n", "1", git_hash]))
+ if not result or not SHA1_RE.match(result):
+ raise GitFailedException("Git hash %s is unknown." % git_hash)
+ log = self.GitLog(n=1, format="%B", git_hash=git_hash)
+ for line in reversed(log.splitlines()):
+ match = GIT_SVN_ID_RE.match(line.strip())
+ if match:
+ return match.group(1)
+ raise GitFailedException("Couldn't convert %s to SVN." % git_hash)
+
def GitSVNFetch(self):
self.Git("svn fetch")
=======================================
--- /branches/bleeding_edge/tools/push-to-trunk/releases.py Fri Aug 22
14:30:37 2014 UTC
+++ /branches/bleeding_edge/tools/push-to-trunk/releases.py Mon Aug 25
13:39:43 2014 UTC
@@ -47,10 +47,10 @@
# Expression with three versions (historical) for extracting the v8
revision
# from the chromium DEPS file.
-DEPS_RE = re.compile(r'^\s*(?:"v8_revision": "'
- '|\(Var\("googlecode_url"\) % "v8"\) \+ "\/trunk@'
- '|"http\:\/\/v8\.googlecode\.com\/svn\/trunk@)'
- '([0-9]+)".*$', re.M)
+DEPS_RE = re.compile(r"""^\s*(?:["']v8_revision["']: ["']"""
+ """|\(Var\("googlecode_url"\) % "v8"\) \+ "\/trunk@"""
+ """|"http\:\/\/v8\.googlecode\.com\/svn\/trunk@)"""
+ """([^"']+)["'].*$""", re.M)
# Expression to pick tag and revision for bleeding edge tags. To be used
with
# output of 'svn log'.
@@ -374,6 +374,18 @@
self.GitCreateBranch(self.Config(BRANCHNAME))
+def ConvertToCommitNumber(step, revision):
+ # Simple check for git hashes.
+ if revision.isdigit() and len(revision) < 8:
+ return revision
+ try:
+ # TODO(machenbach): Add cwd to git calls.
+ os.chdir(os.path.join(step["chrome_path"], "v8"))
+ return step.GitConvertToSVNRevision(revision)
+ finally:
+ os.chdir(step["chrome_path"])
+
+
class RetrieveChromiumV8Releases(Step):
MESSAGE = "Retrieve V8 releases from Chromium DEPS."
REQUIRES = "chrome_path"
@@ -387,6 +399,14 @@
print "No releases detected. Skipping chromium history."
return True
+ # Update v8 checkout in chromium.
+ try:
+ # TODO(machenbach): Add cwd to git calls.
+ os.chdir(os.path.join(self["chrome_path"], "v8"))
+ self.GitFetchOrigin()
+ finally:
+ os.chdir(self["chrome_path"])
+
oldest_v8_rev = int(releases[-1]["revision"])
cr_releases = []
@@ -401,7 +421,7 @@
if match:
cr_rev = GetCommitPositionNumber(self, git_hash)
if cr_rev:
- v8_rev = match.group(1)
+ v8_rev = ConvertToCommitNumber(self, match.group(1))
cr_releases.append([cr_rev, v8_rev])
# Stop after reaching beyond the last v8 revision we want to
update.
@@ -458,7 +478,7 @@
deps = FileToText(self.Config(DEPS_FILE))
match = DEPS_RE.search(deps)
if match:
- v8_rev = match.group(1)
+ v8_rev = ConvertToCommitNumber(self, match.group(1))
cr_branches.append([str(branch), v8_rev])
# Stop after reaching beyond the last v8 revision we want to
update.
=======================================
--- /branches/bleeding_edge/tools/push-to-trunk/test_scripts.py Fri Aug 22
14:30:37 2014 UTC
+++ /branches/bleeding_edge/tools/push-to-trunk/test_scripts.py Mon Aug 25
13:39:43 2014 UTC
@@ -1213,6 +1213,11 @@
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3456 0039-1c4b
+"""
+ c_v8_22624_log = """V8 CL.
+
+git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22624 123
+
"""
json_output = self.MakeEmptyTempFile()
csv_output = self.MakeEmptyTempFile()
@@ -1222,6 +1227,8 @@
TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile()
if not os.path.exists(TEST_CONFIG[CHROMIUM]):
os.makedirs(TEST_CONFIG[CHROMIUM])
+ if not os.path.exists(os.path.join(TEST_CONFIG[CHROMIUM], "v8")):
+ os.makedirs(os.path.join(TEST_CONFIG[CHROMIUM], "v8"))
def WriteDEPS(revision):
TextToFile("Line\n \"v8_revision\": \"%s\",\n line\n" % revision,
TEST_CONFIG[DEPS_FILE])
@@ -1290,12 +1297,17 @@
Git("checkout -f master", ""),
Git("pull", ""),
Git("checkout -b %s" % TEST_CONFIG[BRANCHNAME], ""),
+ Git("fetch origin", ""),
Git("log --format=%H --grep=\"V8\"", "c_hash1\nc_hash2\nc_hash3\n"),
Git("diff --name-only c_hash1 c_hash1^", ""),
Git("diff --name-only c_hash2 c_hash2^", TEST_CONFIG[DEPS_FILE]),
Git("checkout -f c_hash2 -- %s" % TEST_CONFIG[DEPS_FILE], "",
- cb=ResetDEPS(22624)),
+ cb=ResetDEPS("0123456789012345678901234567890123456789")),
Git("log -1 --format=%B c_hash2", c_hash2_commit_log),
+ Git("rev-list -n 1 0123456789012345678901234567890123456789",
+ "0123456789012345678901234567890123456789"),
+ Git("log -1 --format=%B 0123456789012345678901234567890123456789",
+ c_v8_22624_log),
Git("diff --name-only c_hash3 c_hash3^", TEST_CONFIG[DEPS_FILE]),
Git("checkout -f c_hash3 -- %s" % TEST_CONFIG[DEPS_FILE], "",
cb=ResetDEPS(345)),
--
--
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.