Revision: 23672
Author:   [email protected]
Date:     Thu Sep  4 08:42:21 2014 UTC
Log:      Make auto_roll run with a pure git checkout.

BUG=410721
LOG=n
[email protected]

Review URL: https://codereview.chromium.org/540513002
https://code.google.com/p/v8/source/detail?r=23672

Modified:
 /branches/bleeding_edge/tools/push-to-trunk/auto_roll.py
 /branches/bleeding_edge/tools/push-to-trunk/chromium_roll.py
 /branches/bleeding_edge/tools/push-to-trunk/common_includes.py
 /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/auto_roll.py Wed Sep 3 08:29:53 2014 UTC +++ /branches/bleeding_edge/tools/push-to-trunk/auto_roll.py Thu Sep 4 08:42:21 2014 UTC
@@ -50,8 +50,9 @@
   MESSAGE = "Detect commit ID of the last push to trunk."

   def RunStep(self):
-    push_hash = self.FindLastTrunkPush(include_patches=True)
-    self["last_push"] = self.GitSVNFindSVNRev(push_hash)
+    push_hash = self.FindLastTrunkPush(
+        branch="origin/master", include_patches=True)
+    self["last_push"] = self.GetCommitPositionNumber(push_hash)


 class DetectLastRoll(Step):
@@ -62,7 +63,9 @@
     Var = lambda var: '%s'
     exec(self.ReadURL(CR_DEPS_URL))
     last_roll = vars['v8_revision']
-    if last_roll >= self["last_push"]:
+ # FIXME(machenbach): When rolling from bleeding edge and from trunk there
+    # be different commit numbers here. Better use version?
+    if int(last_roll) >= int(self["last_push"]):
       print("There is no newer v8 revision than the one in Chromium (%s)."
             % last_roll)
       return True
=======================================
--- /branches/bleeding_edge/tools/push-to-trunk/chromium_roll.py Wed Sep 3 11:59:43 2014 UTC +++ /branches/bleeding_edge/tools/push-to-trunk/chromium_roll.py Thu Sep 4 08:42:21 2014 UTC
@@ -23,7 +23,8 @@
   MESSAGE = "Preparation."

   def RunStep(self):
-    self.CommonPrepare()
+    # Update v8 remote tracking branches.
+    self.GitFetchOrigin()


 class DetectLastPush(Step):
@@ -31,8 +32,8 @@

   def RunStep(self):
     self["last_push"] = self._options.last_push or self.FindLastTrunkPush(
-        include_patches=True)
-    self["trunk_revision"] = self.GitSVNFindSVNRev(self["last_push"])
+        branch="origin/master", include_patches=True)
+ self["trunk_revision"] = self.GetCommitPositionNumber(self["last_push"])
     self["push_title"] = self.GitLog(n=1, format="%s",
                                      git_hash=self["last_push"])

=======================================
--- /branches/bleeding_edge/tools/push-to-trunk/common_includes.py Wed Sep 3 14:38:28 2014 UTC +++ /branches/bleeding_edge/tools/push-to-trunk/common_includes.py Thu Sep 4 08:42:21 2014 UTC
@@ -471,13 +471,14 @@
     except GitFailedException:
       self.WaitForResolvingConflicts(patch_file)

-  def FindLastTrunkPush(self, parent_hash="", include_patches=False):
+  def FindLastTrunkPush(
+      self, parent_hash="", branch="", include_patches=False):
     push_pattern = "^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*"
     if not include_patches:
# Non-patched versions only have three numbers followed by the "(based
       # on...) comment."
       push_pattern += " (based"
-    branch = "" if parent_hash else "svn/trunk"
+    branch = "" if parent_hash else branch or "svn/trunk"
     return self.GitLog(n=1, format="%H", grep=push_pattern,
                        parent_hash=parent_hash, branch=branch)

=======================================
--- /branches/bleeding_edge/tools/push-to-trunk/git_recipes.py Wed Sep 3 11:59:43 2014 UTC +++ /branches/bleeding_edge/tools/push-to-trunk/git_recipes.py Thu Sep 4 08:42:21 2014 UTC
@@ -29,7 +29,49 @@
 import re

 SHA1_RE = re.compile('^[a-fA-F0-9]{40}$')
-GIT_SVN_ID_RE = re.compile('^git-svn-id: .*@([0-9]+) .*$')
+ROLL_DEPS_GIT_SVN_ID_RE = re.compile('^git-svn-id: .*@([0-9]+) .*$')
+
+# Regular expression that matches a single commit footer line.
+COMMIT_FOOTER_ENTRY_RE = re.compile(r'([^:]+):\s+(.+)')
+
+# Footer metadata key for commit position.
+COMMIT_POSITION_FOOTER_KEY = 'Cr-Commit-Position'
+
+# Regular expression to parse a commit position
+COMMIT_POSITION_RE = re.compile(r'(.+)@\{#(\d+)\}')
+
+# Key for the 'git-svn' ID metadata commit footer entry.
+GIT_SVN_ID_FOOTER_KEY = 'git-svn-id'
+
+# e.g., git-svn-id: https://v8.googlecode.com/svn/trunk@23117
+#     ce2b1a6d-e550-0410-aec6-3dcde31c8c00
+GIT_SVN_ID_RE = re.compile(r'((?:\w+)://[^@]+)@(\d+)\s+(?:[a-zA-Z0-9\-]+)')
+
+
+# Copied from bot_update.py.
+def GetCommitMessageFooterMap(message):
+  """Returns: (dict) A dictionary of commit message footer entries.
+  """
+  footers = {}
+
+  # Extract the lines in the footer block.
+  lines = []
+  for line in message.strip().splitlines():
+    line = line.strip()
+    if len(line) == 0:
+      del(lines[:])
+      continue
+    lines.append(line)
+
+  # Parse the footer
+  for line in lines:
+    m = COMMIT_FOOTER_ENTRY_RE.match(line)
+    if not m:
+      # If any single line isn't valid, the entire footer is invalid.
+      footers.clear()
+      return footers
+    footers[m.group(1)] = m.group(2).strip()
+  return footers


 class GitFailedException(Exception):
@@ -199,11 +241,42 @@
       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())
+      match = ROLL_DEPS_GIT_SVN_ID_RE.match(line.strip())
       if match:
         return match.group(1)
     raise GitFailedException("Couldn't convert %s to SVN." % git_hash)

+  @Strip
+  # Copied from bot_update.py and modified for svn-like numbers only.
+  def GetCommitPositionNumber(self, git_hash):
+ """Dumps the 'git' log for a specific revision and parses out the commit
+    position number.
+
+ If a commit position metadata key is found, its number will be returned.
+
+ Otherwise, we will search for a 'git-svn' metadata entry. If one is found,
+    its SVN revision value is returned.
+    """
+    git_log = self.GitLog(format='%B', n=1, git_hash=git_hash)
+    footer_map = GetCommitMessageFooterMap(git_log)
+
+    # Search for commit position metadata
+    value = footer_map.get(COMMIT_POSITION_FOOTER_KEY)
+    if value:
+      match = COMMIT_POSITION_RE.match(value)
+      if match:
+        return match.group(2)
+
+    # Extract the svn revision from 'git-svn' metadata
+    value = footer_map.get(GIT_SVN_ID_FOOTER_KEY)
+    if value:
+      match = GIT_SVN_ID_RE.match(value)
+      if match:
+        return match.group(2)
+    return None
+
+  ### Git svn stuff
+
   def GitSVNFetch(self):
     self.Git("svn fetch")

=======================================
--- /branches/bleeding_edge/tools/push-to-trunk/releases.py Mon Aug 25 13:39:43 2014 UTC +++ /branches/bleeding_edge/tools/push-to-trunk/releases.py Thu Sep 4 08:42:21 2014 UTC
@@ -57,77 +57,6 @@
 BLEEDING_EDGE_TAGS_RE = re.compile(
     r"A \/tags\/([^\s]+) \(from \/branches\/bleeding_edge\:(\d+)\)")

-# Regular expression that matches a single commit footer line.
-COMMIT_FOOTER_ENTRY_RE = re.compile(r'([^:]+):\s+(.+)')
-
-# Footer metadata key for commit position.
-COMMIT_POSITION_FOOTER_KEY = 'Cr-Commit-Position'
-
-# Regular expression to parse a commit position
-COMMIT_POSITION_RE = re.compile(r'(.+)@\{#(\d+)\}')
-
-# Key for the 'git-svn' ID metadata commit footer entry.
-GIT_SVN_ID_FOOTER_KEY = 'git-svn-id'
-
-# e.g., git-svn-id: https://v8.googlecode.com/svn/trunk@23117
-#     ce2b1a6d-e550-0410-aec6-3dcde31c8c00
-GIT_SVN_ID_RE = re.compile(r'((?:\w+)://[^@]+)@(\d+)\s+(?:[a-zA-Z0-9\-]+)')
-
-
-# Copied from bot_update.py.
-def GetCommitMessageFooterMap(message):
-  """Returns: (dict) A dictionary of commit message footer entries.
-  """
-  footers = {}
-
-  # Extract the lines in the footer block.
-  lines = []
-  for line in message.strip().splitlines():
-    line = line.strip()
-    if len(line) == 0:
-      del(lines[:])
-      continue
-    lines.append(line)
-
-  # Parse the footer
-  for line in lines:
-    m = COMMIT_FOOTER_ENTRY_RE.match(line)
-    if not m:
-      # If any single line isn't valid, the entire footer is invalid.
-      footers.clear()
-      return footers
-    footers[m.group(1)] = m.group(2).strip()
-  return footers
-
-
-# Copied from bot_update.py and modified for svn-like numbers only.
-def GetCommitPositionNumber(step, git_hash):
-  """Dumps the 'git' log for a specific revision and parses out the commit
-  position number.
-
-  If a commit position metadata key is found, its number will be returned.
-
- Otherwise, we will search for a 'git-svn' metadata entry. If one is found,
-  its SVN revision value is returned.
-  """
-  git_log = step.GitLog(format='%B', n=1, git_hash=git_hash)
-  footer_map = GetCommitMessageFooterMap(git_log)
-
-  # Search for commit position metadata
-  value = footer_map.get(COMMIT_POSITION_FOOTER_KEY)
-  if value:
-    match = COMMIT_POSITION_RE.match(value)
-    if match:
-      return match.group(2)
-
-  # Extract the svn revision from 'git-svn' metadata
-  value = footer_map.get(GIT_SVN_ID_FOOTER_KEY)
-  if value:
-    match = GIT_SVN_ID_RE.match(value)
-    if match:
-      return match.group(2)
-  return None
-

 def SortBranches(branches):
   """Sort branches with version number names."""
@@ -419,7 +348,7 @@
         deps = FileToText(self.Config(DEPS_FILE))
         match = DEPS_RE.search(deps)
         if match:
-          cr_rev = GetCommitPositionNumber(self, git_hash)
+          cr_rev = self.GetCommitPositionNumber(git_hash)
           if cr_rev:
             v8_rev = ConvertToCommitNumber(self, match.group(1))
             cr_releases.append([cr_rev, v8_rev])
=======================================
--- /branches/bleeding_edge/tools/push-to-trunk/test_scripts.py Wed Sep 3 11:59:43 2014 UTC +++ /branches/bleeding_edge/tools/push-to-trunk/test_scripts.py Thu Sep 4 08:42:21 2014 UTC
@@ -800,6 +800,18 @@
   def testPushToTrunkForced(self):
     self._PushToTrunk(force=True)

+  C_V8_22624_LOG = """V8 CL.
+
+git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22624 123
+
+"""
+
+  C_V8_123456_LOG = """V8 CL.
+
+git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@123456 123
+
+"""
+
   def testChromiumRoll(self):
googlers_mapping_py = "%s-mapping.py" % TEST_CONFIG[PERSISTFILE_BASENAME]
     with open(googlers_mapping_py, "w") as f:
@@ -817,19 +829,17 @@
     TextToFile("Some line\n   \"v8_revision\": \"123444\",\n  some line",
                TEST_CONFIG[DEPS_FILE])
     def WriteDeps():
-      TextToFile("Some line\n   \"v8_revision\": \"123455\",\n  some line",
+      TextToFile("Some line\n   \"v8_revision\": \"22624\",\n  some line",
                  TEST_CONFIG[DEPS_FILE])

     expectations = [
-      Cmd("git status -s -uno", ""),
-      Cmd("git status -s -b -uno", "## some_branch\n"),
-      Cmd("git svn fetch", ""),
+      Cmd("git fetch origin", ""),
       Cmd(("git log -1 --format=%H --grep="
            "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*\" "
-           "svn/trunk"), "push_hash\n"),
-      Cmd("git svn find-rev push_hash", "123455\n"),
+           "origin/master"), "push_hash\n"),
+      Cmd("git log -1 --format=%B push_hash", self.C_V8_22624_LOG),
       Cmd("git log -1 --format=%s push_hash",
-          "Version 3.22.5 (based on bleeding_edge revision r123454)\n"),
+          "Version 3.22.5 (based on bleeding_edge revision r22622)\n"),
       URL("https://chromium-build.appspot.com/p/chromium/sheriff_v8.js";,
           "document.write('g_name')"),
       Cmd("git status -s -uno", ""),
@@ -837,10 +847,10 @@
       Cmd("gclient sync --nohooks", "syncing..."),
       Cmd("git pull", ""),
       Cmd("git fetch origin", ""),
-      Cmd("git checkout -b v8-roll-123455", ""),
-      Cmd("roll-dep v8 123455", "rolled", cb=WriteDeps),
+      Cmd("git checkout -b v8-roll-22624", ""),
+      Cmd("roll-dep v8 22624", "rolled", cb=WriteDeps),
       Cmd(("git commit -am \"Update V8 to version 3.22.5 "
-           "(based on bleeding_edge revision r123454).\n\n"
+           "(based on bleeding_edge revision r22622).\n\n"
            "Please reply to the V8 sheriff [email protected] in "
            "case of problems.\n\[email protected]\" "
            "--author \"[email protected] <[email protected]>\""),
@@ -855,7 +865,7 @@
     ChromiumRoll(TEST_CONFIG, self).Run(args)

     deps = FileToText(TEST_CONFIG[DEPS_FILE])
-    self.assertTrue(re.search("\"v8_revision\": \"123455\"", deps))
+    self.assertTrue(re.search("\"v8_revision\": \"22624\"", deps))

   def testCheckLastPushRecently(self):
     self.Expect([
@@ -960,8 +970,8 @@
           ("{\"results\": [{\"subject\": \"different\"}]}")),
       Cmd(("git log -1 --format=%H --grep="
            "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*\" "
-           "svn/trunk"), "push_hash\n"),
-      Cmd("git svn find-rev push_hash", "123455\n"),
+           "origin/master"), "push_hash\n"),
+      Cmd("git log -1 --format=%B push_hash", self.C_V8_22624_LOG),
       URL("http://src.chromium.org/svn/trunk/src/DEPS";,
           self.FAKE_DEPS),
     ])
@@ -980,8 +990,8 @@
           ("{\"results\": [{\"subject\": \"different\"}]}")),
       Cmd(("git log -1 --format=%H --grep="
            "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*\" "
-           "svn/trunk"), "push_hash\n"),
-      Cmd("git svn find-rev push_hash", "123456\n"),
+           "origin/master"), "push_hash\n"),
+      Cmd("git log -1 --format=%B push_hash", self.C_V8_123456_LOG),
       URL("http://src.chromium.org/svn/trunk/src/DEPS";,
           self.FAKE_DEPS),
     ])
@@ -1169,11 +1179,6 @@

 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()
@@ -1263,7 +1268,7 @@
       Cmd("git rev-list -n 1 0123456789012345678901234567890123456789",
           "0123456789012345678901234567890123456789"),
Cmd("git log -1 --format=%B 0123456789012345678901234567890123456789",
-          c_v8_22624_log),
+          self.C_V8_22624_LOG),
       Cmd("git diff --name-only c_hash3 c_hash3^", TEST_CONFIG[DEPS_FILE]),
       Cmd("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.

Reply via email to