Show More
@@ -82,7 +82,7 b' def _peerlookup(path):' | |||
|
82 | 82 | return thing |
|
83 | 83 | |
|
84 | 84 | def islocal(repo): |
|
85 | '''return true if repo or path is local''' | |
|
85 | '''return true if repo (or path pointing to repo) is local''' | |
|
86 | 86 | if isinstance(repo, str): |
|
87 | 87 | try: |
|
88 | 88 | return _peerlookup(repo).islocal(repo) |
@@ -92,8 +92,9 b' def islocal(repo):' | |||
|
92 | 92 | |
|
93 | 93 | def openpath(ui, path): |
|
94 | 94 | '''open path with open if local, url.open if remote''' |
|
95 | if islocal(path): | |
|
96 | return util.posixfile(util.urllocalpath(path), 'rb') | |
|
95 | pathurl = util.url(path, parsequery=False, parsefragment=False) | |
|
96 | if pathurl.islocal(): | |
|
97 | return util.posixfile(pathurl.localpath(), 'rb') | |
|
97 | 98 | else: |
|
98 | 99 | return url.open(ui, path) |
|
99 | 100 |
@@ -1875,6 +1875,11 b' class url(object):' | |||
|
1875 | 1875 | return path |
|
1876 | 1876 | return self._origpath |
|
1877 | 1877 | |
|
1878 | def islocal(self): | |
|
1879 | '''whether localpath will return something that posixfile can open''' | |
|
1880 | return (not self.scheme or self.scheme == 'file' | |
|
1881 | or self.scheme == 'bundle') | |
|
1882 | ||
|
1878 | 1883 | def hasscheme(path): |
|
1879 | 1884 | return bool(url(path).scheme) |
|
1880 | 1885 |
General Comments 0
You need to be logged in to leave comments.
Login now