Change auto-roll to auto-push for automatic trunk pushes.
authormachenbach@chromium.org <machenbach@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 24 Mar 2014 15:52:31 +0000 (15:52 +0000)
committermachenbach@chromium.org <machenbach@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 24 Mar 2014 15:52:31 +0000 (15:52 +0000)
The current script is only performing automatic pushes to trunk. This prepares for adding an auto-roll script that actually rolls to Chromium.

This also removes the v8-status updates, which are no longer necessary due to not touching bleeding edge any more.

BUG=
R=jarin@chromium.org

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

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

tools/push-to-trunk/auto_push.py [moved from tools/push-to-trunk/auto_roll.py with 79% similarity]
tools/push-to-trunk/test_scripts.py

similarity index 79%
rename from tools/push-to-trunk/auto_roll.py
rename to tools/push-to-trunk/auto_push.py
index 6ae24d3..9a43c3f 100755 (executable)
@@ -55,7 +55,7 @@ class Preparation(Step):
     self.CommonPrepare()
 
 
-class CheckAutoRollSettings(Step):
+class CheckAutoPushSettings(Step):
   MESSAGE = "Checking settings file."
 
   def RunStep(self):
@@ -114,47 +114,25 @@ class CheckLastPush(Step):
 class PushToTrunk(Step):
   MESSAGE = "Pushing to trunk if specified."
 
-  def PushTreeStatus(self, message):
-    if not self._options.status_password:
-      print "Skipping tree status update without password file."
-      return
-    params = {
-      "message": message,
-      "username": "v8-auto-roll@chromium.org",
-      "password": FileToText(self._options.status_password).strip(),
-    }
-    params = urllib.urlencode(params)
-    print "Pushing tree status: '%s'" % message
-    self.ReadURL("https://v8-status.appspot.com/status", params,
-                 wait_plan=[5, 20])
-
   def RunStep(self):
     print "Pushing lkgr %s to trunk." % self["lkgr"]
-    self.PushTreeStatus("Tree is closed (preparing to push)")
 
     # TODO(machenbach): Update the script before calling it.
-    try:
-      if self._options.push:
-        P = push_to_trunk.PushToTrunk
-        self._side_effect_handler.Call(
-            P(push_to_trunk.CONFIG, self._side_effect_handler).Run,
-            ["--author", self._options.author,
-             "--reviewer", self._options.reviewer,
-             "--revision", self["lkgr"],
-             "--force"])
-    finally:
-      self.PushTreeStatus(self["tree_message"])
-
-
-class AutoRoll(ScriptsBase):
+    if self._options.push:
+      P = push_to_trunk.PushToTrunk
+      self._side_effect_handler.Call(
+          P(push_to_trunk.CONFIG, self._side_effect_handler).Run,
+          ["--author", self._options.author,
+           "--reviewer", self._options.reviewer,
+           "--revision", self["lkgr"],
+           "--force"])
+
+
+class AutoPush(ScriptsBase):
   def _PrepareOptions(self, parser):
-    parser.add_argument("-c", "--chromium",
-                        help=("Deprecated."))
     parser.add_argument("-p", "--push",
                         help="Push to trunk. Dry run if unspecified.",
                         default=False, action="store_true")
-    parser.add_argument("--status-password",
-                        help="A file with the password to the status app.")
 
   def _ProcessOptions(self, options):
     if not options.author or not options.reviewer:  # pragma: no cover
@@ -166,7 +144,7 @@ class AutoRoll(ScriptsBase):
   def _Steps(self):
     return [
       Preparation,
-      CheckAutoRollSettings,
+      CheckAutoPushSettings,
       CheckTreeStatus,
       FetchLKGR,
       CheckLastPush,
@@ -175,4 +153,4 @@ class AutoRoll(ScriptsBase):
 
 
 if __name__ == "__main__":  # pragma: no cover
-  sys.exit(AutoRoll(CONFIG).Run())
+  sys.exit(AutoPush(CONFIG).Run())
index 8b2e1d9..9107db9 100644 (file)
@@ -31,9 +31,9 @@ import tempfile
 import traceback
 import unittest
 
-import auto_roll
-from auto_roll import CheckLastPush
-from auto_roll import SETTINGS_LOCATION
+import auto_push
+from auto_push import CheckLastPush
+from auto_push import SETTINGS_LOCATION
 import common_includes
 from common_includes import *
 import merge_to_branch
@@ -67,9 +67,8 @@ TEST_CONFIG = {
 }
 
 
-AUTO_ROLL_ARGS = [
+AUTO_PUSH_ARGS = [
   "-a", "author@chromium.org",
-  "-c", TEST_CONFIG[CHROMIUM],
   "-r", "reviewer@chromium.org",
 ]
 
@@ -840,13 +839,11 @@ Performance and stability improvements on all platforms.""", commit)
 
     self._state["lkgr"] = "101"
 
-    self.assertRaises(Exception, lambda: self.RunStep(auto_roll.AutoRoll,
+    self.assertRaises(Exception, lambda: self.RunStep(auto_push.AutoPush,
                                                       CheckLastPush,
-                                                      AUTO_ROLL_ARGS))
+                                                      AUTO_PUSH_ARGS))
 
-  def testAutoRoll(self):
-    password = self.MakeEmptyTempFile()
-    TextToFile("PW", password)
+  def testAutoPush(self):
     TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile()
     TEST_CONFIG[SETTINGS_LOCATION] = "~/.doesnotexist"
 
@@ -855,12 +852,6 @@ Performance and stability improvements on all platforms.""", commit)
           "{\"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/status",
-          ("username=v8-auto-roll%40chromium.org&"
-           "message=Tree+is+closed+%28preparing+to+push%29&password=PW"), ""),
-      URL("https://v8-status.appspot.com/status",
-          ("username=v8-auto-roll%40chromium.org&"
-           "message=Tree+is+throttled&password=PW"), ""),
     ])
 
     self.ExpectGit([
@@ -874,18 +865,17 @@ Performance and stability improvements on all platforms.""", commit)
           "Version 3.4.5 (based on bleeding_edge revision r79)\n"),
     ])
 
-    auto_roll.AutoRoll(TEST_CONFIG, self).Run(
-        AUTO_ROLL_ARGS + ["--status-password", password, "--push"])
+    auto_push.AutoPush(TEST_CONFIG, self).Run(AUTO_PUSH_ARGS + ["--push"])
 
     state = json.loads(FileToText("%s-state.json"
                                   % TEST_CONFIG[PERSISTFILE_BASENAME]))
 
     self.assertEquals("100", state["lkgr"])
 
-  def testAutoRollStoppedBySettings(self):
+  def testAutoPushStoppedBySettings(self):
     TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile()
     TEST_CONFIG[SETTINGS_LOCATION] = self.MakeEmptyTempFile()
-    TextToFile("{\"enable_auto_roll\": false}", TEST_CONFIG[SETTINGS_LOCATION])
+    TextToFile("{\"enable_auto_push\": false}", TEST_CONFIG[SETTINGS_LOCATION])
 
     self.ExpectReadURL([])
 
@@ -895,11 +885,11 @@ Performance and stability improvements on all platforms.""", commit)
       Git("svn fetch", ""),
     ])
 
-    def RunAutoRoll():
-      auto_roll.AutoRoll(TEST_CONFIG, self).Run(AUTO_ROLL_ARGS)
-    self.assertRaises(Exception, RunAutoRoll)
+    def RunAutoPush():
+      auto_push.AutoPush(TEST_CONFIG, self).Run(AUTO_PUSH_ARGS)
+    self.assertRaises(Exception, RunAutoPush)
 
-  def testAutoRollStoppedByTreeStatus(self):
+  def testAutoPushStoppedByTreeStatus(self):
     TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile()
     TEST_CONFIG[SETTINGS_LOCATION] = "~/.doesnotexist"
 
@@ -914,9 +904,9 @@ Performance and stability improvements on all platforms.""", commit)
       Git("svn fetch", ""),
     ])
 
-    def RunAutoRoll():
-      auto_roll.AutoRoll(TEST_CONFIG, self).Run(AUTO_ROLL_ARGS)
-    self.assertRaises(Exception, RunAutoRoll)
+    def RunAutoPush():
+      auto_push.AutoPush(TEST_CONFIG, self).Run(AUTO_PUSH_ARGS)
+    self.assertRaises(Exception, RunAutoPush)
 
   def testMergeToBranch(self):
     TEST_CONFIG[ALREADY_MERGING_SENTINEL_FILE] = self.MakeEmptyTempFile()