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

Unified Diff: ensure_dependencies.py

Issue 6068640302497792: Issue 2311 - Track remote Git branches when required (Closed)
Patch Set: Created April 30, 2015, 5:30 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
diff --git a/ensure_dependencies.py b/ensure_dependencies.py
index b6557d051f6661645dea95edfde280ea288f7533..6bf7627872759385d4d636b167b9ed5edc16457b 100755
--- a/ensure_dependencies.py
+++ b/ensure_dependencies.py
@@ -53,7 +53,7 @@ class Mercurial():
result = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[0]
return result.strip()
- def pull(self, repo):
+ def pull(self, repo, rev):
subprocess.check_call(["hg", "pull", "--repository", repo, "--quiet"])
def update(self, repo, rev):
@@ -96,8 +96,9 @@ class Git():
command = ["git", "rev-parse", "--revs-only", rev + '^{commit}']
return subprocess.check_output(command, cwd=repo).strip()
- def pull(self, repo):
+ def pull(self, repo, rev):
subprocess.check_call(["git", "fetch", "--quiet", "--all", "--tags"], cwd=repo)
+ subprocess.check_call(["git", "checkout", rev], cwd=repo)
Sebastian Noack 2015/04/30 17:54:34 Wasn't the problem you try to address here, that b
kzar 2015/04/30 19:31:46 So it turns out the remote branches are fetched, t
Sebastian Noack 2015/04/30 20:53:57 Isn't this call redundant with the one in Git.upda
kzar 2015/05/01 09:43:55 As of Git 1.6.6 [1] checking out a local branch wh
Sebastian Noack 2015/05/04 11:44:31 If I understand the issue correctly, this change i
kzar 2015/05/05 13:33:55 Then you do not understand this change properly. W
Sebastian Noack 2015/05/05 15:08:54 Ok, got it. But this still seems like a silly hack
kzar 2015/05/05 15:26:52 The remote branch has already been fetched, we jus
Sebastian Noack 2015/05/05 16:00:54 I think I'd prefer that one. If something went wro
Sebastian Noack 2015/05/05 16:59:02 But either way, this will only work if you specify
Sebastian Noack 2015/05/05 17:35:05 After thinking a little more about the problem and
kzar 2015/05/06 11:04:44 Done.
def update(self, repo, rev):
subprocess.check_call(["git", "checkout", "--quiet", rev], cwd=repo)
@@ -229,7 +230,7 @@ def update_repo(target, revisions):
resolved_revision = repo_types[type].get_revision_id(target, revision)
if not resolved_revision:
logging.info("Revision %s is unknown, downloading remote changes" % revision)
- repo_types[type].pull(target)
+ repo_types[type].pull(target, revision)
resolved_revision = repo_types[type].get_revision_id(target, revision)
if not resolved_revision:
raise Exception("Failed to resolve revision %s" % revision)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld