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

Side by Side Diff: ensure_dependencies.py

Issue 29329302: Issue 2972 - Properly generate Git ignore paths for dependencies (Closed)
Patch Set: Created Oct. 20, 2015, 9:07 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 cwd=repo, stdout=devnull, stderr=devnull) == 0: 119 cwd=repo, stdout=devnull, stderr=devnull) == 0:
120 newly_tracked = True 120 newly_tracked = True
121 # Finally fetch any newly tracked remote branches 121 # Finally fetch any newly tracked remote branches
122 if newly_tracked: 122 if newly_tracked:
123 subprocess.check_call(["git", "fetch", "--quiet", "origin"], cwd=repo) 123 subprocess.check_call(["git", "fetch", "--quiet", "origin"], cwd=repo)
124 124
125 def update(self, repo, rev): 125 def update(self, repo, rev):
126 subprocess.check_call(["git", "checkout", "--quiet", rev], cwd=repo) 126 subprocess.check_call(["git", "checkout", "--quiet", rev], cwd=repo)
127 127
128 def ignore(self, target, repo): 128 def ignore(self, target, repo):
129 module = os.path.relpath(target, repo) 129 module = os.path.join(os.path.sep, os.path.relpath(target, repo))
130 exclude_file = os.path.join(repo, ".git", "info", "exclude") 130 exclude_file = os.path.join(repo, ".git", "info", "exclude")
131 _ensure_line_exists(exclude_file, module) 131 _ensure_line_exists(exclude_file, module)
132 132
133 def postprocess_url(self, url): 133 def postprocess_url(self, url):
134 # Handle alternative syntax of SSH URLS 134 # Handle alternative syntax of SSH URLS
135 if "@" in url and ":" in url and not urlparse.urlsplit(url).scheme: 135 if "@" in url and ":" in url and not urlparse.urlsplit(url).scheme:
136 return "ssh://" + url.replace(":", "/", 1) 136 return "ssh://" + url.replace(":", "/", 1)
137 return url 137 return url
138 138
139 repo_types = OrderedDict(( 139 repo_types = OrderedDict((
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 args = parser.parse_args() 362 args = parser.parse_args()
363 363
364 if args.quiet: 364 if args.quiet:
365 logging.disable(logging.INFO) 365 logging.disable(logging.INFO)
366 366
367 repos = args.repos 367 repos = args.repos
368 if not len(repos): 368 if not len(repos):
369 repos = [os.path.dirname(__file__)] 369 repos = [os.path.dirname(__file__)]
370 for repo in repos: 370 for repo in repos:
371 resolve_deps(repo) 371 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