changeset 39185:143efea71c2a

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.
author Matt Harbison <matt_harbison@yahoo.com>
date Sat, 18 Aug 2018 00:51:26 -0400
parents 8724de878268
children e8deaa77c1b6
files mercurial/hg.py tests/test-http.t
diffstat 2 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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
--- 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