| 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 fc50afb32f00ac6de4ee1ef763837601e7b88804..f3b2a9e125773d5e31e4656242fe27a2957bacb7 100755
|
| --- a/tools/push-to-trunk/auto_roll.py
|
| +++ b/tools/push-to-trunk/auto_roll.py
|
| @@ -27,7 +27,7 @@
|
| # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
| import json
|
| -import optparse
|
| +import argparse
|
| import os
|
| import re
|
| import sys
|
| @@ -35,8 +35,6 @@ 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"
|
|
|
| @@ -47,16 +45,6 @@ CONFIG = {
|
| }
|
|
|
|
|
| -class AutoRollOptions(CommonOptions):
|
| - def __init__(self, options):
|
| - super(AutoRollOptions, self).__init__(options)
|
| - self.requires_editor = False
|
| - self.status_password = options.status_password
|
| - self.c = options.c
|
| - self.push = getattr(options, 'push', False)
|
| - self.author = getattr(options, 'a', None)
|
| -
|
| -
|
| class Preparation(Step):
|
| MESSAGE = "Preparation."
|
|
|
| @@ -151,12 +139,11 @@ class PushToTrunk(Step):
|
| try:
|
| if self._options.push:
|
| self._side_effect_handler.Call(
|
| - RunPushToTrunk,
|
| - push_to_trunk.CONFIG,
|
| - PushToTrunkOptions.MakeForcedOptions(self._options.author,
|
| - self._options.reviewer,
|
| - self._options.c),
|
| - self._side_effect_handler)
|
| + PushToTrunk(push_to_trunk.CONFIG, self._side_effect_handler).Run,
|
| + ["-a", self._options.author,
|
| + "-c", self._options.chromium,
|
| + "-r", self._options.reviewer,
|
| + "-f"])
|
| finally:
|
| self.PushTreeStatus(self["tree_message"])
|
| else:
|
| @@ -164,49 +151,35 @@ class PushToTrunk(Step):
|
| % (latest, lkgr))
|
|
|
|
|
| -def RunAutoRoll(config,
|
| - options,
|
| - side_effect_handler=DEFAULT_SIDE_EFFECT_HANDLER):
|
| - step_classes = [
|
| - Preparation,
|
| - CheckAutoRollSettings,
|
| - CheckTreeStatus,
|
| - FetchLatestRevision,
|
| - CheckLastPush,
|
| - FetchLKGR,
|
| - PushToTrunk,
|
| - ]
|
| - RunScript(step_classes, config, options, side_effect_handler)
|
| -
|
| -
|
| -def BuildOptions():
|
| - result = optparse.OptionParser()
|
| - result.add_option("-a", "--author", dest="a",
|
| - help=("Specify the author email used for rietveld."))
|
| - 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",
|
| - help=("Specify the account name to be used for reviews."))
|
| - result.add_option("-s", "--step", dest="s",
|
| - help="Specify the step where to start work. Default: 0.",
|
| - default=0, type="int")
|
| - result.add_option("--status-password",
|
| - help="A file with the password to the status app.")
|
| - return result
|
| -
|
| -
|
| -def Main():
|
| - parser = BuildOptions()
|
| - (options, args) = parser.parse_args()
|
| - if not options.a or not options.c or not options.reviewer:
|
| - print "You need to specify author, chromium src location and reviewer."
|
| - parser.print_help()
|
| - return 1
|
| - RunAutoRoll(CONFIG, AutoRollOptions(options))
|
| +class AutoRoll(ScriptsBase):
|
| + def _PrepareOptions(self, parser):
|
| + parser.add_argument("-c", "--chromium", required=True,
|
| + help=("The path to your Chromium src/ "
|
| + "directory to automate the V8 roll."))
|
| + 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:
|
| + print "You need to specify author and reviewer."
|
| + return False
|
| + options.requires_editor = False
|
| + return True
|
| +
|
| + def _Steps(self):
|
| + return [
|
| + Preparation,
|
| + CheckAutoRollSettings,
|
| + CheckTreeStatus,
|
| + FetchLatestRevision,
|
| + CheckLastPush,
|
| + FetchLKGR,
|
| + PushToTrunk,
|
| + ]
|
| +
|
|
|
| if __name__ == "__main__":
|
| - sys.exit(Main())
|
| + sys.exit(AutoRoll(CONFIG).Run())
|
|
|