D5508: narrow: extract repo property for store narrowmatcher
This revision was automatically updated to reflect the committed changes. Closed by commit rHGd2d716cc0700: narrow: extract repo property for store narrowmatcher (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5508?vs=13148=13240 REVISION DETAIL https://phab.mercurial-scm.org/D5508 AFFECTED FILES hgext/lfs/__init__.py mercurial/localrepo.py CHANGE DETAILS diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -815,7 +815,7 @@ 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 @@ 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 @@ 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, '') 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 @@ 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() To: martinvonz, #hg-reviewers, pulkit Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5508: narrow: extract repo property for store narrowmatcher
pulkit accepted this revision. pulkit added inline comments. INLINE COMMENTS > localrepo.py:1227 > @storecache(narrowspec.FILENAME) > +def _storenarrowmatch(self): > +if repository.NARROW_REQUIREMENT not in self.requirements: In future, we can add a boolean `store` argument to `narrowmatch()` function. That will be better than accessing private attributes of the localrepo class. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5508 To: martinvonz, #hg-reviewers, pulkit Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5508: narrow: extract repo property for store narrowmatcher
martinvonz updated this revision to Diff 13148. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5508?vs=13057=13148 REVISION DETAIL https://phab.mercurial-scm.org/D5508 AFFECTED FILES hgext/lfs/__init__.py mercurial/localrepo.py CHANGE DETAILS diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -815,7 +815,7 @@ 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 @@ 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 @@ 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, '') 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 @@ 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() To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5508: narrow: extract repo property for store narrowmatcher
martinvonz updated this revision to Diff 13057. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5508?vs=13036=13057 REVISION DETAIL https://phab.mercurial-scm.org/D5508 AFFECTED FILES hgext/lfs/__init__.py mercurial/localrepo.py CHANGE DETAILS diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -815,7 +815,7 @@ 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 @@ 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 @@ 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, '') 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 @@ 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() To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5508: narrow: extract repo property for store narrowmatcher
martinvonz updated this revision to Diff 13036. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5508?vs=13030=13036 REVISION DETAIL https://phab.mercurial-scm.org/D5508 AFFECTED FILES hgext/lfs/__init__.py mercurial/localrepo.py CHANGE DETAILS diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -815,7 +815,7 @@ 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 @@ 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 @@ 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, '') 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 @@ 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() To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5508: narrow: extract repo property for store narrowmatcher
martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY 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. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5508 AFFECTED FILES hgext/lfs/__init__.py mercurial/localrepo.py CHANGE DETAILS diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -815,7 +815,7 @@ 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 @@ 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 @@ 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, '') diff --git a/hgext/lfs/__init__.py b/hgext/lfs/__init__.py --- a/hgext/lfs/__init__.py +++ b/hgext/lfs/__init__.py @@ -244,7 +244,7 @@ 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() To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel