comparison mercurial/localrepo.py @ 47280:1766130fe9ba

dirstate-v2: Change the on-disk format when the requirement is enabled For now, the format is the same except with an additional marker at the start. This marker is redundant: for existing repositories it is `.hg/requires` that determines which format to use. For new repositories, it is the new `format.exp-dirstate-v2` config. There is no upgrade or downgrade so far. Most of the changes are about plumbing a boolean through layers of APIs to indicate which format should be used. Differential Revision: https://phab.mercurial-scm.org/D10719
author Simon Sapin <simon.sapin@octobus.net>
date Wed, 19 May 2021 13:15:00 +0200
parents 40b51c28b242
children d1589957fdcb
comparison
equal deleted inserted replaced
47279:40b51c28b242 47280:1766130fe9ba
1688 return self._makedirstate() 1688 return self._makedirstate()
1689 1689
1690 def _makedirstate(self): 1690 def _makedirstate(self):
1691 """Extension point for wrapping the dirstate per-repo.""" 1691 """Extension point for wrapping the dirstate per-repo."""
1692 sparsematchfn = lambda: sparse.matcher(self) 1692 sparsematchfn = lambda: sparse.matcher(self)
1693 v2_req = requirementsmod.DIRSTATE_V2_REQUIREMENT
1694 use_dirstate_v2 = v2_req in self.requirements
1693 1695
1694 return dirstate.dirstate( 1696 return dirstate.dirstate(
1695 self.vfs, 1697 self.vfs,
1696 self.ui, 1698 self.ui,
1697 self.root, 1699 self.root,
1698 self._dirstatevalidate, 1700 self._dirstatevalidate,
1699 sparsematchfn, 1701 sparsematchfn,
1700 self.nodeconstants, 1702 self.nodeconstants,
1703 use_dirstate_v2,
1701 ) 1704 )
1702 1705
1703 def _dirstatevalidate(self, node): 1706 def _dirstatevalidate(self, node):
1704 try: 1707 try:
1705 self.changelog.rev(node) 1708 self.changelog.rev(node)