self.CommonPrepare()
-class CheckAutoRollSettings(Step):
+class CheckAutoPushSettings(Step):
MESSAGE = "Checking settings file."
def RunStep(self):
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
def _Steps(self):
return [
Preparation,
- CheckAutoRollSettings,
+ CheckAutoPushSettings,
CheckTreeStatus,
FetchLKGR,
CheckLastPush,
if __name__ == "__main__": # pragma: no cover
- sys.exit(AutoRoll(CONFIG).Run())
+ sys.exit(AutoPush(CONFIG).Run())
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
}
-AUTO_ROLL_ARGS = [
+AUTO_PUSH_ARGS = [
"-a", "author@chromium.org",
- "-c", TEST_CONFIG[CHROMIUM],
"-r", "reviewer@chromium.org",
]
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"
"{\"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([
"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([])
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"
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()