Mercurial > hg
changeset 20356:ec5d4287a426
merge with stable
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 03 Feb 2014 18:09:08 -0600 |
parents | 58300f61b139 (current diff) 7d269e7620c4 (diff) |
children | 4276c906d90e |
files | |
diffstat | 2 files changed, 9 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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)