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

Side by Side Diff: ensure_dependencies.py

Issue 6490407919681536: Issue 1366 - ensure_dependencies.py checkout fails for master revision (Closed)
Patch Set: Created Sept. 11, 2014, 7:34 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # coding: utf-8 2 # coding: utf-8
3 3
4 # This Source Code Form is subject to the terms of the Mozilla Public 4 # This Source Code Form is subject to the terms of the Mozilla Public
5 # License, v. 2.0. If a copy of the MPL was not distributed with this 5 # License, v. 2.0. If a copy of the MPL was not distributed with this
6 # file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 7
8 import sys 8 import sys
9 import os 9 import os
10 import posixpath 10 import posixpath
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 subprocess.check_call(["hg", "update", "--repository", repo, "--quiet", "--c heck", "--rev", rev]) 57 subprocess.check_call(["hg", "update", "--repository", repo, "--quiet", "--c heck", "--rev", rev])
58 58
59 class Git(): 59 class Git():
60 def istype(self, repodir): 60 def istype(self, repodir):
61 return os.path.exists(os.path.join(repodir, ".git")) 61 return os.path.exists(os.path.join(repodir, ".git"))
62 62
63 def clone(self, source, target): 63 def clone(self, source, target):
64 source = source.rstrip("/") 64 source = source.rstrip("/")
65 if not source.endswith(".git"): 65 if not source.endswith(".git"):
66 source += ".git" 66 source += ".git"
67 subprocess.check_call(["git", "clone", "--quiet", "--no-checkout", source, t arget]) 67 subprocess.check_call(["git", "clone", "--quiet", source, target])
68 68
69 def get_revision_id(self, repo, rev="HEAD"): 69 def get_revision_id(self, repo, rev="HEAD"):
70 command = ["git", "-C", repo, "rev-parse", "--revs-only", rev] 70 command = ["git", "-C", repo, "rev-parse", "--revs-only", rev]
71 return subprocess.check_output(command).strip() 71 return subprocess.check_output(command).strip()
72 72
73 def pull(self, repo): 73 def pull(self, repo):
74 subprocess.check_call(["git", "-C", repo, "fetch", "--quiet", "--all", "--ta gs"]) 74 subprocess.check_call(["git", "-C", repo, "fetch", "--quiet", "--all", "--ta gs"])
75 75
76 def update(self, repo, rev): 76 def update(self, repo, rev):
77 subprocess.check_call(["git", "-C", repo, "checkout", "--quiet", rev]) 77 subprocess.check_call(["git", "-C", repo, "checkout", "--quiet", rev])
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 else: 235 else:
236 logging.warning("Cannot restart %s automatically, please rerun" % target ) 236 logging.warning("Cannot restart %s automatically, please rerun" % target )
237 237
238 if __name__ == "__main__": 238 if __name__ == "__main__":
239 logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.INFO) 239 logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.INFO)
240 repos = sys.argv[1:] 240 repos = sys.argv[1:]
241 if not len(repos): 241 if not len(repos):
242 repos = [os.getcwd()] 242 repos = [os.getcwd()]
243 for repo in repos: 243 for repo in repos:
244 resolve_deps(repo) 244 resolve_deps(repo)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld