changeset 28163:5d3495e394d5

localrepo: isolate requirements determination from side effects In preparation for moving requirements determination to its own function.
author Gregory Szorc <gregory.szorc@gmail.com>
date Mon, 15 Feb 2016 13:19:07 -0800
parents 3784d9eb7245
children ad11edefa7c4
files mercurial/localrepo.py
diffstat 1 files changed, 15 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Sat Feb 13 14:42:17 2016 -0800
+++ b/mercurial/localrepo.py	Mon Feb 15 13:19:07 2016 -0800
@@ -282,23 +282,14 @@
 
         if not self.vfs.isdir():
             if create:
-                if not self.wvfs.exists():
-                    self.wvfs.makedirs()
-                self.vfs.makedir(notindexed=True)
                 requirements = set(self._baserequirements(create))
                 if self.ui.configbool('format', 'usestore', True):
-                    self.vfs.mkdir("store")
                     requirements.add("store")
                     if self.ui.configbool('format', 'usefncache', True):
                         requirements.add("fncache")
                         if self.ui.configbool('format', 'dotencode', True):
                             requirements.add('dotencode')
-                    # create an invalid changelog
-                    self.vfs.append(
-                        "00changelog.i",
-                        '\0\0\0\2' # represents revlogv2
-                        ' dummy changelog to prevent using the old repo layout'
-                    )
+
                 if scmutil.gdinitconfig(self.ui):
                     requirements.add("generaldelta")
                 if self.ui.configbool('experimental', 'treemanifest', False):
@@ -307,6 +298,20 @@
                     requirements.add("manifestv2")
 
                 self.requirements = requirements
+
+                if not self.wvfs.exists():
+                    self.wvfs.makedirs()
+                self.vfs.makedir(notindexed=True)
+
+                if 'store' in requirements:
+                    self.vfs.mkdir("store")
+
+                    # create an invalid changelog
+                    self.vfs.append(
+                        "00changelog.i",
+                        '\0\0\0\2' # represents revlogv2
+                        ' dummy changelog to prevent using the old repo layout'
+                    )
             else:
                 raise error.RepoError(_("repository %s not found") % path)
         elif create: