clone: don't %-escape the default destination (issue3145) stable
authorMatt Mackall <mpm@selenic.com>
Fri, 19 Oct 2012 14:47:55 -0500
branchstable
changeset 17844 b32e55e6c3c7
parent 17843 66a613b59221
child 17845 408ded42c5ec
clone: don't %-escape the default destination (issue3145)
mercurial/hg.py
tests/test-ssh.t
--- a/mercurial/hg.py	Fri Oct 19 15:45:16 2012 +0200
+++ b/mercurial/hg.py	Fri Oct 19 14:47:55 2012 -0500
@@ -115,7 +115,7 @@
 
 def defaultdest(source):
     '''return default destination of clone if none is given'''
-    return os.path.basename(os.path.normpath(source))
+    return os.path.basename(os.path.normpath(util.url(source).path))
 
 def share(ui, source, dest=None, update=True):
     '''create a shared repository'''
--- a/tests/test-ssh.t	Fri Oct 19 15:45:16 2012 +0200
+++ b/tests/test-ssh.t	Fri Oct 19 14:47:55 2012 -0500
@@ -284,6 +284,13 @@
   $ hg id --ssh "python \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo"
   73649e48688a
 
+Test (non-)escaping of remote paths with spaces when cloning (issue3145):
+
+  $ hg clone --ssh "python \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo"
+  destination directory: a repo
+  abort: destination 'a repo' is not empty
+  [255]
+
 Test hg-ssh using a helper script that will restore PYTHONPATH (which might
 have been cleared by a hg.exe wrapper) and invoke hg-ssh with the right
 parameters:
@@ -374,3 +381,4 @@
   Got arguments 1:user@dummy 2:hg init 'a repo'
   Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
   Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
+  Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio