Patchwork [2,of,2] manifest: change treemanifestctx to construct subtrees from the manifestlog

mail settings
Submitter Durham Goode
Date Nov. 14, 2016, 11:27 p.m.
Message ID <>
Download mbox | patch
Permalink /patch/17565/
State Accepted
Headers show


Durham Goode - Nov. 14, 2016, 11:27 p.m.
# HG changeset patch
# User Durham Goode <>
# Date 1479165847 28800
#      Mon Nov 14 15:24:07 2016 -0800
# Node ID 2804de346a3e239ca0f067068ac8823ebb41d6ae
# Parent  27209d52a5865422c5ef4ba05cedb28ce32919ed
manifest: change treemanifestctx to construct subtrees from the manifestlog

Previously, treemanifestctx would directly construct its subtrees. By making it
get the subtrees through manifestlog.get() we consolidate all treemanifestctx
creation into manifestlog.get() and therefore extensions that need to wrap
manifestctx creation (like narrow-hg) can intercept manifestctxs at that single

This also means fetching subtrees will take advantage of the manifestlog ctx
cache now, which it did not before.


diff --git a/mercurial/ b/mercurial/
--- a/mercurial/
+++ b/mercurial/
@@ -1489,7 +1489,10 @@  class treemanifestctx(object):
                 def gettext():
                     return rl.revision(self._node)
                 def readsubtree(dir, subm):
-                    return treemanifestctx(self._repo, dir, subm).read()
+                    # Set verify to False since we need to be able to create
+                    # subtrees for trees that don't exist on disk yet.
+                    return self._repo.manifestlog.get(dir, subm,
+                                                      verify=False).read()
       , readsubtree)
                 self._data = m
@@ -1531,7 +1534,7 @@  class treemanifestctx(object):
             # Need to perform a slow delta
             r0 = revlog.deltaparent(revlog.rev(self._node))
-            m0 = treemanifestctx(self._repo, self._dir, revlog.node(r0)).read()
+            m0 = self._repo.manifestlog.get(self._dir, revlog.node(r0)).read()
             m1 =
             md = treemanifest(dir=self._dir)
             for f, ((n0, fl0), (n1, fl1)) in m0.diff(m1).iteritems():