# HG changeset patch # User Martin von Zweigbergk # Date 1522737964 25200 # Node ID c50078fc32f31b3e425a6e65158aeff963c2aa99 # Parent 1b2fa531fd7a562b3827617260698dbd1be69d57 narrow: move manifestrevlog overrides to core Differential Revision: https://phab.mercurial-scm.org/D3045 diff -r 1b2fa531fd7a -r c50078fc32f3 hgext/narrow/narrowrepo.py --- a/hgext/narrow/narrowrepo.py Tue Apr 03 00:13:02 2018 -0700 +++ b/hgext/narrow/narrowrepo.py Mon Apr 02 23:46:04 2018 -0700 @@ -50,11 +50,6 @@ class narrowrepository(repo.__class__): - def _constructmanifest(self): - manifest = super(narrowrepository, self)._constructmanifest() - narrowrevlog.makenarrowmanifestrevlog(manifest, repo) - return manifest - @cacheprop('00manifest.i') def manifestlog(self): mfl = super(narrowrepository, self).manifestlog diff -r 1b2fa531fd7a -r c50078fc32f3 hgext/narrow/narrowrevlog.py --- a/hgext/narrow/narrowrevlog.py Tue Apr 03 00:13:02 2018 -0700 +++ b/hgext/narrow/narrowrevlog.py Mon Apr 02 23:46:04 2018 -0700 @@ -30,24 +30,6 @@ # load time. pass -def makenarrowmanifestrevlog(mfrevlog, repo): - if util.safehasattr(mfrevlog, '_narrowed'): - return - - class narrowmanifestrevlog(mfrevlog.__class__): - # This function is called via debug{revlog,index,data}, but also during - # at least some push operations. This will be used to wrap/exclude the - # child directories when using treemanifests. - def dirlog(self, d): - if not repo.narrowmatch().visitdir(d[:-1] or '.'): - return manifest.excludedmanifestrevlog(d) - result = super(narrowmanifestrevlog, self).dirlog(d) - makenarrowmanifestrevlog(result, repo) - return result - - mfrevlog.__class__ = narrowmanifestrevlog - mfrevlog._narrowed = True - def makenarrowmanifestlog(mfl, repo): class narrowmanifestlog(mfl.__class__): def get(self, dir, node, verify=True): diff -r 1b2fa531fd7a -r c50078fc32f3 mercurial/manifest.py --- a/mercurial/manifest.py Tue Apr 03 00:13:02 2018 -0700 +++ b/mercurial/manifest.py Mon Apr 02 23:46:04 2018 -0700 @@ -1279,6 +1279,7 @@ self._treeinmem = usetreemanifest self._revlog = repo._constructmanifest() + self._narrowmatch = repo.narrowmatch() # A cache of the manifestctx or treemanifestctx for each directory self._dirmancache = {} @@ -1477,6 +1478,10 @@ #self.linkrev = revlog.linkrev(rev) def _revlog(self): + narrowmatch = self._manifestlog._narrowmatch + if not narrowmatch.always(): + if not narrowmatch.visitdir(self._dir[:-1] or '.'): + return excludedmanifestrevlog(self._dir) return self._manifestlog._revlog.dirlog(self._dir) def read(self):