# HG changeset patch # User Martin von Zweigbergk # Date 2018-12-30 07:35:05 # Node ID d2d716cc07002dcfb389cee03823cc56d613cd5c # Parent 50ca531f1f248d398cbcff40eadb32ec4e349354 narrow: extract repo property for store narrowmatcher When a repo lock is released, we try to persist the manifest cache. That involves getting the narrowmatcher for the manifestlog. That should not fail if the store and working copy narrowspecs are out of sync. Without this patch, the later patches in this series will fail because of that. Differential Revision: https://phab.mercurial-scm.org/D5508 diff --git a/hgext/lfs/__init__.py b/hgext/lfs/__init__.py --- a/hgext/lfs/__init__.py +++ b/hgext/lfs/__init__.py @@ -243,7 +243,7 @@ def _reposetup(ui, repo): s = repo.set('%n:%n', _bin(kwargs[r'node']), _bin(last)) else: s = repo.set('%n', _bin(kwargs[r'node'])) - match = repo.narrowmatch() + match = repo._storenarrowmatch for ctx in s: # TODO: is there a way to just walk the files in the commit? if any(ctx[f].islfs() for f in ctx.files() diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -815,7 +815,7 @@ class revlognarrowfilestorage(object): if path[0] == b'/': path = path[1:] - return filelog.narrowfilelog(self.svfs, path, self.narrowmatch()) + return filelog.narrowfilelog(self.svfs, path, self._storenarrowmatch) def makefilestorage(requirements, features, **kwargs): """Produce a type conforming to ``ilocalrepositoryfilestorage``.""" @@ -1191,7 +1191,7 @@ class localrepository(object): def manifestlog(self): rootstore = manifest.manifestrevlog(self.svfs) return manifest.manifestlog(self.svfs, self, rootstore, - self.narrowmatch()) + self._storenarrowmatch) @repofilecache('dirstate') def dirstate(self): @@ -1224,6 +1224,13 @@ class localrepository(object): return narrowspec.load(self) @storecache(narrowspec.FILENAME) + def _storenarrowmatch(self): + if repository.NARROW_REQUIREMENT not in self.requirements: + return matchmod.always(self.root, '') + include, exclude = self.narrowpats + return narrowspec.match(self.root, include=include, exclude=exclude) + + @storecache(narrowspec.FILENAME) def _narrowmatch(self): if repository.NARROW_REQUIREMENT not in self.requirements: return matchmod.always(self.root, '')