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 ebe2397525d99ee05f1a90645ff216d0598fdfd6..014016c9c71dbb2d4a30a7d6eb9f89e2b16f1f15 100755 |
--- a/tools/push-to-trunk/auto_roll.py |
+++ b/tools/push-to-trunk/auto_roll.py |
@@ -44,6 +44,8 @@ CONFIG = { |
SETTINGS_LOCATION: "~/.auto-roll", |
} |
+PUSH_MESSAGE_RE = re.compile(r".* \(based on bleeding_edge revision r(\d+)\)$") |
+ |
class Preparation(Step): |
MESSAGE = "Preparation." |
@@ -77,42 +79,40 @@ class CheckTreeStatus(Step): |
% self["tree_message"]) |
-class FetchLatestRevision(Step): |
- MESSAGE = "Fetching latest V8 revision." |
+class FetchLKGR(Step): |
+ MESSAGE = "Fetching V8 LKGR." |
def RunStep(self): |
- match = re.match(r"^r(\d+) ", self.GitSVNLog()) |
- if not match: # pragma: no cover |
- self.Die("Could not extract current svn revision from log.") |
- self["latest"] = match.group(1) |
+ lkgr_url = "https://v8-status.appspot.com/lkgr" |
+ # Retry several times since app engine might have issues. |
+ self["lkgr"] = self.ReadURL(lkgr_url, wait_plan=[5, 20, 300, 300]) |
class CheckLastPush(Step): |
MESSAGE = "Checking last V8 push to trunk." |
def RunStep(self): |
- last_push_hash = self.FindLastTrunkPush() |
- last_push = int(self.GitSVNFindSVNRev(last_push_hash)) |
+ last_push = self.FindLastTrunkPush() |
+ |
+ # Retrieve the bleeding edge revision of the last push from the text in |
+ # the push commit message. |
+ last_push_title = self.GitLog(n=1, format="%s", git_hash=last_push) |
+ last_push_be = PUSH_MESSAGE_RE.match(last_push_title).group(1) |
+ |
+ if not last_push_be: # pragma: no cover |
+ self.Die("Could not retrieve bleeding edge revision for trunk push %s" |
+ % last_push) |
# 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: # pragma: no cover |
+ if int(self["lkgr"]) - int(last_push_be) < 10: # pragma: no cover |
# 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): |
- MESSAGE = "Fetching V8 LKGR." |
- |
- def RunStep(self): |
- lkgr_url = "https://v8-status.appspot.com/lkgr" |
- # Retry several times since app engine might have issues. |
- self["lkgr"] = self.ReadURL(lkgr_url, wait_plan=[5, 20, 300, 300]) |
+ self.Die("Last push too recently: %s" % last_push_be) |
class PushToTrunk(Step): |
- MESSAGE = "Pushing to trunk if possible." |
+ MESSAGE = "Pushing to trunk if specified." |
def PushTreeStatus(self, message): |
if not self._options.status_password: |
@@ -129,26 +129,21 @@ class PushToTrunk(Step): |
wait_plan=[5, 20]) |
def RunStep(self): |
- 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): 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, |
- ["-a", self._options.author, |
- "-r", self._options.reviewer, |
- "-f"]) |
- finally: |
- self.PushTreeStatus(self["tree_message"]) |
- else: |
- print("ToT (r%d) is ahead of the LKGR (r%d). Skipping push to trunk." |
- % (latest, lkgr)) |
+ 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): |
@@ -173,9 +168,8 @@ class AutoRoll(ScriptsBase): |
Preparation, |
CheckAutoRollSettings, |
CheckTreeStatus, |
- FetchLatestRevision, |
- CheckLastPush, |
FetchLKGR, |
+ CheckLastPush, |
PushToTrunk, |
] |