Mercurial > hg
changeset 15496:396e83d635a6 stable
url: handle file://localhost/c:/foo "correctly"
The path was parsed correctly, but localpath prepended an extra '/' (as in
'/c:/foo') because it assumed it was an absolute unix path.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Wed, 16 Nov 2011 00:10:56 +0100 |
parents | e99facd2cd2a |
children | 9bea3aed6ee1 |
files | mercurial/util.py tests/test-url.py |
diffstat | 2 files changed, 10 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/util.py Wed Nov 16 00:10:52 2011 +0100 +++ b/mercurial/util.py Wed Nov 16 00:10:56 2011 +0100 @@ -1708,7 +1708,8 @@ # letters to paths with drive letters. if hasdriveletter(self._hostport): path = self._hostport + '/' + self.path - elif self.host is not None and self.path: + elif (self.host is not None and self.path + and not hasdriveletter(path)): path = '/' + path return path return self._origpath
--- a/tests/test-url.py Wed Nov 16 00:10:52 2011 +0100 +++ b/tests/test-url.py Wed Nov 16 00:10:56 2011 +0100 @@ -223,6 +223,14 @@ >>> u.localpath() 'f:oo/bar/baz' + >>> u = url('file://localhost/f:oo/bar/baz') + >>> u + <url scheme: 'file', host: 'localhost', path: 'f:oo/bar/baz'> + >>> str(u) + 'file://localhost/f%3Aoo/bar/baz' + >>> u.localpath() + 'f:oo/bar/baz' + >>> u = url('file:foo/bar/baz') >>> u <url scheme: 'file', path: 'foo/bar/baz'>