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

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

Issue 607893004: Add tag write access to merge script. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review. Created 6 years, 2 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/push-to-trunk/auto_tag.py ('k') | tools/push-to-trunk/git_recipes.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 f015601a070b652b816dfe5e9e0f6814306a0cc6..acbb506b1688d131abadf1e4bca2cd5ec4744240 100644
--- a/tools/push-to-trunk/common_includes.py
+++ b/tools/push-to-trunk/common_includes.py
@@ -295,7 +295,11 @@ class VCInterface(object):
# 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 @@ class GitSvnInterface(VCInterface):
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 @@ class GitReadOnlyMixin(VCInterface):
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
« no previous file with comments | « tools/push-to-trunk/auto_tag.py ('k') | tools/push-to-trunk/git_recipes.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698