[PATCH 3 of 5] manifestv2: add (unused) config option

Martin von Zweigbergk martinvonz at google.com
Mon Mar 30 19:19:40 CDT 2015


# HG changeset patch
# User Martin von Zweigbergk <martinvonz at google.com>
# Date 1427498384 25200
#      Fri Mar 27 16:19:44 2015 -0700
# Node ID f1f1ec0aac7598844b79a904b3d0ed4398de87f0
# Parent  c61e8d4b91da9094bede396e32caf982ec78fc39
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.

diff -r c61e8d4b91da -r f1f1ec0aac75 mercurial/localrepo.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")
diff -r c61e8d4b91da -r f1f1ec0aac75 mercurial/manifest.py
--- 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:


More information about the Mercurial-devel mailing list