##// END OF EJS Templates
subrepo: handle 'C:' style paths on the command line (issue5770)...
Matt Harbison -
r35795:0c0689a7 default
parent child Browse files
Show More
@@ -398,15 +398,35 b' def _abssource(repo, push=False, abort=T'
398 398 parent.path = posixpath.normpath(parent.path)
399 399 return bytes(parent)
400 400 else: # recursion reached top repo
401 path = None
401 402 if util.safehasattr(repo, '_subtoppath'):
402 return repo._subtoppath
403 if push and repo.ui.config('paths', 'default-push'):
404 return repo.ui.config('paths', 'default-push')
405 if repo.ui.config('paths', 'default'):
406 return repo.ui.config('paths', 'default')
407 if repo.shared():
408 # chop off the .hg component to get the default path form
403 path = repo._subtoppath
404 elif push and repo.ui.config('paths', 'default-push'):
405 path = repo.ui.config('paths', 'default-push')
406 elif repo.ui.config('paths', 'default'):
407 path = repo.ui.config('paths', 'default')
408 elif repo.shared():
409 # chop off the .hg component to get the default path form. This has
410 # already run through vfsmod.vfs(..., realpath=True), so it doesn't
411 # have problems with 'C:'
409 412 return os.path.dirname(repo.sharedpath)
413 if path:
414 # issue5770: 'C:\' and 'C:' are not equivalent paths. The former is
415 # as expected: an absolute path to the root of the C: drive. The
416 # latter is a relative path, and works like so:
417 #
418 # C:\>cd C:\some\path
419 # C:\>D:
420 # D:\>python -c "import os; print os.path.abspath('C:')"
421 # C:\some\path
422 #
423 # D:\>python -c "import os; print os.path.abspath('C:relative')"
424 # C:\some\path\relative
425 if util.hasdriveletter(path):
426 if len(path) == 2 or path[2:3] not in br'\/':
427 path = os.path.abspath(path)
428 return path
429
410 430 if abort:
411 431 raise error.Abort(_("default path for subrepository not found"))
412 432
General Comments 0
You need to be logged in to leave comments. Login now