diff --git a/mercurial/hg.py b/mercurial/hg.py --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -122,7 +122,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(util.url(source).path)) + return os.path.basename(os.path.normpath(util.url(source).path or '')) def share(ui, source, dest=None, update=True): '''create a shared repository''' diff --git a/tests/test-largefiles.t b/tests/test-largefiles.t --- a/tests/test-largefiles.t +++ b/tests/test-largefiles.t @@ -831,6 +831,8 @@ Test cloning with --all-largefiles flag commit: (clean) update: 8 new changesets (update) +Show computed destination directory: + $ mkdir xyz $ cd xyz $ hg clone ../a @@ -841,6 +843,12 @@ Test cloning with --all-largefiles flag 5 files updated, 0 files merged, 0 files removed, 0 files unresolved $ cd .. +Clone URL without path: + + $ hg clone file:// + abort: repository / not found! + [255] + Ensure base clone command argument validation $ hg clone -U -u 0 a a-clone-failure