diff mercurial/localrepo.py @ 41230:d2d716cc0700

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
author Martin von Zweigbergk <martinvonz@google.com>
date Sat, 29 Dec 2018 23:35:05 -0800
parents 50ca531f1f24
children a2ae27993e16
line wrap: on
line diff
--- a/mercurial/localrepo.py	Sat Dec 29 23:01:12 2018 -0800
+++ b/mercurial/localrepo.py	Sat Dec 29 23:35:05 2018 -0800
@@ -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, '')