manifestv2: add (unused) config option
authorMartin von Zweigbergk <martinvonz@google.com>
Fri, 27 Mar 2015 16:19:44 -0700
changeset 24526 cd50f3717639
parent 24525 e118f74d246f
child 24527 8aead3bc5ff8
manifestv2: add (unused) config option With tree manifests, hashes will change anyway, so now is a good time to also take up the old plans of a new manifest format. While there should be little or no reason to use tree manifests with the current manifest format (v1) once the new format (v2) is supported, we'll try to keep the two dimensions (flat/tree and v1/v2) separate. In preparation for adding a the new format, let's add configuration for it and propagate that configuration to the manifest revlog subclass. The new configuration ("experimental.manifestv2") says in what format to write the manifest data. We may later add other configuration to choose how to hash it, either keeping the v1 hash for BC or hashing the v2 content. See http://mercurial.selenic.com/wiki/ManifestV2Plan for more details.
mercurial/localrepo.py
mercurial/manifest.py
--- a/mercurial/localrepo.py	Fri Mar 27 15:37:46 2015 -0700
+++ b/mercurial/localrepo.py	Fri Mar 27 16:19:44 2015 -0700
@@ -334,6 +334,9 @@
         usetreemanifest = self.ui.configbool('experimental', 'treemanifest')
         if usetreemanifest is not None:
             self.svfs.options['usetreemanifest'] = usetreemanifest
+        usemanifestv2 = self.ui.configbool('experimental', 'manifestv2')
+        if usemanifestv2 is not None:
+            self.svfs.options['usemanifestv2'] = usemanifestv2
 
     def _writerequirements(self):
         reqfile = self.vfs("requires", "w")
--- a/mercurial/manifest.py	Fri Mar 27 15:37:46 2015 -0700
+++ b/mercurial/manifest.py	Fri Mar 27 16:19:44 2015 -0700
@@ -597,13 +597,16 @@
         # stacks of commits, the number can go up, hence the config knob below.
         cachesize = 4
         usetreemanifest = False
+        usemanifestv2 = False
         opts = getattr(opener, 'options', None)
         if opts is not None:
             cachesize = opts.get('manifestcachesize', cachesize)
             usetreemanifest = opts.get('usetreemanifest', usetreemanifest)
+            usemanifestv2 = opts.get('usemanifestv2', usemanifestv2)
         self._mancache = util.lrucachedict(cachesize)
         revlog.revlog.__init__(self, opener, "00manifest.i")
         self._usetreemanifest = usetreemanifest
+        self._usemanifestv2 = usemanifestv2
 
     def _newmanifest(self, data=''):
         if self._usetreemanifest: