Comments
Patch
@@ -971,6 +971,7 @@
requirements.NODEMAP_REQUIREMENT,
requirements.SHARESAFE_REQUIREMENT,
requirements.REVLOGV2_REQUIREMENT,
+ requirements.DIRSTATE_V2_REQUIREMENT,
}
for name in compression.compengines:
engine = compression.compengines[name]
@@ -12,6 +12,8 @@
STORE_REQUIREMENT = b'store'
FNCACHE_REQUIREMENT = b'fncache'
+DIRSTATE_V2_REQUIREMENT = b'exp-dirstate-v2'
+
# When narrowing is finalized and no longer subject to format changes,
# we should move this to just "narrow" or similar.
NARROW_REQUIREMENT = b'narrowhg-experimental'
@@ -879,6 +879,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)}
@@ -3514,6 +3517,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-side-data
if ui.configbool(b'format', b'exp-use-side-data'):
requirements.discard(requirementsmod.REVLOGV1_REQUIREMENT)
@@ -39,6 +39,8 @@
parsers = policy.importmod('parsers')
rustmod = policy.importrust('dirstate')
+SUPPORTS_DIRSTATE_V2 = rustmod is not None
+
propertycache = util.propertycache
filecache = scmutil.filecache
_rangemask = 0x7FFFFFFF
@@ -1282,6 +1282,14 @@
experimental=True,
)
coreconfigitem(
+ # Enable this dirstate format *when creating a new repository*.
+ # Which format to use for existing repos is controlled by .hg/requires
+ b'format',
+ b'exp-dirstate-v2',
+ default=False,
+ experimental=True,
+)
+coreconfigitem(
b'format',
b'dotencode',
default=True,