[PATCH 1 of 8] manifest: move treeinmem onto manifestlog

Durham Goode durham at fb.com
Wed Sep 14 19:04:31 EDT 2016


# HG changeset patch
# User Durham Goode <durham at fb.com>
# Date 1473893509 25200
#      Wed Sep 14 15:51:49 2016 -0700
# Node ID a68f73ff397c439410395363049a0679a847b425
# Parent  459cbb3804144a4cabb6622b6d66616cadd35ade
manifest: move treeinmem onto manifestlog

A previous patched moved all the serialization related options onto
manifestrevlog (since it is responsible for serialization). Let's move the
treeinmem option on manifestlog, since it is responsible for materialization
decisions. This reduces the number of dependencies manifestlog has on the old
manifest type as well, so we can eventually make them completely independent of
each other.

diff --git a/mercurial/manifest.py b/mercurial/manifest.py
--- a/mercurial/manifest.py
+++ b/mercurial/manifest.py
@@ -957,6 +957,13 @@ class manifestlog(object):
     def __init__(self, opener, repo):
         self._repo = repo
 
+        usetreemanifest = False
+
+        opts = getattr(opener, 'options', None)
+        if opts is not None:
+            usetreemanifest = opts.get('treemanifest', usetreemanifest)
+        self._treeinmem = usetreemanifest
+
         # We'll separate this into it's own cache once oldmanifest is no longer
         # used
         self._mancache = repo.manifest._mancache
@@ -984,7 +991,7 @@ class manifestlog(object):
                 isinstance(cachemf, treemanifestctx)):
                 return cachemf
 
-        if self._oldmanifest._treeinmem:
+        if self._treeinmem:
             m = treemanifestctx(self._revlog, '', node)
         else:
             m = manifestctx(self._revlog, node)


More information about the Mercurial-devel mailing list