Revision: 22646
Author:   machenb...@chromium.org
Date:     Mon Jul 28 13:49:07 2014 UTC
Log:      Teach releases script to read bleeding_edge tags.

The command 'git svn log' does unfortunately not provide the tag-revision relation. We therefore use 'svn log' to retrieve it from the remote repository.

BUG=
R=ja...@chromium.org

Review URL: https://codereview.chromium.org/421553002
http://code.google.com/p/v8/source/detail?r=22646

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 Wed Jul 16 07:57:13 2014 UTC +++ /branches/bleeding_edge/tools/push-to-trunk/releases.py Mon Jul 28 13:49:07 2014 UTC
@@ -52,6 +52,11 @@
                       '|"http\:\/\/v8\.googlecode\.com\/svn\/trunk@)'
                       '([0-9]+)".*$', re.M)

+# Expression to pick tag and revision for bleeding edge tags. To be used with
+# output of 'svn log'.
+BLEEDING_EDGE_TAGS_RE = re.compile(
+    r"A \/tags\/([^\s]+) \(from \/branches\/bleeding_edge\:(\d+)\)")
+

 def SortBranches(branches):
   """Sort branches with version number names."""
@@ -140,24 +145,14 @@
         patches = "-%s" % patches
     return patches

-  def GetRelease(self, git_hash, branch):
-    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(body)
-
-    title = self.GitLog(n=1, format="%s", git_hash=git_hash)
+  def GetReleaseDict(
+ self, git_hash, bleeding_edge_rev, branch, version, patches, cl_body):
     revision = self.GitSVNFindSVNRev(git_hash)
     return {
       # The SVN revision on the branch.
       "revision": revision,
       # The SVN revision on bleeding edge (only for newer trunk pushes).
-      "bleeding_edge": self.GetBleedingEdgeFromPush(title),
+      "bleeding_edge": bleeding_edge_rev,
       # The branch name.
       "branch": branch,
       # The version for displaying in the form 3.26.3 or 3.26.3.12.
@@ -172,14 +167,45 @@
       "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)),
+      "review_link": MatchSafe(REVIEW_LINK_RE.search(cl_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 GetRelease(self, git_hash, branch):
+    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(body)
+
+    title = self.GitLog(n=1, format="%s", git_hash=git_hash)
+    return self.GetReleaseDict(
+        git_hash, self.GetBleedingEdgeFromPush(title), branch, version,
+        patches, body), self["patch"]
+
+  def GetReleasesFromBleedingEdge(self):
+ tag_text = self.SVN("log https://v8.googlecode.com/svn/tags -v --limit 20")
+    releases = []
+    for (tag, revision) in re.findall(BLEEDING_EDGE_TAGS_RE, tag_text):
+      git_hash = self.GitSVNFindGitHash(revision)
+
+      # Add bleeding edge release. It does not contain patches or a code
+      # review link, as tags are not uploaded.
+      releases.append(self.GetReleaseDict(
+        git_hash, revision, "bleeding_edge", tag, "", ""))
+    return releases

   def GetReleasesFromBranch(self, branch):
     self.GitReset("svn/%s" % branch)
+    if branch == 'bleeding_edge':
+      return self.GetReleasesFromBleedingEdge()
+
     releases = []
     try:
       for git_hash in self.GitLog(format="%H").splitlines():
@@ -225,14 +251,16 @@
       releases += self.GetReleasesFromBranch(stable)
       releases += self.GetReleasesFromBranch(beta)
       releases += self.GetReleasesFromBranch("trunk")
+      releases += self.GetReleasesFromBranch("bleeding_edge")
     elif self._options.branch == 'all':  # pragma: no cover
       # Retrieve the full release history.
       for branch in branches:
         releases += self.GetReleasesFromBranch(branch)
       releases += self.GetReleasesFromBranch("trunk")
+      releases += self.GetReleasesFromBranch("bleeding_edge")
     else:  # pragma: no cover
       # Retrieve history for a specified branch.
-      assert self._options.branch in branches + ["trunk"]
+      assert self._options.branch in branches + ["trunk", "bleeding_edge"]
       releases += self.GetReleasesFromBranch(self._options.branch)

     self["releases"] = sorted(releases,
=======================================
--- /branches/bleeding_edge/tools/push-to-trunk/test_scripts.py Thu Jul 24 07:36:25 2014 UTC +++ /branches/bleeding_edge/tools/push-to-trunk/test_scripts.py Mon Jul 28 13:49:07 2014 UTC
@@ -1167,6 +1167,33 @@
     MergeToBranch(TEST_CONFIG, self).Run(args)

   def testReleases(self):
+    tag_response_text = """
+------------------------------------------------------------------------
+r22631 | auth...@chromium.org | 2014-07-28 02:05:29 +0200 (Mon, 28 Jul 2014)
+Changed paths:
+   A /tags/3.28.43 (from /trunk:22630)
+
+Tagging version 3.28.43
+------------------------------------------------------------------------
+r22629 | auth...@chromium.org | 2014-07-26 05:09:29 +0200 (Sat, 26 Jul 2014)
+Changed paths:
+   A /tags/3.28.41 (from /branches/bleeding_edge:22626)
+
+Tagging version 3.28.41
+------------------------------------------------------------------------
+r22556 | auth...@chromium.org | 2014-07-23 13:31:59 +0200 (Wed, 23 Jul 2014)
+Changed paths:
+   A /tags/3.27.34.7 (from /branches/3.27:22555)
+
+Tagging version 3.27.34.7
+------------------------------------------------------------------------
+r22627 | auth...@chromium.org | 2014-07-26 01:39:15 +0200 (Sat, 26 Jul 2014)
+Changed paths:
+   A /tags/3.28.40 (from /branches/bleeding_edge:22624)
+
+Tagging version 3.28.40
+------------------------------------------------------------------------
+"""
     json_output = self.MakeEmptyTempFile()
     csv_output = self.MakeEmptyTempFile()
     TEST_CONFIG[VERSION_FILE] = self.MakeEmptyTempFile()
@@ -1230,6 +1257,15 @@
       Git("log -1 --format=%ci hash6", ""),
       Git("checkout -f HEAD -- %s" % TEST_CONFIG[VERSION_FILE], "",
           cb=ResetVersion(22, 5)),
+      Git("reset --hard svn/bleeding_edge", ""),
+      Git("log https://v8.googlecode.com/svn/tags -v --limit 20",
+          tag_response_text),
+      Git("svn find-rev r22626", "hash_22626"),
+      Git("svn find-rev hash_22626", "22626"),
+      Git("log -1 --format=%ci hash_22626", "01:23"),
+      Git("svn find-rev r22624", "hash_22624"),
+      Git("svn find-rev hash_22624", "22624"),
+      Git("log -1 --format=%ci hash_22624", "02:34"),
       Git("status -s -uno", ""),
       Git("checkout -f master", ""),
       Git("pull", ""),
@@ -1260,12 +1296,22 @@
     Releases(TEST_CONFIG, self).Run(args)

     # Check expected output.
-    csv = ("3.22.3,trunk,345,4567,\r\n"
+    csv = ("3.28.41,bleeding_edge,22626,,\r\n"
+           "3.28.40,bleeding_edge,22624,,\r\n"
+           "3.22.3,trunk,345,4567,\r\n"
            "3.21.2,3.21,123,,\r\n"
            "3.3.1.1,3.3,234,,12\r\n")
     self.assertEquals(csv, FileToText(csv_output))

     expected_json = [
+ {"bleeding_edge": "22626", "patches_merged": "", "version": "3.28.41",
+       "chromium_revision": "", "branch": "bleeding_edge", "revision": "22626",
+       "review_link": "", "date": "01:23", "chromium_branch": "",
+       "revision_link": "https://code.google.com/p/v8/source/detail?r=22626"},
+ {"bleeding_edge": "22624", "patches_merged": "", "version": "3.28.40",
+       "chromium_revision": "", "branch": "bleeding_edge", "revision": "22624",
+       "review_link": "", "date": "02:34", "chromium_branch": "",
+       "revision_link": "https://code.google.com/p/v8/source/detail?r=22624"},
       {"bleeding_edge": "", "patches_merged": "", "version": "3.22.3",
        "chromium_revision": "4567", "branch": "trunk", "revision": "345",
        "review_link": "", "date": "", "chromium_branch": "7",

--
--
v8-dev mailing list
v8-dev@googlegroups.com
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 v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to