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

Side by Side Diff: ensure_dependencies.py

Issue 4542760560361472: Issue 2310 - Handle alternative syntax of Git SSH URLs (Closed)
Patch Set: Created April 29, 2015, 5:10 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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 type = None 183 type = None
184 for key in roots: 184 for key in roots:
185 if key == parenttype or (key in repo_types and type is None): 185 if key == parenttype or (key in repo_types and type is None):
186 type = key 186 type = key
187 if type is None: 187 if type is None:
188 raise Exception("No valid source found to create %s" % target) 188 raise Exception("No valid source found to create %s" % target)
189 189
190 if os.path.exists(roots[type]): 190 if os.path.exists(roots[type]):
191 url = os.path.join(roots[type], sourcename) 191 url = os.path.join(roots[type], sourcename)
192 else: 192 else:
193 url = urlparse.urljoin(roots[type], sourcename) 193 if (type == "git" and "@" in sourcename and
194 not urlparse.urlsplit(sourcename).scheme):
195 # Handle alternative syntax of Git SSH URLS
196 url = "ssh://" + sourcename.replace(":", "/", 1)
197 else:
Wladimir Palant 2015/04/29 18:03:05 This seems to be the wrong place to do it. What we
198 url = urlparse.urljoin(roots[type], sourcename)
194 199
195 logging.info("Cloning repository %s into %s" % (url, target)) 200 logging.info("Cloning repository %s into %s" % (url, target))
196 repo_types[type].clone(url, target) 201 repo_types[type].clone(url, target)
197 202
198 for repo in repo_types.itervalues(): 203 for repo in repo_types.itervalues():
199 if repo.istype(parentrepo): 204 if repo.istype(parentrepo):
200 repo.ignore(target, parentrepo) 205 repo.ignore(target, parentrepo)
201 206
202 def update_repo(target, revisions): 207 def update_repo(target, revisions):
203 type = get_repo_type(target) 208 type = get_repo_type(target)
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 args = parser.parse_args() 295 args = parser.parse_args()
291 296
292 if args.quiet: 297 if args.quiet:
293 logging.disable(logging.INFO) 298 logging.disable(logging.INFO)
294 299
295 repos = args.repos 300 repos = args.repos
296 if not len(repos): 301 if not len(repos):
297 repos = [os.path.dirname(__file__)] 302 repos = [os.path.dirname(__file__)]
298 for repo in repos: 303 for repo in repos:
299 resolve_deps(repo) 304 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