# HG changeset patch # User Matt Harbison # Date 1534567886 14400 # Node ID 143efea71c2ab175b210fc2f400888c2f10c0898 # Parent 8724de87826869acdf0aa0f974260358c8c2db43 clone: allow local cloning to create more than one level of directories I figure cloning a remote repository is more common, thus it's more likely that some people might be relying on the less restrictive behavior. Additionally, `hg init` will also create more than one level of missing directories. I also have a use case for reading the subrepos from .hgsub, and sharing them into the normal nested location on the server. SCM Manager doesn't host subrepos in the normal nested location, which is nice for deduplicating the repository data, but confuses `hg verify`. Some of the subrepos are in the root of the repositories, while others are one or two directories deep. So not having to build up the parent path first is desirable. diff -r 8724de878268 -r 143efea71c2a mercurial/hg.py --- a/mercurial/hg.py Fri Aug 17 23:28:37 2018 -0400 +++ b/mercurial/hg.py Sat Aug 18 00:51:26 2018 -0400 @@ -634,7 +634,7 @@ srcrepo.hook('preoutgoing', throw=True, source='clone') hgdir = os.path.realpath(os.path.join(dest, ".hg")) if not os.path.exists(dest): - os.mkdir(dest) + util.makedirs(dest) else: # only clean up directories we create ourselves cleandir = hgdir diff -r 8724de878268 -r 143efea71c2a tests/test-http.t --- a/tests/test-http.t Fri Aug 17 23:28:37 2018 -0400 +++ b/tests/test-http.t Sat Aug 18 00:51:26 2018 -0400 @@ -494,9 +494,12 @@ new changesets 5fed3813f7f5:56f9bc90cce6 (run 'hg update' to get a working copy) - $ hg clone test/partial/clone test/another/clone - abort: $ENOTDIR$: 'test/another/clone' - [255] + $ hg clone -U -r 0 test/partial/clone test/another/clone + adding changesets + adding manifests + adding file changes + added 1 changesets with 4 changes to 4 files + new changesets 8b6053c928fe corrupt cookies file should yield a warning