mercurial/localrepo.py
changeset 47277 ed0d54b20c5b
parent 47265 a07381751dc9
child 47279 40b51c28b242
--- a/mercurial/localrepo.py	Fri Apr 16 00:16:43 2021 +0200
+++ b/mercurial/localrepo.py	Wed May 19 13:14:59 2021 +0200
@@ -887,6 +887,9 @@
     # Start with all requirements supported by this file.
     supported = set(localrepository._basesupported)
 
+    if dirstate.SUPPORTS_DIRSTATE_V2:
+        supported.add(requirementsmod.DIRSTATE_V2_REQUIREMENT)
+
     # Execute ``featuresetupfuncs`` entries if they belong to an extension
     # relevant to this ui instance.
     modules = {m.__name__ for n, m in extensions.extensions(ui)}
@@ -3527,6 +3530,18 @@
         if ui.configbool(b'format', b'sparse-revlog'):
             requirements.add(requirementsmod.SPARSEREVLOG_REQUIREMENT)
 
+    # experimental config: format.exp-dirstate-v2
+    if ui.configbool(b'format', b'exp-dirstate-v2'):
+        if dirstate.SUPPORTS_DIRSTATE_V2:
+            requirements.add(requirementsmod.DIRSTATE_V2_REQUIREMENT)
+        else:
+            raise error.Abort(
+                _(
+                    b"dirstate v2 format requested by config "
+                    b"but not supported (requires Rust extensions)"
+                )
+            )
+
     # experimental config: format.exp-use-copies-side-data-changeset
     if ui.configbool(b'format', b'exp-use-copies-side-data-changeset'):
         requirements.add(requirementsmod.CHANGELOGV2_REQUIREMENT)