OLD | NEW |
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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 return | 180 return |
181 | 181 |
182 parenttype = get_repo_type(parentrepo) | 182 parenttype = get_repo_type(parentrepo) |
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 url = urlparse.urljoin(roots[type], sourcename) | 190 if os.path.exists(roots[type]): |
| 191 url = os.path.join(roots[type], sourcename) |
| 192 else: |
| 193 url = urlparse.urljoin(roots[type], sourcename) |
| 194 |
191 logging.info("Cloning repository %s into %s" % (url, target)) | 195 logging.info("Cloning repository %s into %s" % (url, target)) |
192 repo_types[type].clone(url, target) | 196 repo_types[type].clone(url, target) |
193 | 197 |
194 for repo in repo_types.itervalues(): | 198 for repo in repo_types.itervalues(): |
195 if repo.istype(parentrepo): | 199 if repo.istype(parentrepo): |
196 repo.ignore(target, parentrepo) | 200 repo.ignore(target, parentrepo) |
197 | 201 |
198 def update_repo(target, revisions): | 202 def update_repo(target, revisions): |
199 type = get_repo_type(target) | 203 type = get_repo_type(target) |
200 if type is None: | 204 if type is None: |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 args = parser.parse_args() | 290 args = parser.parse_args() |
287 | 291 |
288 if args.quiet: | 292 if args.quiet: |
289 logging.disable(logging.INFO) | 293 logging.disable(logging.INFO) |
290 | 294 |
291 repos = args.repos | 295 repos = args.repos |
292 if not len(repos): | 296 if not len(repos): |
293 repos = [os.path.dirname(__file__)] | 297 repos = [os.path.dirname(__file__)] |
294 for repo in repos: | 298 for repo in repos: |
295 resolve_deps(repo) | 299 resolve_deps(repo) |
OLD | NEW |