[PATCH 3 of 4] util: localpath on urls should always unescape (issue2983)
Mads Kiilerich
mads at kiilerich.com
Thu Dec 8 09:39:25 CST 2011
# HG changeset patch
# User Mads Kiilerich <mads at kiilerich.com>
# Date 1323358745 -3600
# Node ID 2ea90c856cf5f05cd5b3815fdd1d41e42cc19dc2
# Parent 77453ef261ddcf5e672a6ec0ff6a5f578bcb8ccc
util: localpath on urls should always unescape (issue2983)
This gives the expected default name for local clones from urls with space in
the repo name.
diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -1709,8 +1709,8 @@
elif (self.host is not None and self.path
and not hasdriveletter(path)):
path = '/' + path
- return path
- return self._origpath
+ return _urlunquote(path)
+ return _urlunquote(self._origpath)
def hasscheme(path):
return bool(url(path).scheme)
diff --git a/tests/test-ssh.t b/tests/test-ssh.t
--- a/tests/test-ssh.t
+++ b/tests/test-ssh.t
@@ -286,6 +286,10 @@
remote: Illegal command "'hg' -R 'a'repo' serve --stdio": No closing quotation
abort: no suitable response from remote hg!
[255]
+ $ SSH_ORIGINAL_COMMAND="'hg' -R 'a repo' serve --stdio" hg clone --ssh "python \"$TESTDIR\"/../contrib/hg-ssh \"$TESTTMP/a repo\"" "ssh://user@dummy/a repo"
+ destination directory: a%20repo
+ abort: destination 'a repo' is not empty
+ [255]
$ cat dummylog
Got arguments 1:user at dummy 2:hg -R nonexistent serve --stdio
diff --git a/tests/test-url.py b/tests/test-url.py
--- a/tests/test-url.py
+++ b/tests/test-url.py
@@ -194,18 +194,22 @@
Invalid path:
- >>> u = url('http://foo/bar')
+ >>> u = url('http://foo/bar bar')
+ >>> u.localpath()
+ 'http://foo/bar bar'
+ >>> str(u)
+ 'http://foo/bar%20bar'
>>> u.path = 'bar'
>>> str(u)
'http://foo/bar'
- >>> u = url('file:/foo/bar/baz')
+ >>> u = url('file:/foo/bar/b z')
>>> u
- <url scheme: 'file', path: '/foo/bar/baz'>
+ <url scheme: 'file', path: '/foo/bar/b z'>
>>> str(u)
- 'file:///foo/bar/baz'
+ 'file:///foo/bar/b%20z'
>>> u.localpath()
- '/foo/bar/baz'
+ '/foo/bar/b z'
>>> u = url('file:///foo/bar/baz')
>>> u
More information about the Mercurial-devel
mailing list