--- a/mercurial/hg.py Thu Jan 30 17:46:51 2014 -0800
+++ b/mercurial/hg.py Mon Feb 03 18:09:08 2014 -0600
@@ -82,7 +82,7 @@
return thing
def islocal(repo):
- '''return true if repo or path is local'''
+ '''return true if repo (or path pointing to repo) is local'''
if isinstance(repo, str):
try:
return _peerlookup(repo).islocal(repo)
@@ -92,8 +92,9 @@
def openpath(ui, path):
'''open path with open if local, url.open if remote'''
- if islocal(path):
- return util.posixfile(util.urllocalpath(path), 'rb')
+ pathurl = util.url(path, parsequery=False, parsefragment=False)
+ if pathurl.islocal():
+ return util.posixfile(pathurl.localpath(), 'rb')
else:
return url.open(ui, path)
--- a/mercurial/util.py Thu Jan 30 17:46:51 2014 -0800
+++ b/mercurial/util.py Mon Feb 03 18:09:08 2014 -0600
@@ -1875,6 +1875,11 @@
return path
return self._origpath
+ def islocal(self):
+ '''whether localpath will return something that posixfile can open'''
+ return (not self.scheme or self.scheme == 'file'
+ or self.scheme == 'bundle')
+
def hasscheme(path):
return bool(url(path).scheme)