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

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

Issue 716153002: Switch release scripts to pure git. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review. Created 6 years, 1 month 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
Index: tools/push-to-trunk/common_includes.py
diff --git a/tools/push-to-trunk/common_includes.py b/tools/push-to-trunk/common_includes.py
index a7f8047d2bdc6994597a93033675295295485cbe..21cdcf49777780a7c71d38fc63dd45d533202ee1 100644
--- a/tools/push-to-trunk/common_includes.py
+++ b/tools/push-to-trunk/common_includes.py
@@ -272,12 +272,6 @@ class VCInterface(object):
def GetBranches(self):
raise NotImplementedError()
- def GitSvn(self, hsh, branch=""):
- raise NotImplementedError()
-
- def SvnGit(self, rev, branch=""):
- raise NotImplementedError()
-
def MasterBranch(self):
raise NotImplementedError()
@@ -299,9 +293,6 @@ class VCInterface(object):
def CLLand(self):
raise NotImplementedError()
- # TODO(machenbach): There is some svn knowledge in this interface. In svn,
- # tag and commit are different remote commands, while in git we would commit
- # and tag locally and then push/land in one unique step.
def Tag(self, tag, remote, message):
"""Sets a tag for the current commit.
@@ -310,68 +301,12 @@ class VCInterface(object):
raise NotImplementedError()
-class GitSvnInterface(VCInterface):
- def Pull(self):
- self.step.GitSVNRebase()
-
- def Fetch(self):
- self.step.GitSVNFetch()
-
- def GetTags(self):
- # Get remote tags.
- tags = filter(lambda s: re.match(r"^svn/tags/[\d+\.]+$", s),
- self.step.GitRemotes())
-
- # Remove 'svn/tags/' prefix.
- return map(lambda s: s[9:], tags)
-
- def GetBranches(self):
- # Get relevant remote branches, e.g. "svn/3.25".
- branches = filter(lambda s: re.match(r"^svn/\d+\.\d+$", s),
- self.step.GitRemotes())
- # Remove 'svn/' prefix.
- return map(lambda s: s[4:], branches)
-
- def GitSvn(self, hsh, branch=""):
- return self.step.GitSVNFindSVNRev(hsh, branch)
-
- def SvnGit(self, rev, branch=""):
- return self.step.GitSVNFindGitHash(rev, branch)
-
- def MasterBranch(self):
- return "bleeding_edge"
-
- def CandidateBranch(self):
- return "trunk"
-
- def RemoteMasterBranch(self):
- return "svn/bleeding_edge"
-
- def RemoteCandidateBranch(self):
- return "svn/trunk"
-
- def RemoteBranch(self, name):
- return "svn/%s" % name
-
- def Land(self):
- self.step.GitSVNDCommit()
-
- def CLLand(self):
- self.step.GitDCommit()
-
- def Tag(self, tag, remote, _):
- self.step.GitSVNFetch()
- self.step.Git("rebase %s" % remote)
- self.step.GitSVNTag(tag)
-
-
-class GitTagsOnlyMixin(VCInterface):
+class GitInterface(VCInterface):
def Pull(self):
self.step.GitPull()
def Fetch(self):
self.step.Git("fetch")
- self.step.GitSVNFetch()
def GetTags(self):
return self.step.Git("tag").strip().splitlines()
@@ -401,9 +336,6 @@ class GitTagsOnlyMixin(VCInterface):
return "origin/%s" % name
return "branch-heads/%s" % name
- def PushRef(self, ref):
- self.step.Git("push origin %s" % ref)
-
def Tag(self, tag, remote, message):
# Wait for the commit to appear. Assumes unique commit message titles (this
# is the case for all automated merge and push commits - also no title is
@@ -422,42 +354,14 @@ class GitTagsOnlyMixin(VCInterface):
"git updater is lagging behind?")
self.step.Git("tag %s %s" % (tag, commit))
- self.PushRef(tag)
-
-
-class GitReadSvnWriteInterface(GitTagsOnlyMixin, GitSvnInterface):
- pass
-
-
-class GitInterface(GitTagsOnlyMixin):
- def Fetch(self):
- self.step.Git("fetch")
-
- def GitSvn(self, hsh, branch=""):
- return ""
-
- def SvnGit(self, rev, branch=""):
- raise NotImplementedError()
+ self.step.Git("push origin %s" % tag)
def Land(self):
- # FIXME(machenbach): This will not work with checkouts from bot_update
- # after flag day because it will push to the cache. Investigate if it
- # will work with "cl land".
self.step.Git("push origin")
def CLLand(self):
self.step.GitCLLand()
- def PushRef(self, ref):
- self.step.Git("push https://chromium.googlesource.com/v8/v8 %s" % ref)
-
-
-VC_INTERFACES = {
- "git_svn": GitSvnInterface,
- "git_read_svn_write": GitReadSvnWriteInterface,
- "git": GitInterface,
-}
-
class Step(GitRecipesMixin):
def __init__(self, text, number, config, state, options, handler):
@@ -467,7 +371,7 @@ class Step(GitRecipesMixin):
self._state = state
self._options = options
self._side_effect_handler = handler
- self.vc = VC_INTERFACES[options.vc_interface]()
+ self.vc = GitInterface()
self.vc.InjectStep(self)
# The testing configuration might set a different default cwd.
@@ -561,11 +465,6 @@ class Step(GitRecipesMixin):
raise GitFailedException("'git %s' failed." % args)
return result
- def SVN(self, args="", prefix="", pipe=True, retry_on=None, cwd=None):
- cmd = lambda: self._side_effect_handler.Command(
- "svn", args, prefix, pipe, cwd=cwd or self.default_cwd)
- return self.Retry(cmd, retry_on, [5, 30])
-
def Editor(self, args):
if self._options.requires_editor:
return self._side_effect_handler.Command(
@@ -727,34 +626,6 @@ class Step(GitRecipesMixin):
output += "%s\n" % line
TextToFile(output, version_file)
- def SVNCommit(self, root, commit_message):
- patch = self.GitDiff("HEAD^", "HEAD")
- TextToFile(patch, self._config["PATCH_FILE"])
- self.Command("svn", "update", cwd=self._options.svn)
- if self.Command("svn", "status", cwd=self._options.svn) != "":
- self.Die("SVN checkout not clean.")
- if not self.Command("patch", "-d %s -p1 -i %s" %
- (root, self._config["PATCH_FILE"]),
- cwd=self._options.svn):
- self.Die("Could not apply patch.")
- for line in self.Command(
- "svn", "status", cwd=self._options.svn).splitlines():
- # Check for added and removed items. Svn status has seven status columns.
- # The first contains ? for unknown and ! for missing.
- match = re.match(r"^(.)...... (.*)$", line)
- if match and match.group(1) == "?":
- self.Command("svn", "add --force %s" % match.group(2),
- cwd=self._options.svn)
- if match and match.group(1) == "!":
- self.Command("svn", "delete --force %s" % match.group(2),
- cwd=self._options.svn)
-
- self.Command(
- "svn",
- "commit --non-interactive --username=%s --config-dir=%s -m \"%s\"" %
- (self._options.author, self._options.svn_config, commit_message),
- cwd=self._options.svn)
-
class BootstrapStep(Step):
MESSAGE = "Bootstapping v8 checkout."
@@ -873,17 +744,9 @@ class ScriptsBase(object):
help=("Determine current sheriff to review CLs. On "
"success, this will overwrite the reviewer "
"option."))
- parser.add_argument("--svn",
- help=("Optional full svn checkout for the commit."
- "The folder needs to be the svn root."))
- parser.add_argument("--svn-config",
- help=("Optional folder used as svn --config-dir."))
parser.add_argument("-s", "--step",
help="Specify the step where to start work. Default: 0.",
default=0, type=int)
- parser.add_argument("--vc-interface",
- help=("Choose VC interface out of git_svn|"
- "git_read_svn_write."))
parser.add_argument("--work-dir",
help=("Location where to bootstrap a working v8 "
"checkout."))
@@ -903,10 +766,6 @@ class ScriptsBase(object):
print "To determine the current sheriff, requires the googler mapping"
parser.print_help()
return None
- if options.svn and not options.svn_config:
- print "Using pure svn for committing requires also --svn-config"
- parser.print_help()
- return None
# Defaults for options, common to all scripts.
options.manual = getattr(options, "manual", True)
@@ -924,8 +783,6 @@ class ScriptsBase(object):
parser.print_help()
return None
- if not options.vc_interface:
- options.vc_interface = "git_read_svn_write"
if not options.work_dir:
options.work_dir = "/tmp/v8-release-scripts-work-dir"
return options

Powered by Google App Engine
This is Rietveld 408576698