Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: ensure_dependencies.py

Issue 4814432072892416: Issue 1777 - ensure_dependencies.py fails to detect unknown Git revisions (Closed)
Patch Set: Created Jan. 11, 2015, 11:07 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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):
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld