Activate calling push-to-trunk in auto-roll script.
- Call push-to-trunk through python not through the shell - Restore tree state on script errors - Mock out python call in unit tests - The actual call stays behind a flag BUG= R=ulan@chromium.org Review URL: https://codereview.chromium.org/141633003 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@18664 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
e9f957ce2c
commit
780ae3146a
@ -34,6 +34,9 @@ import sys
|
||||
import urllib
|
||||
|
||||
from common_includes import *
|
||||
import push_to_trunk
|
||||
from push_to_trunk import PushToTrunkOptions
|
||||
from push_to_trunk import RunPushToTrunk
|
||||
|
||||
SETTINGS_LOCATION = "SETTINGS_LOCATION"
|
||||
|
||||
@ -49,6 +52,9 @@ class AutoRollOptions(CommonOptions):
|
||||
super(AutoRollOptions, self).__init__(options)
|
||||
self.requires_editor = False
|
||||
self.status_password = options.status_password
|
||||
self.r = options.r
|
||||
self.c = options.c
|
||||
self.push = getattr(options, 'push', False)
|
||||
|
||||
|
||||
class Preparation(Step):
|
||||
@ -150,10 +156,16 @@ class PushToTrunk(Step):
|
||||
|
||||
# TODO(machenbach): Call push to trunk script.
|
||||
# TODO(machenbach): Update the script before calling it.
|
||||
# self._side_effect_handler.Command(
|
||||
# "tools/push-to-trunk/push-to-trunk.py",
|
||||
# "-f -c %s -r %s" % (self._options.c, self._options.r))
|
||||
self.PushTreeStatus(self._state["tree_message"])
|
||||
try:
|
||||
if self._options.push:
|
||||
self._side_effect_handler.Call(
|
||||
RunPushToTrunk,
|
||||
push_to_trunk.CONFIG,
|
||||
PushToTrunkOptions.MakeForcedOptions(self._options.r,
|
||||
self._options.c),
|
||||
self._side_effect_handler)
|
||||
finally:
|
||||
self.PushTreeStatus(self._state["tree_message"])
|
||||
else:
|
||||
print("ToT (r%d) is ahead of the LKGR (r%d). Skipping push to trunk."
|
||||
% (latest, lkgr))
|
||||
@ -179,6 +191,9 @@ def BuildOptions():
|
||||
result.add_option("-c", "--chromium", dest="c",
|
||||
help=("Specify the path to your Chromium src/ "
|
||||
"directory to automate the V8 roll."))
|
||||
result.add_option("-p", "--push",
|
||||
help="Push to trunk if possible. Dry run if unspecified.",
|
||||
default=False, action="store_true")
|
||||
result.add_option("-r", "--reviewer", dest="r",
|
||||
help=("Specify the account name to be used for reviews."))
|
||||
result.add_option("-s", "--step", dest="s",
|
||||
|
@ -189,6 +189,9 @@ def Command(cmd, args="", prefix="", pipe=True):
|
||||
|
||||
# Wrapper for side effects.
|
||||
class SideEffectHandler(object):
|
||||
def Call(self, fun, *args, **kwargs):
|
||||
return fun(*args, **kwargs)
|
||||
|
||||
def Command(self, cmd, args="", prefix="", pipe=True):
|
||||
return Command(cmd, args, prefix, pipe)
|
||||
|
||||
|
@ -53,6 +53,20 @@ CONFIG = {
|
||||
|
||||
|
||||
class PushToTrunkOptions(CommonOptions):
|
||||
@staticmethod
|
||||
def MakeForcedOptions(reviewer, chrome_path):
|
||||
"""Convenience wrapper."""
|
||||
class Options(object):
|
||||
pass
|
||||
options = Options()
|
||||
options.s = 0
|
||||
options.l = None
|
||||
options.f = True
|
||||
options.m = False
|
||||
options.r = reviewer
|
||||
options.c = chrome_path
|
||||
return PushToTrunkOptions(options)
|
||||
|
||||
def __init__(self, options):
|
||||
super(PushToTrunkOptions, self).__init__(options, options.m)
|
||||
self.requires_editor = not options.f
|
||||
|
@ -300,6 +300,9 @@ class ScriptTest(unittest.TestCase):
|
||||
"vi": LogMock,
|
||||
}
|
||||
|
||||
def Call(self, fun, *args, **kwargs):
|
||||
print "Calling %s with %s and %s" % (str(fun), str(args), str(kwargs))
|
||||
|
||||
def Command(self, cmd, args="", prefix="", pipe=True):
|
||||
return ScriptTest.MOCKS[cmd](self, cmd, args)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user