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):