Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/localrepo.py @ 48235:b4f83c9e7905
dirstate-v2: Add support when Rust is not enabled
This wires into `dirstatemap` the parser and serializer added in previous
changesets. The memory representation is still the same, with a flat `dict`
for `DirstateItem`s and another one for copy sources. Serialization always
creates a new dirstate-v2 data file and does not support (when Rust is not
enabled) appending to an existing one, since we don?t keep track of which
tree nodes are new or modified. Instead the tree is reconstructed during
serialization.
Differential Revision: https://phab.mercurial-scm.org/D11520
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Fri, 16 Jul 2021 18:42:20 +0200 |
parents | 7970895a21cb |
children | 5c567aca080d |
comparison
equal
deleted
inserted
replaced
48234:7e78c72ee3ea | 48235:b4f83c9e7905 |
---|---|
915 def gathersupportedrequirements(ui): | 915 def gathersupportedrequirements(ui): |
916 """Determine the complete set of recognized requirements.""" | 916 """Determine the complete set of recognized requirements.""" |
917 # Start with all requirements supported by this file. | 917 # Start with all requirements supported by this file. |
918 supported = set(localrepository._basesupported) | 918 supported = set(localrepository._basesupported) |
919 | 919 |
920 if dirstate.SUPPORTS_DIRSTATE_V2: | |
921 supported.add(requirementsmod.DIRSTATE_V2_REQUIREMENT) | |
922 | |
923 # Execute ``featuresetupfuncs`` entries if they belong to an extension | 920 # Execute ``featuresetupfuncs`` entries if they belong to an extension |
924 # relevant to this ui instance. | 921 # relevant to this ui instance. |
925 modules = {m.__name__ for n, m in extensions.extensions(ui)} | 922 modules = {m.__name__ for n, m in extensions.extensions(ui)} |
926 | 923 |
927 for fn in featuresetupfuncs: | 924 for fn in featuresetupfuncs: |
1264 requirementsmod.CHANGELOGV2_REQUIREMENT, | 1261 requirementsmod.CHANGELOGV2_REQUIREMENT, |
1265 requirementsmod.SPARSEREVLOG_REQUIREMENT, | 1262 requirementsmod.SPARSEREVLOG_REQUIREMENT, |
1266 requirementsmod.NODEMAP_REQUIREMENT, | 1263 requirementsmod.NODEMAP_REQUIREMENT, |
1267 bookmarks.BOOKMARKS_IN_STORE_REQUIREMENT, | 1264 bookmarks.BOOKMARKS_IN_STORE_REQUIREMENT, |
1268 requirementsmod.SHARESAFE_REQUIREMENT, | 1265 requirementsmod.SHARESAFE_REQUIREMENT, |
1266 requirementsmod.DIRSTATE_V2_REQUIREMENT, | |
1269 } | 1267 } |
1270 _basesupported = supportedformats | { | 1268 _basesupported = supportedformats | { |
1271 requirementsmod.STORE_REQUIREMENT, | 1269 requirementsmod.STORE_REQUIREMENT, |
1272 requirementsmod.FNCACHE_REQUIREMENT, | 1270 requirementsmod.FNCACHE_REQUIREMENT, |
1273 requirementsmod.SHARED_REQUIREMENT, | 1271 requirementsmod.SHARED_REQUIREMENT, |
3607 requirements.add(requirementsmod.SPARSEREVLOG_REQUIREMENT) | 3605 requirements.add(requirementsmod.SPARSEREVLOG_REQUIREMENT) |
3608 | 3606 |
3609 # experimental config: format.exp-dirstate-v2 | 3607 # experimental config: format.exp-dirstate-v2 |
3610 # Keep this logic in sync with `has_dirstate_v2()` in `tests/hghave.py` | 3608 # Keep this logic in sync with `has_dirstate_v2()` in `tests/hghave.py` |
3611 if ui.configbool(b'format', b'exp-dirstate-v2'): | 3609 if ui.configbool(b'format', b'exp-dirstate-v2'): |
3612 if dirstate.SUPPORTS_DIRSTATE_V2: | 3610 requirements.add(requirementsmod.DIRSTATE_V2_REQUIREMENT) |
3613 requirements.add(requirementsmod.DIRSTATE_V2_REQUIREMENT) | |
3614 else: | |
3615 raise error.Abort( | |
3616 _( | |
3617 b"dirstate v2 format requested by config " | |
3618 b"but not supported (requires Rust extensions)" | |
3619 ) | |
3620 ) | |
3621 | 3611 |
3622 # experimental config: format.exp-use-copies-side-data-changeset | 3612 # experimental config: format.exp-use-copies-side-data-changeset |
3623 if ui.configbool(b'format', b'exp-use-copies-side-data-changeset'): | 3613 if ui.configbool(b'format', b'exp-use-copies-side-data-changeset'): |
3624 requirements.add(requirementsmod.CHANGELOGV2_REQUIREMENT) | 3614 requirements.add(requirementsmod.CHANGELOGV2_REQUIREMENT) |
3625 requirements.add(requirementsmod.COPIESSDC_REQUIREMENT) | 3615 requirements.add(requirementsmod.COPIESSDC_REQUIREMENT) |