merge with stable
authorMatt Mackall <mpm@selenic.com>
Mon, 03 Feb 2014 18:09:08 -0600
changeset 20356 ec5d4287a426
parent 20352 58300f61b139 (current diff)
parent 20355 7d269e7620c4 (diff)
child 20358 4276c906d90e
merge with stable
--- 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)