Index: ensure_dependencies.py |
diff --git a/ensure_dependencies.py b/ensure_dependencies.py |
index 9f2bcc7b7d8feec57b10e4c6d8b62989171ac8ff..e4655cf6bf577eb3ea3e72a555af000f937a6f8f 100755 |
--- a/ensure_dependencies.py |
+++ b/ensure_dependencies.py |
@@ -97,6 +97,17 @@ class Git(): |
return subprocess.check_output(command, cwd=repo).strip() |
def pull(self, repo): |
+ # First perform a fetch so we have a list of remote branch names |
+ subprocess.check_call(["git", "fetch", "--quiet"], cwd=repo) |
+ # Next we need to ensure all remote branches are tracked |
+ remotes = subprocess.check_output(["git", "branch", "--remotes"], cwd=repo) |
+ for match in re.finditer(r"origin/(\S+)", remotes): |
Sebastian Noack
2015/05/06 11:23:10
I think we should track all remote branches. Not o
kzar
2015/05/06 11:49:14
As discussed in IRC I would prefer to keep this as
|
+ remote, local = match.group(0), match.group(1) |
+ if local not in ["HEAD", "master"]: |
Sebastian Noack
2015/05/06 11:23:10
I think we also should explicitly mark "master" as
kzar
2015/05/06 11:49:14
Done.
|
+ with open(os.devnull, "w") as devnull: |
+ subprocess.call(["git", "branch", "--track", local, remote], |
+ cwd=repo, stdout=devnull, stderr=devnull) |
+ # Finally we need to actually fetch all the remote branches and tags |
subprocess.check_call(["git", "fetch", "--quiet", "--all", "--tags"], cwd=repo) |
def update(self, repo, rev): |