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

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: More docu. Created 6 years, 3 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 | « no previous file | tools/push-to-trunk/git_recipes.py » ('j') | tools/push-to-trunk/git_recipes.py » ('J')
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 7ea39f73c95e80c86e10eb960241dc3e7683b76d..1b45aaeb5d9d40261dfe94e4a2ab9ca5581cfd07 100644
--- a/tools/push-to-trunk/common_includes.py
+++ b/tools/push-to-trunk/common_includes.py
@@ -296,6 +296,10 @@ class VCInterface(object):
# 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):
+ """Sets a tag for the current commit.
+
+ Assumptions: The commit already landed and the commit message is unique.
+ """
raise NotImplementedError()
@@ -346,7 +350,7 @@ class GitSvnInterface(VCInterface):
self.step.GitSVNTag(tag)
-class GitReadOnlyMixin(VCInterface):
+class GitTagsOnlyMixin(VCInterface):
def Pull(self):
self.step.GitPull()
@@ -375,8 +379,41 @@ class GitReadOnlyMixin(VCInterface):
return "origin/%s" % name
return "origin/branch-heads/%s" % name
-
-class GitReadSvnWriteInterface(GitReadOnlyMixin, GitSvnInterface):
+ def Tag(self, tag):
+ # Title of the current commit (the local title and the title for committing
+ # is the same in all merge and push scripts).
+ title = self.step.GitLog(n=1, format="%s")
+
+ # Find remote branch where current commit will appear. Assumes everything
+ # to be merge-free (unique parents).
+ branch = None
+ hsh = "HEAD"
+ while not branch:
+ branch = self.step.GitRemoteContains(hsh)
+ hsh += "^"
agable 2014/09/29 09:49:11 Cute. Might be better to actually query Git for th
Michael Achenbach 2014/09/29 10:46:25 Done. Changed the semantics slightly as HEAD alway
+
+ # 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, 5, 10, 30]:
+ self.step.Git("fetch")
+ commit = self.step.GitLog(n=1, format="%H", grep=title, branch=branch)
agable 2014/09/29 09:49:11 This n=1 is dangerous -- what if two commits get r
Michael Achenbach 2014/09/29 10:46:25 But shouldn't the grep on the unique title take ca
+ if commit:
+ break
+ print("The commit is not replicated on git. Waiting for %s seconds." %
agable 2014/09/29 09:49:11 nit: "...has not replicated to..."
Michael Achenbach 2014/09/29 10:46:25 Done.
+ wait_interval)
+ self.step._side_effect_handler.Sleep(wait_interval)
+
+ if not commit:
+ self.step.Die("Couldn't determine commit for setting the tag. Maybe the "
+ "git updater is lacking behind?")
agable 2014/09/29 09:49:11 nit: "lagging"
agable 2014/09/29 09:49:11 nit: indentation
Michael Achenbach 2014/09/29 10:46:24 Done.
Michael Achenbach 2014/09/29 10:46:24 Done.
+
+ self.step.Git("tag %s %s" % (tag, commit))
agable 2014/09/29 09:49:11 The fact that this takes args as a single string i
Michael Achenbach 2014/09/29 10:46:24 I'm sad too. But I'll address this in a separate r
+ self.step.Git("push origin %s" % tag)
+
+
+class GitReadSvnWriteInterface(GitTagsOnlyMixin, GitSvnInterface):
pass
« no previous file with comments | « no previous file | tools/push-to-trunk/git_recipes.py » ('j') | tools/push-to-trunk/git_recipes.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698