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

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

Issue 227583002: Add V8 releases script. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix checking changed files at branch roots. Created 6 years, 8 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/common_includes.py ('k') | tools/push-to-trunk/releases.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/push-to-trunk/git_recipes.py
diff --git a/tools/push-to-trunk/git_recipes.py b/tools/push-to-trunk/git_recipes.py
index c0f0afbede5c17ba122ef1c56ab8a0afe81242b3..8c1e314d7d8c7e493750918295dd044fba4c9b0a 100644
--- a/tools/push-to-trunk/git_recipes.py
+++ b/tools/push-to-trunk/git_recipes.py
@@ -28,6 +28,11 @@
import re
+
+class GitFailedException(Exception):
+ pass
+
+
def Strip(f):
def new_f(*args, **kwargs):
return f(*args, **kwargs).strip()
@@ -59,6 +64,13 @@ class GitRecipesMixin(object):
assert name
self.Git(MakeArgs(["branch -D", name]))
+ def GitReset(self, name):
+ assert name
+ self.Git(MakeArgs(["reset --hard", name]))
+
+ def GitRemotes(self):
+ return map(str.strip, self.Git(MakeArgs(["branch -r"])).splitlines())
+
def GitCheckout(self, name):
assert name
self.Git(MakeArgs(["checkout -f", name]))
@@ -68,6 +80,26 @@ class GitRecipesMixin(object):
assert branch_or_hash
self.Git(MakeArgs(["checkout -f", branch_or_hash, "--", name]))
+ def GitCheckoutFileSafe(self, name, branch_or_hash):
+ try:
+ self.GitCheckoutFile(name, branch_or_hash)
+ except GitFailedException: # pragma: no cover
+ # The file doesn't exist in that revision.
+ return False
+ return True
+
+ def GitChangedFiles(self, git_hash):
+ assert git_hash
+ try:
+ files = self.Git(MakeArgs(["diff --name-only",
+ git_hash,
+ "%s^" % git_hash]))
+ return map(str.strip, files.splitlines())
+ except GitFailedException: # pragma: no cover
+ # Git fails using "^" at branch roots.
+ return []
+
+
@Strip
def GitCurrentBranch(self):
for line in self.Git("status -s -b -uno").strip().splitlines():
@@ -99,6 +131,7 @@ class GitRecipesMixin(object):
assert git_hash
return self.Git(MakeArgs(["log", "-1", "-p", git_hash]))
+ # TODO(machenbach): Unused? Remove.
def GitAdd(self, name):
assert name
self.Git(MakeArgs(["add", Quoted(name)]))
@@ -147,6 +180,7 @@ class GitRecipesMixin(object):
def GitSVNFetch(self):
self.Git("svn fetch")
+ # TODO(machenbach): Unused? Remove.
@Strip
def GitSVNLog(self):
return self.Git("svn log -1 --oneline")
« no previous file with comments | « tools/push-to-trunk/common_includes.py ('k') | tools/push-to-trunk/releases.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698