# HG changeset patch # User Raphaël Gomès # Date 2021-03-03 11:33:24 # Node ID c3773636ddbbf2e45f66622091f6dc92eb813af9 # Parent e83327af26f158c21ceac95324dd4cb0e0bdfa96 requirements: also add a dotencode constant Continue the cleanup to the remaining requirements Differential Revision: https://phab.mercurial-scm.org/D10107 diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -944,9 +944,8 @@ def makestore(requirements, path, vfstyp """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 @@ class localrepository(object): 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 @@ def newreporequirements(ui, createopts): 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: 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/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 fncache(requirementformatvariant): class dotencode(requirementformatvariant): name = b'dotencode' - _requirement = b'dotencode' + _requirement = requirements.DOTENCODE_REQUIREMENT default = True @@ -934,7 +934,7 @@ def supporteddestrequirements(repo): 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,7 @@ def allowednewrequirements(repo): future, unknown requirements from accidentally being added. """ supported = { - b'dotencode', + requirements.DOTENCODE_REQUIREMENT, b'fncache', requirements.GENERALDELTA_REQUIREMENT, requirements.SPARSEREVLOG_REQUIREMENT,