##// END OF EJS Templates
merge with stable
Matt Mackall -
r20356:ec5d4287 merge default
parent child Browse files
Show More
@@ -82,7 +82,7 b' def _peerlookup(path):'
82 return thing
82 return thing
83
83
84 def islocal(repo):
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 if isinstance(repo, str):
86 if isinstance(repo, str):
87 try:
87 try:
88 return _peerlookup(repo).islocal(repo)
88 return _peerlookup(repo).islocal(repo)
@@ -92,8 +92,9 b' def islocal(repo):'
92
92
93 def openpath(ui, path):
93 def openpath(ui, path):
94 '''open path with open if local, url.open if remote'''
94 '''open path with open if local, url.open if remote'''
95 if islocal(path):
95 pathurl = util.url(path, parsequery=False, parsefragment=False)
96 return util.posixfile(util.urllocalpath(path), 'rb')
96 if pathurl.islocal():
97 return util.posixfile(pathurl.localpath(), 'rb')
97 else:
98 else:
98 return url.open(ui, path)
99 return url.open(ui, path)
99
100
@@ -1875,6 +1875,11 b' class url(object):'
1875 return path
1875 return path
1876 return self._origpath
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 def hasscheme(path):
1883 def hasscheme(path):
1879 return bool(url(path).scheme)
1884 return bool(url(path).scheme)
1880
1885
General Comments 0
You need to be logged in to leave comments. Login now