Revision: 25033
Author:   [email protected]
Date:     Fri Oct 31 13:14:58 2014 UTC
Log:      Switch auto push script to git.

BUG=410721
LOG=n
TEST=script_test.py
[email protected]

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

Modified:
 /branches/bleeding_edge/tools/push-to-trunk/auto_push.py
 /branches/bleeding_edge/tools/push-to-trunk/test_scripts.py

=======================================
--- /branches/bleeding_edge/tools/push-to-trunk/auto_push.py Tue Sep 23 14:41:36 2014 UTC +++ /branches/bleeding_edge/tools/push-to-trunk/auto_push.py Fri Oct 31 13:14:58 2014 UTC
@@ -36,7 +36,7 @@
 from common_includes import *
 import push_to_trunk

-PUSH_MESSAGE_RE = re.compile(r".* \(based on bleeding_edge revision r(\d+)\)$")
+PUSH_MESSAGE_RE = re.compile(r".* \(based on ([a-fA-F0-9]+)\)$")

 class Preparation(Step):
   MESSAGE = "Preparation."
@@ -94,19 +94,16 @@
self.Die("Could not retrieve bleeding edge revision for trunk push %s"
                % last_push)

-    # TODO(machenbach): This metric counts all revisions. It could be
-    # improved by counting only the revisions on bleeding_edge.
-    if int(self["lkgr"]) - int(last_push_be) < 10:  # pragma: no cover
- # This makes sure the script doesn't push twice in a row when the cron
-      # job retries several times.
-      self.Die("Last push too recently: %s" % last_push_be)
+    if self["lkgr"] == last_push_be:
+      print "Already pushed current lkgr %s" % last_push_be
+      return True


-class PushToTrunk(Step):
-  MESSAGE = "Pushing to trunk if specified."
+class PushToCandidates(Step):
+  MESSAGE = "Pushing to candidates if specified."

   def RunStep(self):
-    print "Pushing lkgr %s to trunk." % self["lkgr"]
+    print "Pushing lkgr %s to candidates." % self["lkgr"]

     # TODO(machenbach): Update the script before calling it.
     if self._options.push:
@@ -144,7 +141,7 @@
       CheckTreeStatus,
       FetchLKGR,
       CheckLastPush,
-      PushToTrunk,
+      PushToCandidates,
     ]


=======================================
--- /branches/bleeding_edge/tools/push-to-trunk/test_scripts.py Wed Oct 29 14:58:03 2014 UTC +++ /branches/bleeding_edge/tools/push-to-trunk/test_scripts.py Fri Oct 31 13:14:58 2014 UTC
@@ -930,14 +930,12 @@
            "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]* (based\" "
            "origin/candidates"), "hash2\n"),
       Cmd("git log -1 --format=%s hash2",
-          "Version 3.4.5 (based on bleeding_edge revision r99)\n"),
+          "Version 3.4.5 (based on abc123)\n"),
     ])

-    self._state["lkgr"] = "101"
-
-    self.assertRaises(Exception, lambda: self.RunStep(auto_push.AutoPush,
-                                                      CheckLastPush,
-                                                      AUTO_PUSH_ARGS))
+    self._state["lkgr"] = "abc123"
+    self.assertEquals(0, self.RunStep(
+        auto_push.AutoPush, CheckLastPush, AUTO_PUSH_ARGS))

   def testAutoPush(self):
     TextToFile("", os.path.join(TEST_CONFIG["DEFAULT_CWD"], ".git"))
@@ -951,12 +949,12 @@
       URL("https://v8-status.appspot.com/current?format=json";,
           "{\"message\": \"Tree is throttled\"}"),
URL("https://v8-status.appspot.com/lkgr";, Exception("Network problem")),
-      URL("https://v8-status.appspot.com/lkgr";, "100"),
+      URL("https://v8-status.appspot.com/lkgr";, "abc123"),
       Cmd(("git log -1 --format=%H --grep=\""
            "^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]* (based\""
            " origin/candidates"), "push_hash\n"),
       Cmd("git log -1 --format=%s push_hash",
-          "Version 3.4.5 (based on bleeding_edge revision r79)\n"),
+          "Version 3.4.5 (based on abc101)\n"),
     ])

     auto_push.AutoPush(TEST_CONFIG, self).Run(AUTO_PUSH_ARGS + ["--push"])
@@ -964,7 +962,7 @@
     state = json.loads(FileToText("%s-state.json"
                                   % TEST_CONFIG["PERSISTFILE_BASENAME"]))

-    self.assertEquals("100", state["lkgr"])
+    self.assertEquals("abc123", state["lkgr"])

   def testAutoPushStoppedBySettings(self):
     TextToFile("", os.path.join(TEST_CONFIG["DEFAULT_CWD"], ".git"))

--
--
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