[PATCH 2 of 2] treemanifest: separate flags for trees in memory and trees on disk

Martin von Zweigbergk martinvonz at google.com
Sat Apr 11 01:30:44 CDT 2015


# HG changeset patch
# User Martin von Zweigbergk <martinvonz at google.com>
# Date 1428717273 25200
#      Fri Apr 10 18:54:33 2015 -0700
# Node ID 50b10692ea876b36ee5558cca84e35c55c695495
# Parent  b3d7cc4e97b6e0b3a7f5b7c33db7be1b115e1927
treemanifest: separate flags for trees in memory and trees on disk

When we start writing tree manifests with one manifest revlog per
directory, it will still be nice to be able to run tests using tree
manifests in memory but writing to a flat manifest to a single
revlog. Let's break the current '_usetreemanifest' flag on the revlog
into '_treeinmem' and '_treeondisk'. Both are populated from the same
config, but after this change, one can temporarily hard-code
_treeinmem=True to see that tests still pass.

diff -r b3d7cc4e97b6 -r 50b10692ea87 mercurial/manifest.py
--- a/mercurial/manifest.py	Fri Apr 10 18:13:01 2015 -0700
+++ b/mercurial/manifest.py	Fri Apr 10 18:54:33 2015 -0700
@@ -761,11 +761,12 @@
             usemanifestv2 = opts.get('manifestv2', usemanifestv2)
         self._mancache = util.lrucachedict(cachesize)
         revlog.revlog.__init__(self, opener, "00manifest.i")
-        self._usetreemanifest = usetreemanifest
+        self._treeinmem = usetreemanifest
+        self._treeondisk = usetreemanifest
         self._usemanifestv2 = usemanifestv2
 
     def _newmanifest(self, data=''):
-        if self._usetreemanifest:
+        if self._treeinmem:
             return treemanifest('', data)
         return manifestdict(data)
 
@@ -782,7 +783,7 @@
         return md
 
     def readdelta(self, node):
-        if self._usemanifestv2 or self._usetreemanifest:
+        if self._usemanifestv2 or self._treeondisk:
             return self._slowreaddelta(node)
         r = self.rev(node)
         d = mdiff.patchtext(self.revdiff(self.deltaparent(r), r))
@@ -817,7 +818,7 @@
             return None, None
 
     def add(self, m, transaction, link, p1, p2, added, removed):
-        if (p1 in self._mancache and not self._usetreemanifest
+        if (p1 in self._mancache and not self._treeinmem
             and not self._usemanifestv2):
             # If our first parent is in the manifest cache, we can
             # compute a delta here using properties we know about the


More information about the Mercurial-devel mailing list