D10107: requirements: also add a dotencode constant
Alphare (Raphaël Gomès)
phabricator at mercurial-scm.org
Thu Mar 4 08:32:54 UTC 2021
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.
REVISION SUMMARY
Continue the cleanup to the remaining requirements
REPOSITORY
rHG Mercurial
BRANCH
default
REVISION DETAIL
https://phab.mercurial-scm.org/D10107
AFFECTED FILES
mercurial/localrepo.py
mercurial/requirements.py
mercurial/upgrade_utils/actions.py
CHANGE DETAILS
diff --git a/mercurial/upgrade_utils/actions.py b/mercurial/upgrade_utils/actions.py
--- a/mercurial/upgrade_utils/actions.py
+++ b/mercurial/upgrade_utils/actions.py
@@ -217,7 +217,7 @@
class dotencode(requirementformatvariant):
name = b'dotencode'
- _requirement = b'dotencode'
+ _requirement = requirements.DOTENCODE_REQUIREMENT
default = True
@@ -934,7 +934,7 @@
Extensions should monkeypatch this to add their custom requirements.
"""
supported = {
- b'dotencode',
+ requirements.DOTENCODE_REQUIREMENT,
b'fncache',
requirements.GENERALDELTA_REQUIREMENT,
requirements.REVLOGV1_REQUIREMENT,
@@ -965,7 +965,8 @@
future, unknown requirements from accidentally being added.
"""
supported = {
- b'dotencode',
+ requirements.DOTENCODE_REQUIREMENT,
+ requirements.REVLOGV1_REQUIREMENT, # allowed in case of downgrade
b'fncache',
requirements.GENERALDELTA_REQUIREMENT,
requirements.SPARSEREVLOG_REQUIREMENT,
diff --git a/mercurial/requirements.py b/mercurial/requirements.py
--- a/mercurial/requirements.py
+++ b/mercurial/requirements.py
@@ -8,6 +8,7 @@
from __future__ import absolute_import
GENERALDELTA_REQUIREMENT = b'generaldelta'
+DOTENCODE_REQUIREMENT = b'dotencode'
# When narrowing is finalized and no longer subject to format changes,
# we should move this to just "narrow" or similar.
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -944,9 +944,8 @@
"""Construct a storage object for a repository."""
if b'store' in requirements:
if b'fncache' in requirements:
- return storemod.fncachestore(
- path, vfstype, b'dotencode' in requirements
- )
+ dotencode = requirementsmod.DOTENCODE_REQUIREMENT in requirements
+ return storemod.fncachestore(path, vfstype, dotencode)
return storemod.encodedstore(path, vfstype)
@@ -1215,7 +1214,7 @@
b'fncache',
requirementsmod.SHARED_REQUIREMENT,
requirementsmod.RELATIVE_SHARED_REQUIREMENT,
- b'dotencode',
+ requirementsmod.DOTENCODE_REQUIREMENT,
requirementsmod.SPARSE_REQUIREMENT,
requirementsmod.INTERNAL_PHASE_REQUIREMENT,
}
@@ -3416,7 +3415,7 @@
if ui.configbool(b'format', b'usefncache'):
requirements.add(b'fncache')
if ui.configbool(b'format', b'dotencode'):
- requirements.add(b'dotencode')
+ requirements.add(requirementsmod.DOTENCODE_REQUIREMENT)
compengines = ui.configlist(b'format', b'revlog-compression')
for compengine in compengines:
To: Alphare, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
More information about the Mercurial-devel
mailing list