treemanifest: set requires at repo creation time, ignore config after
authorMartin von Zweigbergk <martinvonz@google.com>
Tue, 05 May 2015 08:40:59 -0700
changeset 24956 48583a1e44f3
parent 24955 1df233bcb7f6
child 24957 17ba4ccd20b4
treemanifest: set requires at repo creation time, ignore config after The very next changeset will start writing one revlog per directory when tree manifests are enabled. That is backwards incompatible, so it requires .hg/requires to be updated. Just like with generaldelta, we want to update .hg/requires only when the repo is created. Updating ..hg/requires is bad for repos on shared disk. Instead, those who do want to upgrade a repo to using treemanifest (or manifestv2, etc) can run hg clone --config experimental.treemanifest repo clone which will create a new repo with the requirement set. Unlike the case of e.g. generaldelta, it will not rewrite the changesets, since tree manifests hash differently.
mercurial/localrepo.py
mercurial/manifest.py
--- a/mercurial/localrepo.py	Tue Apr 21 09:29:59 2015 -0700
+++ b/mercurial/localrepo.py	Tue May 05 08:40:59 2015 -0700
@@ -192,10 +192,11 @@
 
 class localrepository(object):
 
-    supportedformats = set(('revlogv1', 'generaldelta', 'manifestv2'))
+    supportedformats = set(('revlogv1', 'generaldelta', 'treemanifest',
+                            'manifestv2'))
     _basesupported = supportedformats | set(('store', 'fncache', 'shared',
                                              'dotencode'))
-    openerreqs = set(('revlogv1', 'generaldelta', 'manifestv2'))
+    openerreqs = set(('revlogv1', 'generaldelta', 'treemanifest', 'manifestv2'))
     filtername = None
 
     # a list of (ui, featureset) functions.
@@ -259,6 +260,8 @@
                     )
                 if self.ui.configbool('format', 'generaldelta', False):
                     self.requirements.add("generaldelta")
+                if self.ui.configbool('experimental', 'treemanifest', False):
+                    self.requirements.add("treemanifest")
                 if self.ui.configbool('experimental', 'manifestv2', False):
                     self.requirements.add("manifestv2")
             else:
@@ -348,9 +351,6 @@
         manifestcachesize = self.ui.configint('format', 'manifestcachesize')
         if manifestcachesize is not None:
             self.svfs.options['manifestcachesize'] = manifestcachesize
-        usetreemanifest = self.ui.configbool('experimental', 'treemanifest')
-        if usetreemanifest is not None:
-            self.svfs.options['usetreemanifest'] = usetreemanifest
 
     def _writerequirements(self):
         scmutil.writerequires(self.vfs, self.requirements)
--- a/mercurial/manifest.py	Tue Apr 21 09:29:59 2015 -0700
+++ b/mercurial/manifest.py	Tue May 05 08:40:59 2015 -0700
@@ -760,7 +760,7 @@
         opts = getattr(opener, 'options', None)
         if opts is not None:
             cachesize = opts.get('manifestcachesize', cachesize)
-            usetreemanifest = opts.get('usetreemanifest', usetreemanifest)
+            usetreemanifest = opts.get('treemanifest', usetreemanifest)
             usemanifestv2 = opts.get('manifestv2', usemanifestv2)
         self._mancache = util.lrucachedict(cachesize)
         revlog.revlog.__init__(self, opener, "00manifest.i")