changeset 37374:ac42e39b1b77

narrow: move manifestlog overrides to core With this and the previous patch, I couldn't measure any significant difference from `hg files -r .` in a FireFox repo with 65k files. I tried with both a flat-manifest and a tree-manifest version of it. Neither had the narrow extension enabled. Differential Revision: https://phab.mercurial-scm.org/D3046
author Martin von Zweigbergk <martinvonz@google.com>
date Tue, 03 Apr 2018 09:58:16 -0700
parents c50078fc32f3
children a973bb92ab71
files hgext/narrow/narrowrepo.py hgext/narrow/narrowrevlog.py mercurial/manifest.py
diffstat 3 files changed, 3 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/narrow/narrowrepo.py	Mon Apr 02 23:46:04 2018 -0700
+++ b/hgext/narrow/narrowrepo.py	Tue Apr 03 09:58:16 2018 -0700
@@ -50,12 +50,6 @@
 
     class narrowrepository(repo.__class__):
 
-        @cacheprop('00manifest.i')
-        def manifestlog(self):
-            mfl = super(narrowrepository, self).manifestlog
-            narrowrevlog.makenarrowmanifestlog(mfl, self)
-            return mfl
-
         def file(self, f):
             fl = super(narrowrepository, self).file(f)
             narrowrevlog.makenarrowfilelog(fl, self.narrowmatch())
--- a/hgext/narrow/narrowrevlog.py	Mon Apr 02 23:46:04 2018 -0700
+++ b/hgext/narrow/narrowrevlog.py	Tue Apr 03 09:58:16 2018 -0700
@@ -8,7 +8,6 @@
 from __future__ import absolute_import
 
 from mercurial import (
-   manifest,
    revlog,
    util,
 )
@@ -30,14 +29,6 @@
     # load time.
     pass
 
-def makenarrowmanifestlog(mfl, repo):
-    class narrowmanifestlog(mfl.__class__):
-        def get(self, dir, node, verify=True):
-            if not repo.narrowmatch().visitdir(dir[:-1] or '.'):
-                return manifest.excludeddirmanifestctx(dir, node)
-            return super(narrowmanifestlog, self).get(dir, node, verify=verify)
-    mfl.__class__ = narrowmanifestlog
-
 def makenarrowfilelog(fl, narrowmatch):
     class narrowfilelog(fl.__class__):
         def renamed(self, node):
--- a/mercurial/manifest.py	Mon Apr 02 23:46:04 2018 -0700
+++ b/mercurial/manifest.py	Tue Apr 03 09:58:16 2018 -0700
@@ -1303,6 +1303,9 @@
         if node in self._dirmancache.get(dir, ()):
             return self._dirmancache[dir][node]
 
+        if not self._narrowmatch.always():
+            if not self._narrowmatch.visitdir(dir[:-1] or '.'):
+                return excludeddirmanifestctx(dir, node)
         if dir:
             if self._revlog._treeondisk:
                 if verify: