| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # coding: utf-8 | 2 # coding: utf-8 |
| 3 | 3 |
| 4 # This file is part of the Adblock Plus build tools, | 4 # This file is part of the Adblock Plus build tools, |
| 5 # Copyright (C) 2006-2014 Eyeo GmbH | 5 # Copyright (C) 2006-2014 Eyeo GmbH |
| 6 # | 6 # |
| 7 # Adblock Plus is free software: you can redistribute it and/or modify | 7 # Adblock Plus is free software: you can redistribute it and/or modify |
| 8 # it under the terms of the GNU General Public License version 3 as | 8 # it under the terms of the GNU General Public License version 3 as |
| 9 # published by the Free Software Foundation. | 9 # published by the Free Software Foundation. |
| 10 # | 10 # |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 68 subprocess.check_call(["hg", "update", "--repository", repo, "--quiet", "--c heck", "--rev", rev]) | 68 subprocess.check_call(["hg", "update", "--repository", repo, "--quiet", "--c heck", "--rev", rev]) |
| 69 | 69 |
| 70 class Git(): | 70 class Git(): |
| 71 def istype(self, repodir): | 71 def istype(self, repodir): |
| 72 return os.path.exists(os.path.join(repodir, ".git")) | 72 return os.path.exists(os.path.join(repodir, ".git")) |
| 73 | 73 |
| 74 def clone(self, source, target): | 74 def clone(self, source, target): |
| 75 source = source.rstrip("/") | 75 source = source.rstrip("/") |
| 76 if not source.endswith(".git"): | 76 if not source.endswith(".git"): |
| 77 source += ".git" | 77 source += ".git" |
| 78 subprocess.check_call(["git", "clone", "--quiet", "--no-checkout", source, t arget]) | 78 subprocess.check_call(["git", "clone", "--quiet", source, target]) |
|
Wladimir Palant
2014/09/18 10:45:59
You probably want to wait until https://issues.adb
mathias
2014/09/18 13:01:25
Done.
| |
| 79 | 79 |
| 80 def get_revision_id(self, repo, rev="HEAD"): | 80 def get_revision_id(self, repo, rev="HEAD"): |
| 81 command = ["git", "-C", repo, "rev-parse", "--revs-only", rev] | 81 command = ["git", "-C", repo, "rev-parse", "--revs-only", rev] |
| 82 return subprocess.check_output(command).strip() | 82 return subprocess.check_output(command).strip() |
| 83 | 83 |
| 84 def pull(self, repo): | 84 def pull(self, repo): |
| 85 subprocess.check_call(["git", "-C", repo, "fetch", "--quiet", "--all", "--ta gs"]) | 85 subprocess.check_call(["git", "-C", repo, "fetch", "--quiet", "--all", "--ta gs"]) |
| 86 | 86 |
| 87 def update(self, repo, rev): | 87 def update(self, repo, rev): |
| 88 subprocess.check_call(["git", "-C", repo, "checkout", "--quiet", rev]) | 88 subprocess.check_call(["git", "-C", repo, "checkout", "--quiet", rev]) |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 246 else: | 246 else: |
| 247 logging.warning("Cannot restart %s automatically, please rerun" % target ) | 247 logging.warning("Cannot restart %s automatically, please rerun" % target ) |
| 248 | 248 |
| 249 if __name__ == "__main__": | 249 if __name__ == "__main__": |
| 250 logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.INFO) | 250 logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.INFO) |
| 251 repos = sys.argv[1:] | 251 repos = sys.argv[1:] |
| 252 if not len(repos): | 252 if not len(repos): |
| 253 repos = [os.getcwd()] | 253 repos = [os.getcwd()] |
| 254 for repo in repos: | 254 for repo in repos: |
| 255 resolve_deps(repo) | 255 resolve_deps(repo) |
| LEFT | RIGHT |