Index: ensure_dependencies.py |
=================================================================== |
--- a/ensure_dependencies.py |
+++ b/ensure_dependencies.py |
@@ -84,18 +84,23 @@ class Git(): |
def clone(self, source, target): |
source = source.rstrip("/") |
if not source.endswith(".git"): |
source += ".git" |
subprocess.check_call(["git", "clone", "--quiet", source, target]) |
def get_revision_id(self, repo, rev="HEAD"): |
- command = ["git", "rev-parse", "--revs-only", rev] |
- return subprocess.check_output(command, cwd=repo).strip() |
+ command = ["git", "rev-list", "--remotes=*", "--max-count=1", rev] |
Wladimir Palant
2015/01/11 23:10:22
Note that I don't really know how to use Git, and
Wladimir Palant
2015/01/11 23:39:28
I noticed that the rev-list with --remotes specifi
|
+ process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=repo) |
+ |
+ # Ignore stderr output and return code here: if revision lookup failed we |
+ # should simply return an empty string. |
+ result = process.communicate()[0] |
+ return result.strip() |
def pull(self, repo): |
subprocess.check_call(["git", "fetch", "--quiet", "--all", "--tags"], cwd=repo) |
def update(self, repo, rev): |
subprocess.check_call(["git", "checkout", "--quiet", rev], cwd=repo) |
def ignore(self, target, repo): |