diff --git a/mercurial/bundlecaches.py b/mercurial/bundlecaches.py --- a/mercurial/bundlecaches.py +++ b/mercurial/bundlecaches.py @@ -9,6 +9,7 @@ from . import ( error, + requirements as requirementsmod, sslutil, util, ) @@ -164,7 +165,7 @@ compression = spec version = b'v1' # Generaldelta repos require v2. - if b'generaldelta' in repo.requirements: + if requirementsmod.GENERALDELTA_REQUIREMENT in repo.requirements: version = b'v2' # Modern compression engines require v2. if compression not in _bundlespecv1compengines: diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py --- a/mercurial/changegroup.py +++ b/mercurial/changegroup.py @@ -1549,7 +1549,7 @@ # will support. For example, all hg versions that support generaldelta also # support changegroup 02. versions = supportedoutgoingversions(repo) - if b'generaldelta' in repo.requirements: + if requirements.GENERALDELTA_REQUIREMENT in repo.requirements: versions.discard(b'01') assert versions return min(versions) diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -1003,7 +1003,7 @@ if requirementsmod.REVLOGV2_REQUIREMENT in requirements: options[b'revlogv2'] = True - if b'generaldelta' in requirements: + if requirementsmod.GENERALDELTA_REQUIREMENT in requirements: options[b'generaldelta'] = True # experimental config: format.chunkcachesize @@ -1200,7 +1200,7 @@ # chains), and the code was deleted in 4.6. supportedformats = { requirementsmod.REVLOGV1_REQUIREMENT, - b'generaldelta', + requirementsmod.GENERALDELTA_REQUIREMENT, requirementsmod.TREEMANIFEST_REQUIREMENT, requirementsmod.COPIESSDC_REQUIREMENT, requirementsmod.REVLOGV2_REQUIREMENT, @@ -3442,7 +3442,7 @@ requirements.add(b'exp-compression-%s' % compengine) if scmutil.gdinitconfig(ui): - requirements.add(b'generaldelta') + requirements.add(requirementsmod.GENERALDELTA_REQUIREMENT) if ui.configbool(b'format', b'sparse-revlog'): requirements.add(requirementsmod.SPARSEREVLOG_REQUIREMENT) @@ -3460,7 +3460,7 @@ if revlogv2 == b'enable-unstable-format-and-corrupt-my-data': requirements.remove(requirementsmod.REVLOGV1_REQUIREMENT) # generaldelta is implied by revlogv2. - requirements.discard(b'generaldelta') + requirements.discard(requirementsmod.GENERALDELTA_REQUIREMENT) requirements.add(requirementsmod.REVLOGV2_REQUIREMENT) # experimental config: format.internal-phase if ui.configbool(b'format', b'internal-phase'): diff --git a/mercurial/requirements.py b/mercurial/requirements.py --- a/mercurial/requirements.py +++ b/mercurial/requirements.py @@ -7,6 +7,8 @@ from __future__ import absolute_import +GENERALDELTA_REQUIREMENT = b'generaldelta' + # 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' 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 @@ -20,7 +20,7 @@ # list of requirements that request a clone of all revlog if added/removed RECLONES_REQUIREMENTS = { - b'generaldelta', + requirements.GENERALDELTA_REQUIREMENT, requirements.SPARSEREVLOG_REQUIREMENT, } @@ -236,7 +236,7 @@ class generaldelta(requirementformatvariant): name = b'generaldelta' - _requirement = b'generaldelta' + _requirement = requirements.GENERALDELTA_REQUIREMENT default = True @@ -936,7 +936,7 @@ supported = { b'dotencode', b'fncache', - b'generaldelta', + requirements.GENERALDELTA_REQUIREMENT, requirements.REVLOGV1_REQUIREMENT, b'store', requirements.SPARSEREVLOG_REQUIREMENT, @@ -967,7 +967,7 @@ supported = { b'dotencode', b'fncache', - b'generaldelta', + requirements.GENERALDELTA_REQUIREMENT, requirements.SPARSEREVLOG_REQUIREMENT, requirements.SIDEDATA_REQUIREMENT, requirements.COPIESSDC_REQUIREMENT, diff --git a/mercurial/wireprotov1server.py b/mercurial/wireprotov1server.py --- a/mercurial/wireprotov1server.py +++ b/mercurial/wireprotov1server.py @@ -109,7 +109,7 @@ 4. server.bundle1 """ ui = repo.ui - gd = b'generaldelta' in repo.requirements + gd = requirementsmod.GENERALDELTA_REQUIREMENT in repo.requirements if gd: v = ui.configbool(b'server', b'bundle1gd.%s' % action)