comparison mercurial/localrepo.py @ 50186:8bc14ac53a41

narrow: delegate the narrow spec writing to the transaction This make it more transactional and will help us to simplify their backup. The implementation is not great, but it keep the patch simple as this is not the time for a larger refactoring yet.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 23 Feb 2023 04:15:16 +0100
parents 2f60cd6442fd
children f18e4608bb61
comparison
equal deleted inserted replaced
50185:99296ca9f29e 50186:8bc14ac53a41
1467 1467
1468 self._dirstate = None 1468 self._dirstate = None
1469 # post-dirstate-status hooks 1469 # post-dirstate-status hooks
1470 self._postdsstatus = [] 1470 self._postdsstatus = []
1471 1471
1472 self._pending_narrow_pats = None
1473
1472 # generic mapping between names and nodes 1474 # generic mapping between names and nodes
1473 self.names = namespaces.namespaces() 1475 self.names = namespaces.namespaces()
1474 1476
1475 # Key to signature value. 1477 # Key to signature value.
1476 self._sparsesignaturecache = {} 1478 self._sparsesignaturecache = {}
1797 def narrowpats(self): 1799 def narrowpats(self):
1798 """matcher patterns for this repository's narrowspec 1800 """matcher patterns for this repository's narrowspec
1799 1801
1800 A tuple of (includes, excludes). 1802 A tuple of (includes, excludes).
1801 """ 1803 """
1802 return narrowspec.load(self) 1804 # the narrow management should probably move into its own object
1805 val = self._pending_narrow_pats
1806 if val is None:
1807 val = narrowspec.load(self)
1808 return val
1803 1809
1804 @storecache(narrowspec.FILENAME) 1810 @storecache(narrowspec.FILENAME)
1805 def _storenarrowmatch(self): 1811 def _storenarrowmatch(self):
1806 if requirementsmod.NARROW_REQUIREMENT not in self.requirements: 1812 if requirementsmod.NARROW_REQUIREMENT not in self.requirements:
1807 return matchmod.always() 1813 return matchmod.always()