Index: ensure_dependencies.py |
diff --git a/ensure_dependencies.py b/ensure_dependencies.py |
index 9f2bcc7b7d8feec57b10e4c6d8b62989171ac8ff..eec44054e5cc12c0b35d484b56e9f8af330726d6 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", "origin"], 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 12:18:55
This regex will match "notorigin/foo" as well. Tha
Sebastian Noack
2015/05/06 12:45:00
Alternatively, not using a regex, might result in
kzar
2015/05/06 12:51:04
Done.
kzar
2015/05/06 12:51:04
I will stick with the regexp, one line in the outp
|
+ remote, local = match.group(0), match.group(1) |
Sebastian Noack
2015/05/06 12:18:55
With the regex suggested above, you can simply cal
kzar
2015/05/06 12:51:04
Done.
|
+ if local != "HEAD": |
+ with open(os.devnull, "w") as devnull: |
Sebastian Noack
2015/05/06 12:18:55
Nit: Please use "wb", no need to have newlines uni
kzar
2015/05/06 12:51:04
Done.
|
+ 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) |
Sebastian Noack
2015/05/06 12:18:55
Please specify "origin" instead "--all" here like
Sebastian Noack
2015/05/06 12:18:55
If you move the --tags option to the first "git fe
kzar
2015/05/06 12:51:04
Done.
|
def update(self, repo, rev): |