requirements: also add a generaldelta constant
Continue the cleanup to the remaining requirements
Differential Revision: https://phab.mercurial-scm.org/D10106
--- a/mercurial/bundlecaches.py Wed Mar 03 14:00:45 2021 +0100
+++ b/mercurial/bundlecaches.py Wed Mar 03 12:30:23 2021 +0100
@@ -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:
--- a/mercurial/changegroup.py Wed Mar 03 14:00:45 2021 +0100
+++ b/mercurial/changegroup.py Wed Mar 03 12:30:23 2021 +0100
@@ -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)
--- a/mercurial/localrepo.py Wed Mar 03 14:00:45 2021 +0100
+++ b/mercurial/localrepo.py Wed Mar 03 12:30:23 2021 +0100
@@ -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'):
--- a/mercurial/requirements.py Wed Mar 03 14:00:45 2021 +0100
+++ b/mercurial/requirements.py Wed Mar 03 12:30:23 2021 +0100
@@ -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'
--- a/mercurial/upgrade_utils/actions.py Wed Mar 03 14:00:45 2021 +0100
+++ b/mercurial/upgrade_utils/actions.py Wed Mar 03 12:30:23 2021 +0100
@@ -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,
--- a/mercurial/wireprotov1server.py Wed Mar 03 14:00:45 2021 +0100
+++ b/mercurial/wireprotov1server.py Wed Mar 03 12:30:23 2021 +0100
@@ -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)