Revision: 24431
Author: [email protected]
Date: Tue Oct 7 10:46:04 2014 UTC
Log: Add tag write access to merge script.
The script will poll the remote branch until the git updater
has replicated the commit to tag. The tag will then be
directly pushed to git.
BUG=chromium:410721
LOG=n
TEST=script_test.py
[email protected], [email protected]
[email protected]
Review URL: https://codereview.chromium.org/607893004
https://code.google.com/p/v8/source/detail?r=24431
Modified:
/branches/bleeding_edge/tools/push-to-trunk/auto_tag.py
/branches/bleeding_edge/tools/push-to-trunk/common_includes.py
/branches/bleeding_edge/tools/push-to-trunk/git_recipes.py
/branches/bleeding_edge/tools/push-to-trunk/merge_to_branch.py
/branches/bleeding_edge/tools/push-to-trunk/push_to_trunk.py
/branches/bleeding_edge/tools/push-to-trunk/test_scripts.py
=======================================
--- /branches/bleeding_edge/tools/push-to-trunk/auto_tag.py Tue Sep 30
13:12:44 2014 UTC
+++ /branches/bleeding_edge/tools/push-to-trunk/auto_tag.py Tue Oct 7
10:46:04 2014 UTC
@@ -153,7 +153,9 @@
if not self._options.dry_run:
self.GitReset(self["lkgr"])
# FIXME(machenbach): Make this work with the git repo.
- self.vc.Tag(self["candidate_version"], "svn/bleeding_edge")
+ self.vc.Tag(self["candidate_version"],
+ "svn/bleeding_edge",
+ "This won't work!")
class CleanUp(Step):
=======================================
--- /branches/bleeding_edge/tools/push-to-trunk/common_includes.py Tue Sep
30 13:12:44 2014 UTC
+++ /branches/bleeding_edge/tools/push-to-trunk/common_includes.py Tue Oct
7 10:46:04 2014 UTC
@@ -295,7 +295,11 @@
# 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):
+ def Tag(self, tag, remote, message):
+ """Sets a tag for the current commit.
+
+ Assumptions: The commit already landed and the commit message is
unique.
+ """
raise NotImplementedError()
@@ -342,13 +346,13 @@
def CLLand(self):
self.step.GitDCommit()
- def Tag(self, tag, remote):
+ def Tag(self, tag, remote, _):
self.step.GitSVNFetch()
self.step.Git("rebase %s" % remote)
self.step.GitSVNTag(tag)
-class GitReadOnlyMixin(VCInterface):
+class GitTagsOnlyMixin(VCInterface):
def Pull(self):
self.step.GitPull()
@@ -377,8 +381,28 @@
return "origin/%s" % name
return "origin/branch-heads/%s" % name
+ 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
+ # the prefix of another title).
+ commit = None
+ for wait_interval in [3, 7, 15, 35]:
+ self.step.Git("fetch")
+ commit = self.step.GitLog(n=1, format="%H", grep=message,
branch=remote)
+ if commit:
+ break
+ print("The commit has not replicated to git. Waiting for %s
seconds." %
+ wait_interval)
+ self.step._side_effect_handler.Sleep(wait_interval)
+ else:
+ self.step.Die("Couldn't determine commit for setting the tag. Maybe
the "
+ "git updater is lagging behind?")
+
+ self.step.Git("tag %s %s" % (tag, commit))
+ self.step.Git("push origin %s" % tag)
+
-class GitReadSvnWriteInterface(GitReadOnlyMixin, GitSvnInterface):
+class GitReadSvnWriteInterface(GitTagsOnlyMixin, GitSvnInterface):
pass
=======================================
--- /branches/bleeding_edge/tools/push-to-trunk/git_recipes.py Fri Sep 26
10:16:16 2014 UTC
+++ /branches/bleeding_edge/tools/push-to-trunk/git_recipes.py Tue Oct 7
10:46:04 2014 UTC
@@ -80,7 +80,11 @@
def Strip(f):
def new_f(*args, **kwargs):
- return f(*args, **kwargs).strip()
+ result = f(*args, **kwargs)
+ if result is None:
+ return result
+ else:
+ return result.strip()
return new_f
=======================================
--- /branches/bleeding_edge/tools/push-to-trunk/merge_to_branch.py Tue Sep
30 13:12:44 2014 UTC
+++ /branches/bleeding_edge/tools/push-to-trunk/merge_to_branch.py Tue Oct
7 10:46:04 2014 UTC
@@ -198,6 +198,7 @@
else:
title = ("Version %s (merged %s)"
% (self["version"], self["revision_list"]))
+ self["commit_title"] = title
self["new_commit_msg"] = "%s\n\n%s" % (title, self["new_commit_msg"])
TextToFile(self["new_commit_msg"], self.Config("COMMITMSG_FILE"))
self.GitCommit(file_name=self.Config("COMMITMSG_FILE"))
@@ -219,8 +220,10 @@
def RunStep(self):
if self._options.revert_bleeding_edge:
return
- print "Creating tag svn/tags/%s" % self["version"]
- self.vc.Tag(self["version"],
self.vc.RemoteBranch(self["merge_to_branch"]))
+ print "Creating tag %s" % self["version"]
+ self.vc.Tag(self["version"],
+ self.vc.RemoteBranch(self["merge_to_branch"]),
+ self["commit_title"])
class CleanUp(Step):
=======================================
--- /branches/bleeding_edge/tools/push-to-trunk/push_to_trunk.py Tue Sep 30
13:12:44 2014 UTC
+++ /branches/bleeding_edge/tools/push-to-trunk/push_to_trunk.py Tue Oct 7
10:46:04 2014 UTC
@@ -285,6 +285,7 @@
if not text: # pragma: no cover
self.Die("Commit message editing failed.")
+ self["commit_title"] = text.splitlines()[0]
TextToFile(text, self.Config("COMMITMSG_FILE"))
@@ -361,7 +362,8 @@
MESSAGE = "Tag the new revision."
def RunStep(self):
- self.vc.Tag(self["version"], self.vc.RemoteCandidateBranch())
+ self.vc.Tag(
+ self["version"], self.vc.RemoteCandidateBranch(),
self["commit_title"])
class CleanUp(Step):
=======================================
--- /branches/bleeding_edge/tools/push-to-trunk/test_scripts.py Tue Sep 30
13:12:44 2014 UTC
+++ /branches/bleeding_edge/tools/push-to-trunk/test_scripts.py Tue Oct 7
10:46:04 2014 UTC
@@ -488,6 +488,24 @@
])
self.MakeStep().InitialEnvironmentChecks(TEST_CONFIG["DEFAULT_CWD"])
+ def testTagTimeout(self):
+ self.Expect([
+ Cmd("git fetch", ""),
+ Cmd("git log -1 --format=%H --grep=\"Title\" origin/candidates", ""),
+ Cmd("git fetch", ""),
+ Cmd("git log -1 --format=%H --grep=\"Title\" origin/candidates", ""),
+ Cmd("git fetch", ""),
+ Cmd("git log -1 --format=%H --grep=\"Title\" origin/candidates", ""),
+ Cmd("git fetch", ""),
+ Cmd("git log -1 --format=%H --grep=\"Title\" origin/candidates", ""),
+ ])
+ args =
["--branch", "candidates", "--vc-interface", "git_read_svn_write",
+ "12345"]
+ self._state["version"] = "tag_name"
+ self._state["commit_title"] = "Title"
+ self.assertRaises(Exception,
+ lambda: self.RunStep(MergeToBranch, TagRevision, args))
+
def testReadAndPersistVersion(self):
self.WriteFakeVersionFile(build=5)
step = self.MakeStep()
@@ -1276,10 +1294,18 @@
Cmd("git cl presubmit", "Presubmit successfull\n"),
Cmd("git cl dcommit -f --bypass-hooks", "Closing issue\n",
cb=VerifySVNCommit),
- # FIXME(machenbach): This won't work when setting tags on the git
repo.
- Cmd("git svn fetch", ""),
- Cmd("git rebase origin/candidates", ""),
- Cmd("git svn tag 3.22.5.1 -m \"Tagging version 3.22.5.1\"", ""),
+ Cmd("git fetch", ""),
+ Cmd("git log -1 --format=%H --grep=\""
+ "Version 3.22.5.1 (merged r12345, r23456, r34567, r45678,
r56789)"
+ "\" origin/candidates",
+ ""),
+ Cmd("git fetch", ""),
+ Cmd("git log -1 --format=%H --grep=\""
+ "Version 3.22.5.1 (merged r12345, r23456, r34567, r45678,
r56789)"
+ "\" origin/candidates",
+ "hsh_to_tag"),
+ Cmd("git tag 3.22.5.1 hsh_to_tag", ""),
+ Cmd("git push origin 3.22.5.1", ""),
Cmd("git checkout -f some_branch", ""),
Cmd("git branch -D %s" % TEST_CONFIG["BRANCHNAME"], ""),
])
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.