diff --git a/mercurial/hg.py b/mercurial/hg.py --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -115,7 +115,7 @@ def peer(uiorrepo, opts, path, create=Fa 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''' diff --git a/tests/test-ssh.t b/tests/test-ssh.t --- a/tests/test-ssh.t +++ b/tests/test-ssh.t @@ -284,6 +284,13 @@ Test remote paths with spaces (issue2983 $ 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 @@ Test hg-ssh in read-only mode: 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