Make V8 releases script add useful links.
authormachenbach@chromium.org <machenbach@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 14 Apr 2014 10:32:00 +0000 (10:32 +0000)
committermachenbach@chromium.org <machenbach@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 14 Apr 2014 10:32:00 +0000 (10:32 +0000)
BUG=
R=jarin@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20713 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

tools/push-to-trunk/releases.py
tools/push-to-trunk/test_scripts.py

index 2156ec4..cb77337 100755 (executable)
@@ -39,6 +39,9 @@ MERGE_MESSAGE_RE = re.compile(r"^.*[M|m]erged (.+)(\)| into).*$", re.M)
 # new format).
 ROLLBACK_MESSAGE_RE = re.compile(r"^.*[R|r]ollback of (.+)(\)| in).*$", re.M)
 
+# Expression for retrieving the code review link.
+REVIEW_LINK_RE = re.compile(r"^Review URL: (.+)$", re.M)
+
 # Expression with three versions (historical) for extracting the v8 revision
 # from the chromium DEPS file.
 DEPS_RE = re.compile(r'^\s*(?:"v8_revision": "'
@@ -134,8 +137,7 @@ class RetrieveV8Releases(Step):
   def GetBleedingEdgeFromPush(self, title):
     return MatchSafe(PUSH_MESSAGE_RE.match(title))
 
-  def GetMergedPatches(self, git_hash):
-    body = self.GitLog(n=1, format="%B", git_hash=git_hash)
+  def GetMergedPatches(self, body):
     patches = MatchSafe(MERGE_MESSAGE_RE.search(body))
     if not patches:
       patches = MatchSafe(ROLLBACK_MESSAGE_RE.search(body))
@@ -148,16 +150,18 @@ class RetrieveV8Releases(Step):
     self.ReadAndPersistVersion()
     base_version = [self["major"], self["minor"], self["build"]]
     version = ".".join(base_version)
+    body = self.GitLog(n=1, format="%B", git_hash=git_hash)
 
     patches = ""
     if self["patch"] != "0":
       version += ".%s" % self["patch"]
-      patches = self.GetMergedPatches(git_hash)
+      patches = self.GetMergedPatches(body)
 
     title = self.GitLog(n=1, format="%s", git_hash=git_hash)
+    revision = self.GitSVNFindSVNRev(git_hash)
     return {
       # The SVN revision on the branch.
-      "revision": self.GitSVNFindSVNRev(git_hash),
+      "revision": revision,
       # The SVN revision on bleeding edge (only for newer trunk pushes).
       "bleeding_edge": self.GetBleedingEdgeFromPush(title),
       # The branch name.
@@ -168,6 +172,12 @@ class RetrieveV8Releases(Step):
       "patches_merged": patches,
       # Default for easier output formatting.
       "chromium_revision": "",
+      # 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)),
+      # Link to the commit message on google code.
+      "revision_link": ("https://code.google.com/p/v8/source/detail?r=%s"
+                        % revision),
     }, self["patch"]
 
   def GetReleasesFromBranch(self, branch):
index bce0dc4..28d67b8 100644 (file)
@@ -1187,7 +1187,8 @@ LOG=N
       Git("diff --name-only hash2 hash2^", TEST_CONFIG[VERSION_FILE]),
       Git("checkout -f hash2 -- %s" % TEST_CONFIG[VERSION_FILE], "",
           cb=ResetVersion(3, 1, 1)),
-      Git("log -1 --format=%B hash2", "Version 3.3.1.1 (merged 12)"),
+      Git("log -1 --format=%B hash2",
+          "Version 3.3.1.1 (merged 12)\n\nReview URL: fake.com\n"),
       Git("log -1 --format=%s hash2", ""),
       Git("svn find-rev hash2", "234"),
       Git("checkout -f HEAD -- %s" % TEST_CONFIG[VERSION_FILE], "",
@@ -1197,6 +1198,7 @@ LOG=N
       Git("diff --name-only hash3 hash3^", TEST_CONFIG[VERSION_FILE]),
       Git("checkout -f hash3 -- %s" % TEST_CONFIG[VERSION_FILE], "",
           cb=ResetVersion(21, 2)),
+      Git("log -1 --format=%B hash3", ""),
       Git("log -1 --format=%s hash3", ""),
       Git("svn find-rev hash3", "123"),
       Git("checkout -f HEAD -- %s" % TEST_CONFIG[VERSION_FILE], "",
@@ -1206,6 +1208,7 @@ LOG=N
       Git("diff --name-only hash6 hash6^", TEST_CONFIG[VERSION_FILE]),
       Git("checkout -f hash6 -- %s" % TEST_CONFIG[VERSION_FILE], "",
           cb=ResetVersion(22, 3)),
+      Git("log -1 --format=%B hash6", ""),
       Git("log -1 --format=%s hash6", ""),
       Git("svn find-rev hash6", "345"),
       Git("checkout -f HEAD -- %s" % TEST_CONFIG[VERSION_FILE], "",
@@ -1243,11 +1246,17 @@ LOG=N
 
     expected_json = [
       {"bleeding_edge": "", "patches_merged": "", "version": "3.22.3",
-       "chromium_revision": "4567", "branch": "trunk", "revision": "345"},
+       "chromium_revision": "4567", "branch": "trunk", "revision": "345",
+       "review_link": "",
+       "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"},
+       "chromium_revision": "", "branch": "3.21", "revision": "123",
+       "review_link": "",
+       "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"}
+       "chromium_revision": "", "branch": "3.3", "revision": "234",
+       "review_link": "fake.com",
+       "revision_link": "https://code.google.com/p/v8/source/detail?r=234"},
     ]
     self.assertEquals(expected_json, json.loads(FileToText(json_output)))