Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Unified Diff: tools/push-to-trunk/auto_roll.py

Issue 185653004: Experimental parser: merge to r19637 (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/merge-to-branch.sh ('k') | tools/push-to-trunk/common_includes.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ac2067c61ecc96111e07e002fdaefd9c29cf96be..e90102d64ca0dae90d10c746d2774a5755057588 100755
--- a/tools/push-to-trunk/auto_roll.py
+++ b/tools/push-to-trunk/auto_roll.py
@@ -26,8 +26,8 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+import argparse
import json
-import optparse
import os
import re
import sys
@@ -52,9 +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.chromium = options.chromium
self.push = getattr(options, 'push', False)
+ self.author = getattr(options, 'author', None)
class Preparation(Step):
@@ -83,39 +83,35 @@ class CheckTreeStatus(Step):
def RunStep(self):
status_url = "https://v8-status.appspot.com/current?format=json"
status_json = self.ReadURL(status_url, wait_plan=[5, 20, 300, 300])
- message = json.loads(status_json)["message"]
- if re.search(r"nopush|no push", message, flags=re.I):
- self.Die("Push to trunk disabled by tree state: %s" % message)
- self.Persist("tree_message", message)
+ self["tree_message"] = json.loads(status_json)["message"]
+ if re.search(r"nopush|no push", self["tree_message"], flags=re.I):
+ self.Die("Push to trunk disabled by tree state: %s"
+ % self["tree_message"])
class FetchLatestRevision(Step):
MESSAGE = "Fetching latest V8 revision."
def RunStep(self):
- log = self.Git("svn log -1 --oneline").strip()
- match = re.match(r"^r(\d+) ", log)
+ match = re.match(r"^r(\d+) ", self.GitSVNLog())
if not match:
self.Die("Could not extract current svn revision from log.")
- self.Persist("latest", match.group(1))
+ self["latest"] = match.group(1)
class CheckLastPush(Step):
MESSAGE = "Checking last V8 push to trunk."
def RunStep(self):
- self.RestoreIfUnset("latest")
- log = self.Git("svn log -1 --oneline ChangeLog").strip()
- match = re.match(r"^r(\d+) \| Prepare push to trunk", log)
- if match:
- latest = int(self._state["latest"])
- last_push = int(match.group(1))
- # TODO(machebach): This metric counts all revisions. It could be
- # improved by counting only the revisions on bleeding_edge.
- if latest - last_push < 10:
- # This makes sure the script doesn't push twice in a row when the cron
- # job retries several times.
- self.Die("Last push too recently: %d" % last_push)
+ last_push_hash = self.FindLastTrunkPush()
+ last_push = int(self.GitSVNFindSVNRev(last_push_hash))
+
+ # TODO(machenbach): This metric counts all revisions. It could be
+ # improved by counting only the revisions on bleeding_edge.
+ if int(self["latest"]) - last_push < 10:
+ # This makes sure the script doesn't push twice in a row when the cron
+ # job retries several times.
+ self.Die("Last push too recently: %d" % last_push)
class FetchLKGR(Step):
@@ -124,7 +120,7 @@ class FetchLKGR(Step):
def RunStep(self):
lkgr_url = "https://v8-status.appspot.com/lkgr"
# Retry several times since app engine might have issues.
- self.Persist("lkgr", self.ReadURL(lkgr_url, wait_plan=[5, 20, 300, 300]))
+ self["lkgr"] = self.ReadURL(lkgr_url, wait_plan=[5, 20, 300, 300])
class PushToTrunk(Step):
@@ -145,27 +141,24 @@ class PushToTrunk(Step):
wait_plan=[5, 20])
def RunStep(self):
- self.RestoreIfUnset("latest")
- self.RestoreIfUnset("lkgr")
- self.RestoreIfUnset("tree_message")
- latest = int(self._state["latest"])
- lkgr = int(self._state["lkgr"])
+ latest = int(self["latest"])
+ lkgr = int(self["lkgr"])
if latest == lkgr:
print "ToT (r%d) is clean. Pushing to trunk." % latest
self.PushTreeStatus("Tree is closed (preparing to push)")
- # TODO(machenbach): Call push to trunk script.
# TODO(machenbach): Update the script before calling it.
try:
if self._options.push:
self._side_effect_handler.Call(
RunPushToTrunk,
push_to_trunk.CONFIG,
- PushToTrunkOptions.MakeForcedOptions(self._options.r,
- self._options.c),
+ PushToTrunkOptions.MakeForcedOptions(self._options.author,
+ self._options.reviewer,
+ self._options.chromium),
self._side_effect_handler)
finally:
- self.PushTreeStatus(self._state["tree_message"])
+ self.PushTreeStatus(self["tree_message"])
else:
print("ToT (r%d) is ahead of the LKGR (r%d). Skipping push to trunk."
% (latest, lkgr))
@@ -187,28 +180,30 @@ def RunAutoRoll(config,
def BuildOptions():
- result = optparse.OptionParser()
- 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",
- 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
+ parser = argparse.ArgumentParser()
+ parser.add_argument("-a", "--author",
+ help="The author email used for rietveld.")
+ parser.add_argument("-c", "--chromium",
+ help=("The path to your Chromium src/ directory to "
+ "automate the V8 roll."))
+ parser.add_argument("-p", "--push",
+ help="Push to trunk if possible. Dry run if unspecified.",
+ default=False, action="store_true")
+ parser.add_argument("-r", "--reviewer",
+ help="The account name to be used for reviews.")
+ parser.add_argument("-s", "--step",
+ help="Specify the step where to start work. Default: 0.",
+ default=0, type=int)
+ parser.add_argument("--status-password",
+ help="A file with the password to the status app.")
+ return parser
def Main():
parser = BuildOptions()
- (options, args) = parser.parse_args()
- if not options.c or not options.r:
- print "You need to specify the chromium src location and a reviewer."
+ options = parser.parse_args()
+ if not options.author or not options.chromium or not options.reviewer:
+ print "You need to specify author, chromium src location and reviewer."
parser.print_help()
return 1
RunAutoRoll(CONFIG, AutoRollOptions(options))
« no previous file with comments | « tools/merge-to-branch.sh ('k') | tools/push-to-trunk/common_includes.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698