Mercurial > hg
changeset 37373:c50078fc32f3
narrow: move manifestrevlog overrides to core
Differential Revision: https://phab.mercurial-scm.org/D3045
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Mon, 02 Apr 2018 23:46:04 -0700 |
parents | 1b2fa531fd7a |
children | ac42e39b1b77 |
files | hgext/narrow/narrowrepo.py hgext/narrow/narrowrevlog.py mercurial/manifest.py |
diffstat | 3 files changed, 5 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- 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):
--- 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):