Commit 379dcd5b authored by machenbach's avatar machenbach Committed by Commit bot

Clean up release scripts.

This makes some internal renaming, e.g. trunk -> candidates,
bleeding edge -> master, without changing the api.

Also remove some unused bailout steps from the push script.

Remove unused bump version script.

BUG=chromium:451975
TBR=tandrii@chromium.org
NOTRY=true
LOG=n

Review URL: https://codereview.chromium.org/873213002

Cr-Commit-Position: refs/heads/master@{#26269}
parent 00f3f992
......@@ -46,30 +46,6 @@ class Preparation(Step):
self.CommonPrepare()
class CheckAutoPushSettings(Step):
MESSAGE = "Checking settings file."
def RunStep(self):
settings_file = os.path.realpath(self.Config("SETTINGS_LOCATION"))
if os.path.exists(settings_file):
settings_dict = json.loads(FileToText(settings_file))
if settings_dict.get("enable_auto_roll") is False:
self.Die("Push to trunk disabled by auto-roll settings file: %s"
% settings_file)
class CheckTreeStatus(Step):
MESSAGE = "Checking v8 tree status message."
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])
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 FetchCandidate(Step):
MESSAGE = "Fetching V8 roll candidate ref."
......@@ -79,22 +55,22 @@ class FetchCandidate(Step):
class CheckLastPush(Step):
MESSAGE = "Checking last V8 push to trunk."
MESSAGE = "Checking last V8 push to candidates."
def RunStep(self):
last_push = self.FindLastTrunkPush()
last_push = self.FindLastCandidatesPush()
# Retrieve the bleeding edge revision of the last push from the text in
# Retrieve the master 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)
candidate = 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"
if not candidate: # pragma: no cover
self.Die("Could not retrieve master revision for candidates push %s"
% last_push)
if self["candidate"] == last_push_be:
print "Already pushed current candidate %s" % last_push_be
if self["candidate"] == candidate:
print "Already pushed current candidate %s" % candidate
return True
......@@ -116,13 +92,14 @@ class PushToCandidates(Step):
# TODO(machenbach): Update the script before calling it.
if self._options.push:
self._side_effect_handler.Call(push_to_trunk.PushToTrunk().Run, args)
self._side_effect_handler.Call(
push_to_trunk.PushToCandidates().Run, args)
class AutoPush(ScriptsBase):
def _PrepareOptions(self, parser):
parser.add_argument("-p", "--push",
help="Push to trunk. Dry run if unspecified.",
help="Push to candidates. Dry run if unspecified.",
default=False, action="store_true")
def _ProcessOptions(self, options):
......@@ -135,14 +112,11 @@ class AutoPush(ScriptsBase):
def _Config(self):
return {
"PERSISTFILE_BASENAME": "/tmp/v8-auto-push-tempfile",
"SETTINGS_LOCATION": "~/.auto-roll",
}
def _Steps(self):
return [
Preparation,
CheckAutoPushSettings,
CheckTreeStatus,
FetchCandidate,
CheckLastPush,
PushToCandidates,
......
......@@ -39,11 +39,11 @@ class CheckActiveRoll(Step):
class DetectLastPush(Step):
MESSAGE = "Detect commit ID of the last push to trunk."
MESSAGE = "Detect commit ID of the last push to candidates."
def RunStep(self):
self.vc.Fetch()
push_hash = self.FindLastTrunkPush(
push_hash = self.FindLastCandidatesPush(
branch="origin/candidates", include_patches=True)
self["last_push"] = self.GetCommitPositionNumber(push_hash)
......@@ -58,8 +58,8 @@ class DetectLastRoll(Step):
Var = lambda var: '%s'
exec(FileToText(os.path.join(self._options.chromium, "DEPS")))
last_roll = self.GetCommitPositionNumber(vars['v8_revision'])
# FIXME(machenbach): When rolling from bleeding edge and from trunk there
# be different commit numbers here. Better use version?
# FIXME(machenbach): When rolling from master and from candidates there
# will be different commit numbers here. Better use version?
if int(last_roll) >= int(self["last_push"]):
print("There is no newer v8 revision than the one in Chromium (%s)."
% last_roll)
......
#!/usr/bin/env python
# Copyright 2014 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Script for auto-increasing the version on bleeding_edge.
The script can be run regularly by a cron job. It will increase the build
level of the version on bleeding_edge if:
- the lkgr version is smaller than the version of the latest revision,
- the lkgr version is not a version change itself,
- the tree is not closed for maintenance.
The new version will be the maximum of the bleeding_edge and trunk versions +1.
E.g. latest bleeding_edge version: 3.22.11.0 and latest trunk 3.23.0.0 gives
the new version 3.23.1.0.
This script requires a depot tools git checkout. I.e. 'fetch v8'.
"""
import argparse
import os
import sys
from common_includes import *
VERSION_BRANCH = "auto-bump-up-version"
# TODO(machenbach): Add vc interface that works on git mirror.
class Preparation(Step):
MESSAGE = "Preparation."
def RunStep(self):
# TODO(machenbach): Remove after the git switch.
if(self.Config("PERSISTFILE_BASENAME") ==
"/tmp/v8-bump-up-version-tempfile"):
print "This script is disabled until after the v8 git migration."
return True
# Check for a clean workdir.
if not self.GitIsWorkdirClean(): # pragma: no cover
# This is in case a developer runs this script on a dirty tree.
self.GitStash()
self.GitCheckout("master")
self.GitPull()
# Ensure a clean version branch.
self.DeleteBranch(VERSION_BRANCH)
class GetCurrentBleedingEdgeVersion(Step):
MESSAGE = "Get latest bleeding edge version."
def RunStep(self):
self.GitCheckout("master")
# Store latest version and revision.
self.ReadAndPersistVersion()
self["latest_version"] = self.ArrayToVersion("")
self["latest"] = self.GitLog(n=1, format="%H")
print "Bleeding edge version: %s" % self["latest_version"]
# This step is pure paranoia. It forbids the script to continue if the last
# commit changed version.cc. Just in case the other bailout has a bug, this
# prevents the script from continuously commiting version changes.
class LastChangeBailout(Step):
MESSAGE = "Stop script if the last change modified the version."
def RunStep(self):
if VERSION_FILE in self.GitChangedFiles(self["latest"]):
print "Stop due to recent version change."
return True
# TODO(machenbach): Implement this for git.
class FetchLKGR(Step):
MESSAGE = "Fetching V8 LKGR."
def RunStep(self):
lkgr_url = "https://v8-status.appspot.com/lkgr"
self["lkgr_svn"] = self.ReadURL(lkgr_url, wait_plan=[5])
# TODO(machenbach): Implement this for git. With a git lkgr we could simply
# checkout that revision. With svn, we have to search backwards until that
# revision is found.
class GetLKGRVersion(Step):
MESSAGE = "Get bleeding edge lkgr version."
def RunStep(self):
self.GitCheckout("master")
# If the commit was made from svn, there is a mapping entry in the commit
# message.
self["lkgr"] = self.GitLog(
grep="^git-svn-id: [^@]*@%s [A-Za-z0-9-]*$" % self["lkgr_svn"],
format="%H")
# FIXME(machenbach): http://crbug.com/391712 can lead to svn lkgrs on the
# trunk branch (rarely).
if not self["lkgr"]: # pragma: no cover
self.Die("No git hash found for svn lkgr.")
self.GitCreateBranch(VERSION_BRANCH, self["lkgr"])
self.ReadAndPersistVersion("lkgr_")
self["lkgr_version"] = self.ArrayToVersion("lkgr_")
print "LKGR version: %s" % self["lkgr_version"]
# Ensure a clean version branch.
self.GitCheckout("master")
self.DeleteBranch(VERSION_BRANCH)
class LKGRVersionUpToDateBailout(Step):
MESSAGE = "Stop script if the lkgr has a renewed version."
def RunStep(self):
# If a version-change commit becomes the lkgr, don't bump up the version
# again.
if VERSION_FILE in self.GitChangedFiles(self["lkgr"]):
print "Stop because the lkgr is a version change itself."
return True
# Don't bump up the version if it got updated already after the lkgr.
if SortingKey(self["lkgr_version"]) < SortingKey(self["latest_version"]):
print("Stop because the latest version already changed since the lkgr "
"version.")
return True
class GetTrunkVersion(Step):
MESSAGE = "Get latest trunk version."
def RunStep(self):
self.GitCheckout("candidates")
self.GitPull()
self.ReadAndPersistVersion("trunk_")
self["trunk_version"] = self.ArrayToVersion("trunk_")
print "Trunk version: %s" % self["trunk_version"]
class CalculateVersion(Step):
MESSAGE = "Calculate the new version."
def RunStep(self):
if self["lkgr_build"] == "9999": # pragma: no cover
# If version control on bleeding edge was switched off, just use the last
# trunk version.
self["lkgr_version"] = self["trunk_version"]
# The new version needs to be greater than the max on bleeding edge and
# trunk.
max_version = max(self["trunk_version"],
self["lkgr_version"],
key=SortingKey)
# Strip off possible leading zeros.
self["new_major"], self["new_minor"], self["new_build"], _ = (
map(str, map(int, max_version.split("."))))
self["new_build"] = str(int(self["new_build"]) + 1)
self["new_patch"] = "0"
self["new_version"] = ("%s.%s.%s.0" %
(self["new_major"], self["new_minor"], self["new_build"]))
print "New version is %s" % self["new_version"]
if self._options.dry_run: # pragma: no cover
print "Dry run, skipping version change."
return True
class CheckTreeStatus(Step):
MESSAGE = "Checking v8 tree status message."
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"maintenance|no commits", message, flags=re.I):
print "Skip version change by tree status: \"%s\"" % message
return True
class ChangeVersion(Step):
MESSAGE = "Bump up the version."
def RunStep(self):
self.GitCreateBranch(VERSION_BRANCH, "master")
self.SetVersion(os.path.join(self.default_cwd, VERSION_FILE), "new_")
try:
msg = "[Auto-roll] Bump up version to %s" % self["new_version"]
self.GitCommit("%s\n\nTBR=%s" % (msg, self._options.author),
author=self._options.author)
self.GitUpload(author=self._options.author,
force=self._options.force_upload,
bypass_hooks=True)
self.GitCLLand()
print "Successfully changed the version."
finally:
# Clean up.
self.GitCheckout("master")
self.DeleteBranch(VERSION_BRANCH)
class BumpUpVersion(ScriptsBase):
def _PrepareOptions(self, parser):
parser.add_argument("--dry_run", help="Don't commit the new version.",
default=False, action="store_true")
def _ProcessOptions(self, options): # pragma: no cover
if not options.dry_run and not options.author:
print "Specify your chromium.org email with -a"
return False
options.wait_for_lgtm = False
options.force_readline_defaults = True
options.force_upload = True
return True
def _Config(self):
return {
"PERSISTFILE_BASENAME": "/tmp/v8-bump-up-version-tempfile",
"PATCH_FILE": "/tmp/v8-bump-up-version-tempfile-patch-file",
}
def _Steps(self):
return [
Preparation,
GetCurrentBleedingEdgeVersion,
LastChangeBailout,
FetchLKGR,
GetLKGRVersion,
LKGRVersionUpToDateBailout,
GetTrunkVersion,
CalculateVersion,
CheckTreeStatus,
ChangeVersion,
]
if __name__ == "__main__": # pragma: no cover
sys.exit(BumpUpVersion().Run())
......@@ -19,10 +19,10 @@ class Preparation(Step):
class DetectLastPush(Step):
MESSAGE = "Detect commit ID of last push to trunk."
MESSAGE = "Detect commit ID of last push to candidates."
def RunStep(self):
self["last_push"] = self._options.last_push or self.FindLastTrunkPush(
self["last_push"] = self._options.last_push or self.FindLastCandidatesPush(
branch="origin/candidates", include_patches=True)
self["push_title"] = self.GitLog(n=1, format="%s",
git_hash=self["last_push"])
......@@ -118,7 +118,7 @@ class ChromiumRoll(ScriptsBase):
help=("The path to your Chromium src/ "
"directory to automate the V8 roll."))
parser.add_argument("-l", "--last-push",
help="The git commit ID of the last push to trunk.")
help="The git commit ID of the last candidates push.")
parser.add_argument("--use-commit-queue",
help="Check the CQ bit on upload.",
default=False, action="store_true")
......
......@@ -589,7 +589,7 @@ class Step(GitRecipesMixin):
except GitFailedException:
self.WaitForResolvingConflicts(patch_file)
def FindLastTrunkPush(
def FindLastCandidatesPush(
self, parent_hash="", branch="", include_patches=False):
push_pattern = "^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*"
if not include_patches:
......
......@@ -47,9 +47,9 @@ class Preparation(Step):
open(self.Config("ALREADY_MERGING_SENTINEL_FILE"), "a").close()
self.InitialEnvironmentChecks(self.default_cwd)
if self._options.revert_bleeding_edge:
# FIXME(machenbach): Make revert bleeding_edge obsolete?
self["merge_to_branch"] = "bleeding_edge"
if self._options.revert_master:
# FIXME(machenbach): Make revert master obsolete?
self["merge_to_branch"] = "master"
elif self._options.branch:
self["merge_to_branch"] = self._options.branch
else: # pragma: no cover
......@@ -111,7 +111,7 @@ class CreateCommitMessage(Step):
if not self["revision_list"]: # pragma: no cover
self.Die("Revision list is empty.")
if self._options.revert and not self._options.revert_bleeding_edge:
if self._options.revert and not self._options.revert_master:
action_text = "Rollback of %s"
else:
action_text = "Merged %s"
......@@ -156,7 +156,7 @@ class PrepareVersion(Step):
MESSAGE = "Prepare version file."
def RunStep(self):
if self._options.revert_bleeding_edge:
if self._options.revert_master:
return
# This is used to calculate the patch level increment.
self.ReadAndPersistVersion()
......@@ -166,7 +166,7 @@ class IncrementVersion(Step):
MESSAGE = "Increment version number."
def RunStep(self):
if self._options.revert_bleeding_edge:
if self._options.revert_master:
return
new_patch = str(int(self["patch"]) + 1)
if self.Confirm("Automatically increment PATCH_LEVEL? (Saying 'n' will "
......@@ -192,7 +192,7 @@ class CommitLocal(Step):
def RunStep(self):
# Add a commit message title.
if self._options.revert and self._options.revert_bleeding_edge:
if self._options.revert and self._options.revert_master:
# TODO(machenbach): Find a better convention if multiple patches are
# reverted in one CL.
self["commit_title"] = "Revert on master"
......@@ -218,7 +218,7 @@ class TagRevision(Step):
MESSAGE = "Create the tag."
def RunStep(self):
if self._options.revert_bleeding_edge:
if self._options.revert_master:
return
print "Creating tag %s" % self["version"]
self.vc.Tag(self["version"],
......@@ -231,7 +231,7 @@ class CleanUp(Step):
def RunStep(self):
self.CommonCleanup()
if not self._options.revert_bleeding_edge:
if not self._options.revert_master:
print "*** SUMMARY ***"
print "version: %s" % self["version"]
print "branch: %s" % self["merge_to_branch"]
......@@ -242,13 +242,13 @@ class CleanUp(Step):
class MergeToBranch(ScriptsBase):
def _Description(self):
return ("Performs the necessary steps to merge revisions from "
"bleeding_edge to other branches, including trunk.")
"master to other branches, including candidates.")
def _PrepareOptions(self, parser):
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument("--branch", help="The branch to merge to.")
group.add_argument("-R", "--revert-bleeding-edge",
help="Revert specified patches from bleeding edge.",
group.add_argument("-R", "--revert-master",
help="Revert specified patches from master.",
default=False, action="store_true")
parser.add_argument("revisions", nargs="*",
help="The revisions to merge.")
......@@ -264,7 +264,7 @@ class MergeToBranch(ScriptsBase):
help="A patch file to apply as part of the merge.")
def _ProcessOptions(self, options):
# TODO(machenbach): Add a test that covers revert from bleeding_edge
# TODO(machenbach): Add a test that covers revert from master
if len(options.revisions) < 1:
if not options.patch:
print "Either a patch file or revision numbers must be specified"
......
......@@ -48,12 +48,12 @@ class Preparation(Step):
# Make sure tags are fetched.
self.Git("fetch origin +refs/tags/*:refs/tags/*")
if(self["current_branch"] == self.Config("TRUNKBRANCH")
if(self["current_branch"] == self.Config("CANDIDATESBRANCH")
or self["current_branch"] == self.Config("BRANCHNAME")):
print "Warning: Script started on branch %s" % self["current_branch"]
self.PrepareBranch()
self.DeleteBranch(self.Config("TRUNKBRANCH"))
self.DeleteBranch(self.Config("CANDIDATESBRANCH"))
class FreshBranch(Step):
......@@ -77,40 +77,41 @@ class PreparePushRevision(Step):
class DetectLastPush(Step):
MESSAGE = "Detect commit ID of last push to trunk."
MESSAGE = "Detect commit ID of last push to CANDIDATES."
def RunStep(self):
last_push = self._options.last_push or self.FindLastTrunkPush()
last_push = self._options.last_push or self.FindLastCandidatesPush()
while True:
# Print assumed commit, circumventing git's pager.
print self.GitLog(n=1, git_hash=last_push)
if self.Confirm("Is the commit printed above the last push to trunk?"):
if self.Confirm(
"Is the commit printed above the last push to candidates?"):
break
last_push = self.FindLastTrunkPush(parent_hash=last_push)
last_push = self.FindLastCandidatesPush(parent_hash=last_push)
if self._options.last_bleeding_edge:
# Read the bleeding edge revision of the last push from a command-line
# option.
last_push_bleeding_edge = self._options.last_bleeding_edge
if self._options.last_master:
# Read the master revision of the last push from a command-line option.
last_push_master = self._options.last_master
else:
# Retrieve the bleeding edge revision of the last push from the text in
# Retrieve the master 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_bleeding_edge = PUSH_MSG_GIT_RE.match(
last_push_master = PUSH_MSG_GIT_RE.match(
last_push_title).group("git_rev")
if not last_push_bleeding_edge: # pragma: no cover
self.Die("Could not retrieve bleeding edge git hash for trunk push %s"
% last_push)
if not last_push_master: # pragma: no cover
self.Die(
"Could not retrieve master git hash for candidates push %s"
% last_push)
# This points to the git hash of the last push on trunk.
self["last_push_trunk"] = last_push
# This points to the last bleeding_edge revision that went into the last
# This points to the git hash of the last push on candidates.
self["last_push_candidates"] = last_push
# This points to the last master revision that went into the last
# push.
# TODO(machenbach): Do we need a check to make sure we're not pushing a
# revision older than the last push? If we do this, the output of the
# current change log preparation won't make much sense.
self["last_push_bleeding_edge"] = last_push_bleeding_edge
self["last_push_master"] = last_push_master
class GetLatestVersion(Step):
......@@ -140,7 +141,7 @@ class IncrementVersion(Step):
def RunStep(self):
# Variables prefixed with 'new_' contain the new version numbers for the
# ongoing trunk push.
# ongoing candidates push.
self["new_major"] = self["latest_major"]
self["new_minor"] = self["latest_minor"]
self["new_build"] = str(int(self["latest_build"]) + 1)
......@@ -179,7 +180,7 @@ class PrepareChangeLog(Step):
output = "%s: Version %s\n\n" % (self["date"], self["version"])
TextToFile(output, self.Config("CHANGELOG_ENTRY_FILE"))
commits = self.GitLog(format="%H",
git_hash="%s..%s" % (self["last_push_bleeding_edge"],
git_hash="%s..%s" % (self["last_push_master"],
self["push_hash"]))
# Cache raw commit messages.
......@@ -225,7 +226,7 @@ class EditChangeLog(Step):
if changelog_entry == "": # pragma: no cover
self.Die("Empty ChangeLog entry.")
# Safe new change log for adding it later to the trunk patch.
# Safe new change log for adding it later to the candidates patch.
TextToFile(changelog_entry, self.Config("CHANGELOG_ENTRY_FILE"))
......@@ -272,10 +273,10 @@ class SquashCommits(Step):
class NewBranch(Step):
MESSAGE = "Create a new branch from trunk."
MESSAGE = "Create a new branch from candidates."
def RunStep(self):
self.GitCreateBranch(self.Config("TRUNKBRANCH"),
self.GitCreateBranch(self.Config("CANDIDATESBRANCH"),
self.vc.RemoteCandidateBranch())
......@@ -286,11 +287,11 @@ class ApplyChanges(Step):
self.ApplyPatch(self.Config("PATCH_FILE"))
os.remove(self.Config("PATCH_FILE"))
# The change log has been modified by the patch. Reset it to the version
# on trunk and apply the exact changes determined by this PrepareChangeLog
# step above.
# on candidates and apply the exact changes determined by this
# PrepareChangeLog step above.
self.GitCheckoutFile(CHANGELOG_FILE, self.vc.RemoteCandidateBranch())
# The version file has been modified by the patch. Reset it to the version
# on trunk.
# on candidates.
self.GitCheckoutFile(VERSION_FILE, self.vc.RemoteCandidateBranch())
......@@ -311,13 +312,13 @@ class PrepareVersionBranch(Step):
def RunStep(self):
self.GitCheckout("master")
self.Git("fetch")
self.GitDeleteBranch(self.Config("TRUNKBRANCH"))
self.GitCreateBranch(self.Config("TRUNKBRANCH"),
self.GitDeleteBranch(self.Config("CANDIDATESBRANCH"))
self.GitCreateBranch(self.Config("CANDIDATESBRANCH"),
self.vc.RemoteCandidateBranch())
class AddChangeLog(Step):
MESSAGE = "Add ChangeLog changes to trunk branch."
MESSAGE = "Add ChangeLog changes to candidates branch."
def RunStep(self):
changelog_entry = FileToText(self.Config("CHANGELOG_ENTRY_FILE"))
......@@ -328,7 +329,7 @@ class AddChangeLog(Step):
class SetVersion(Step):
MESSAGE = "Set correct version for trunk."
MESSAGE = "Set correct version for candidates."
def RunStep(self):
self.SetVersion(os.path.join(self.default_cwd, VERSION_FILE), "new_")
......@@ -349,7 +350,7 @@ class SanityCheck(Step):
# TODO(machenbach): Run presubmit script here as it is now missing in the
# prepare push process.
if not self.Confirm("Please check if your local checkout is sane: Inspect "
"%s, compile, run tests. Do you want to commit this new trunk "
"%s, compile, run tests. Do you want to commit this new candidates "
"revision to the repository?" % VERSION_FILE):
self.Die("Execution canceled.") # pragma: no cover
......@@ -373,16 +374,16 @@ class CleanUp(Step):
MESSAGE = "Done!"
def RunStep(self):
print("Congratulations, you have successfully created the trunk "
print("Congratulations, you have successfully created the candidates "
"revision %s."
% self["version"])
self.CommonCleanup()
if self.Config("TRUNKBRANCH") != self["current_branch"]:
self.GitDeleteBranch(self.Config("TRUNKBRANCH"))
if self.Config("CANDIDATESBRANCH") != self["current_branch"]:
self.GitDeleteBranch(self.Config("CANDIDATESBRANCH"))
class PushToTrunk(ScriptsBase):
class PushToCandidates(ScriptsBase):
def _PrepareOptions(self, parser):
group = parser.add_mutually_exclusive_group()
group.add_argument("-f", "--force",
......@@ -391,12 +392,12 @@ class PushToTrunk(ScriptsBase):
group.add_argument("-m", "--manual",
help="Prompt the user at every important step.",
default=False, action="store_true")
parser.add_argument("-b", "--last-bleeding-edge",
help=("The git commit ID of the last bleeding edge "
"revision that was pushed to trunk. This is "
"used for the auto-generated ChangeLog entry."))
parser.add_argument("-b", "--last-master",
help=("The git commit ID of the last master "
"revision that was pushed to candidates. This is"
" used for the auto-generated ChangeLog entry."))
parser.add_argument("-l", "--last-push",
help="The git commit ID of the last push to trunk.")
help="The git commit ID of the last candidates push.")
parser.add_argument("-R", "--revision",
help="The git commit ID to push (defaults to HEAD).")
......@@ -414,11 +415,12 @@ class PushToTrunk(ScriptsBase):
def _Config(self):
return {
"BRANCHNAME": "prepare-push",
"TRUNKBRANCH": "trunk-push",
"PERSISTFILE_BASENAME": "/tmp/v8-push-to-trunk-tempfile",
"CHANGELOG_ENTRY_FILE": "/tmp/v8-push-to-trunk-tempfile-changelog-entry",
"PATCH_FILE": "/tmp/v8-push-to-trunk-tempfile-patch-file",
"COMMITMSG_FILE": "/tmp/v8-push-to-trunk-tempfile-commitmsg",
"CANDIDATESBRANCH": "candidates-push",
"PERSISTFILE_BASENAME": "/tmp/v8-push-to-candidates-tempfile",
"CHANGELOG_ENTRY_FILE":
"/tmp/v8-push-to-candidates-tempfile-changelog-entry",
"PATCH_FILE": "/tmp/v8-push-to-candidates-tempfile-patch-file",
"COMMITMSG_FILE": "/tmp/v8-push-to-candidates-tempfile-commitmsg",
}
def _Steps(self):
......@@ -449,4 +451,4 @@ class PushToTrunk(ScriptsBase):
if __name__ == "__main__": # pragma: no cover
sys.exit(PushToTrunk().Run())
sys.exit(PushToCandidates().Run())
......@@ -3,7 +3,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This script retrieves the history of all V8 branches and trunk revisions and
# This script retrieves the history of all V8 branches and
# their corresponding Chromium revisions.
# Requires a chromium checkout with branch heads:
......@@ -136,7 +136,7 @@ class RetrieveV8Releases(Step):
return (self._options.max_releases > 0
and len(releases) > self._options.max_releases)
def GetBleedingEdgeGitFromPush(self, title):
def GetMasterHashFromPush(self, title):
return MatchSafe(PUSH_MSG_GIT_RE.match(title))
def GetMergedPatches(self, body):
......@@ -161,7 +161,7 @@ class RetrieveV8Releases(Step):
def GetReleaseDict(
self, git_hash, bleeding_edge_rev, bleeding_edge_git, branch, version,
self, git_hash, master_position, master_hash, branch, version,
patches, cl_body):
revision = self.GetCommitPositionNumber(git_hash)
return {
......@@ -170,9 +170,9 @@ class RetrieveV8Releases(Step):
# The git revision on the branch.
"revision_git": git_hash,
# The cr commit position number on master.
"bleeding_edge": bleeding_edge_rev,
"bleeding_edge": master_position,
# The same for git.
"bleeding_edge_git": bleeding_edge_git,
"bleeding_edge_git": master_hash,
# The branch name.
"branch": branch,
# The version for displaying in the form 3.26.3 or 3.26.3.12.
......@@ -185,8 +185,8 @@ class RetrieveV8Releases(Step):
"chromium_revision": "",
# Default for easier output formatting.
"chromium_branch": "",
# Link to the CL on code review. Trunk pushes are not uploaded, so this
# field will be populated below with the recent roll CL link.
# Link to the CL on code review. Candiates pushes are not uploaded,
# so this field will be populated below with the recent roll CL link.
"review_link": MatchSafe(REVIEW_LINK_RE.search(cl_body)),
# Link to the commit message on google code.
"revision_link": ("https://code.google.com/p/v8/source/detail?r=%s"
......@@ -208,13 +208,13 @@ class RetrieveV8Releases(Step):
patches = self.GetMergedPatches(body)
title = self.GitLog(n=1, format="%s", git_hash=git_hash)
bleeding_edge_git = self.GetBleedingEdgeGitFromPush(title)
bleeding_edge_position = ""
if bleeding_edge_git:
bleeding_edge_position = self.GetCommitPositionNumber(bleeding_edge_git)
master_hash = self.GetMasterHashFromPush(title)
master_position = ""
if master_hash:
master_position = self.GetCommitPositionNumber(master_hash)
# TODO(machenbach): Add the commit position number.
return self.GetReleaseDict(
git_hash, bleeding_edge_position, bleeding_edge_git, branch, version,
git_hash, master_position, master_hash, branch, version,
patches, body), self["patch"]
def GetReleasesFromMaster(self):
......@@ -270,7 +270,7 @@ class RetrieveV8Releases(Step):
branches = self.vc.GetBranches()
releases = []
if self._options.branch == 'recent':
# Get only recent development on trunk, beta and stable.
# Get only recent development on candidates, beta and stable.
if self._options.max_releases == 0: # pragma: no cover
self._options.max_releases = 10
beta, stable = SortBranches(branches)[0:2]
......@@ -373,7 +373,7 @@ class RetrieveChromiumV8Releases(Step):
# Clean up.
self.GitCheckoutFileSafe("DEPS", "HEAD", cwd=cwd)
# Add the chromium ranges to the v8 trunk and bleeding_edge releases.
# Add the chromium ranges to the v8 candidates and master releases.
all_ranges = BuildRevisionRanges(cr_releases)
releases_dict = dict((r["revision"], r) for r in releases)
for revision, ranges in all_ranges.iteritems():
......@@ -386,13 +386,13 @@ class RietrieveChromiumBranches(Step):
def RunStep(self):
cwd = self._options.chromium
trunk_releases = filter(lambda r: r["branch"] == self.vc.CandidateBranch(),
self["releases"])
if not trunk_releases: # pragma: no cover
print "No trunk releases detected. Skipping chromium history."
cand_releases = filter(lambda r: r["branch"] == self.vc.CandidateBranch(),
self["releases"])
if not cand_releases: # pragma: no cover
print "No candidates releases detected. Skipping chromium history."
return True
oldest_v8_rev = int(trunk_releases[-1]["revision"])
oldest_v8_rev = int(cand_releases[-1]["revision"])
# Filter out irrelevant branches.
branches = filter(lambda r: re.match(r"branch-heads/\d+", r),
......@@ -430,11 +430,11 @@ class RietrieveChromiumBranches(Step):
# Clean up.
self.GitCheckoutFileSafe("DEPS", "HEAD", cwd=cwd)
# Add the chromium branches to the v8 trunk releases.
# Add the chromium branches to the v8 candidate releases.
all_ranges = BuildRevisionRanges(cr_branches)
trunk_dict = dict((r["revision"], r) for r in trunk_releases)
cand_dict = dict((r["revision"], r) for r in cand_releases)
for revision, ranges in all_ranges.iteritems():
trunk_dict.get(revision, {})["chromium_branch"] = ranges
cand_dict.get(revision, {})["chromium_branch"] = ranges
class CleanUp(Step):
......@@ -471,7 +471,8 @@ class Releases(ScriptsBase):
parser.add_argument("-b", "--branch", default="recent",
help=("The branch to analyze. If 'all' is specified, "
"analyze all branches. If 'recent' (default) "
"is specified, track beta, stable and trunk."))
"is specified, track beta, stable and "
"candidates."))
parser.add_argument("-c", "--chromium",
help=("The path to your Chromium src/ "
"directory to automate the V8 roll."))
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment