| Index: tools/push-to-trunk/auto_roll.py
|
| diff --git a/tools/push-to-trunk/auto_roll.py b/tools/push-to-trunk/auto_roll.py
|
| index 9547301184b9f438f71dbaaa775b245a366be8ba..cb990cdb173723fb1e660ae327f7a6f57514a05b 100755
|
| --- a/tools/push-to-trunk/auto_roll.py
|
| +++ b/tools/push-to-trunk/auto_roll.py
|
| @@ -29,7 +29,6 @@
|
| import optparse
|
| import re
|
| import sys
|
| -import urllib2
|
|
|
| from common_includes import *
|
|
|
| @@ -40,8 +39,7 @@ CONFIG = {
|
|
|
|
|
| class Preparation(Step):
|
| - def __init__(self):
|
| - Step.__init__(self, "Preparation.")
|
| + MESSAGE = "Preparation."
|
|
|
| def RunStep(self):
|
| self.InitialEnvironmentChecks()
|
| @@ -49,8 +47,7 @@ class Preparation(Step):
|
|
|
|
|
| class FetchLatestRevision(Step):
|
| - def __init__(self):
|
| - Step.__init__(self, "Fetching latest V8 revision.")
|
| + MESSAGE = "Fetching latest V8 revision."
|
|
|
| def RunStep(self):
|
| log = self.Git("svn log -1 --oneline").strip()
|
| @@ -61,25 +58,15 @@ class FetchLatestRevision(Step):
|
|
|
|
|
| class FetchLKGR(Step):
|
| - def __init__(self):
|
| - Step.__init__(self, "Fetching V8 LKGR.")
|
| + MESSAGE = "Fetching V8 LKGR."
|
|
|
| def RunStep(self):
|
| lkgr_url = "https://v8-status.appspot.com/lkgr"
|
| - try:
|
| - # pylint: disable=E1121
|
| - url_fh = urllib2.urlopen(lkgr_url, None, 60)
|
| - except urllib2.URLError:
|
| - self.Die("URLException while fetching %s" % lkgr_url)
|
| - try:
|
| - self.Persist("lkgr", url_fh.read())
|
| - finally:
|
| - url_fh.close()
|
| + self.Persist("lkgr", self.ReadURL(lkgr_url))
|
|
|
|
|
| class PushToTrunk(Step):
|
| - def __init__(self):
|
| - Step.__init__(self, "Pushing to trunk if possible.")
|
| + MESSAGE = "Pushing to trunk if possible."
|
|
|
| def RunStep(self):
|
| self.RestoreIfUnset("latest")
|
| @@ -94,6 +81,18 @@ class PushToTrunk(Step):
|
| % (latest, lkgr))
|
|
|
|
|
| +def RunAutoRoll(config,
|
| + options,
|
| + side_effect_handler=DEFAULT_SIDE_EFFECT_HANDLER):
|
| + step_classes = [
|
| + Preparation,
|
| + FetchLatestRevision,
|
| + FetchLKGR,
|
| + PushToTrunk,
|
| + ]
|
| + RunScript(step_classes, config, options, side_effect_handler)
|
| +
|
| +
|
| def BuildOptions():
|
| result = optparse.OptionParser()
|
| result.add_option("-s", "--step", dest="s",
|
| @@ -105,15 +104,7 @@ def BuildOptions():
|
| def Main():
|
| parser = BuildOptions()
|
| (options, args) = parser.parse_args()
|
| -
|
| - step_classes = [
|
| - Preparation,
|
| - FetchLatestRevision,
|
| - FetchLKGR,
|
| - PushToTrunk,
|
| - ]
|
| -
|
| - RunScript(step_classes, CONFIG, options, DEFAULT_SIDE_EFFECT_HANDLER)
|
| + RunAutoRoll(CONFIG, options)
|
|
|
| if __name__ == "__main__":
|
| sys.exit(Main())
|
|
|