# HG changeset patch # User Patrick Mezard # Date 1225229081 -3600 # Node ID ac81ffac0f353419802e42f66d71b0682459acde # Parent b19c0200c90b33c1fa23317ceeca711ac2b61dd8 url: fix file:// URL handling diff -r b19c0200c90b -r ac81ffac0f35 mercurial/url.py --- a/mercurial/url.py Tue Oct 28 20:48:30 2008 +0100 +++ b/mercurial/url.py Tue Oct 28 22:24:41 2008 +0100 @@ -250,7 +250,12 @@ scheme, netloc, urlpath, query, frag = urlparse.urlsplit(path) if not urlpath: urlpath = '/' - urlpath = quotepath(urlpath) + if scheme != 'file': + # XXX: why are we quoting the path again with some smart + # heuristic here? Anyway, it cannot be done with file:// + # urls since path encoding is os/fs dependent (see + # urllib.pathname2url() for details). + urlpath = quotepath(urlpath) host, port, user, passwd = netlocsplit(netloc) # urllib cannot handle URLs with embedded user or passwd @@ -296,7 +301,9 @@ def open(ui, url, data=None): scheme = urlparse.urlsplit(url)[0] if not scheme: - url, authinfo = 'file://' + util.normpath(os.path.abspath(url)), None + path = util.normpath(os.path.abspath(url)) + url = 'file://' + urllib.pathname2url(path) + authinfo = None else: url, authinfo = getauthinfo(url) return opener(ui, authinfo).open(url, data)