mercurial/localrepo.py
changeset 39847 b504ff813c4f
parent 39846 d3e761f9ac0a
child 39848 4ece3cdfd907
--- a/mercurial/localrepo.py	Wed Sep 19 16:15:22 2018 -0700
+++ b/mercurial/localrepo.py	Wed Sep 19 16:51:57 2018 -0700
@@ -2798,13 +2798,14 @@
     requirements = newreporequirements(ui, createopts=createopts)
 
     wdirvfs = vfsmod.vfs(path, expandpath=True, realpath=True)
-    if not wdirvfs.exists():
-        wdirvfs.makedirs()
 
     hgvfs = vfsmod.vfs(wdirvfs.join(b'.hg'))
     if hgvfs.exists():
         raise error.RepoError(_('repository %s already exists') % path)
 
+    if not wdirvfs.exists():
+        wdirvfs.makedirs()
+
     hgvfs.makedir(notindexed=True)
 
     if b'store' in requirements: