Mercurial > hg
changeset 46626:ee91966aec0f
requirements: add constant for revlog v1 requirement
Since this series is adding a new requirement, we might as well clean up while
we're here.
Differential Revision: https://phab.mercurial-scm.org/D10105
author | Raphaël Gomès <rgomes@octobus.net> |
---|---|
date | Wed, 03 Mar 2021 14:00:45 +0100 |
parents | 3941fe53670d |
children | f4c325bf80fc |
files | mercurial/exchangev2.py mercurial/localrepo.py mercurial/requirements.py mercurial/streamclone.py mercurial/upgrade_utils/actions.py mercurial/wireprotov1server.py |
diffstat | 6 files changed, 15 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/exchangev2.py Thu Feb 18 15:07:45 2021 +0100 +++ b/mercurial/exchangev2.py Wed Mar 03 14:00:45 2021 +0100 @@ -22,6 +22,7 @@ narrowspec, phases, pycompat, + requirements as requirementsmod, setdiscovery, ) from .interfaces import repository @@ -183,7 +184,7 @@ # TODO This is super hacky. There needs to be a storage API for this. We # also need to check for compatibility with the remote. - if b'revlogv1' not in repo.requirements: + if requirementsmod.REVLOGV1_REQUIREMENT not in repo.requirements: return False return True
--- a/mercurial/localrepo.py Thu Feb 18 15:07:45 2021 +0100 +++ b/mercurial/localrepo.py Wed Mar 03 14:00:45 2021 +0100 @@ -974,7 +974,7 @@ # opener options for it because those options wouldn't do anything # meaningful on such old repos. if ( - b'revlogv1' in requirements + requirementsmod.REVLOGV1_REQUIREMENT in requirements or requirementsmod.REVLOGV2_REQUIREMENT in requirements ): options.update(resolverevlogstorevfsoptions(ui, requirements, features)) @@ -998,7 +998,7 @@ options = {} options[b'flagprocessors'] = {} - if b'revlogv1' in requirements: + if requirementsmod.REVLOGV1_REQUIREMENT in requirements: options[b'revlogv1'] = True if requirementsmod.REVLOGV2_REQUIREMENT in requirements: options[b'revlogv2'] = True @@ -1199,7 +1199,7 @@ # being successful (repository sizes went up due to worse delta # chains), and the code was deleted in 4.6. supportedformats = { - b'revlogv1', + requirementsmod.REVLOGV1_REQUIREMENT, b'generaldelta', requirementsmod.TREEMANIFEST_REQUIREMENT, requirementsmod.COPIESSDC_REQUIREMENT, @@ -3410,7 +3410,7 @@ % createopts[b'backend'] ) - requirements = {b'revlogv1'} + requirements = {requirementsmod.REVLOGV1_REQUIREMENT} if ui.configbool(b'format', b'usestore'): requirements.add(b'store') if ui.configbool(b'format', b'usefncache'): @@ -3458,7 +3458,7 @@ revlogv2 = ui.config(b'experimental', b'revlogv2') if revlogv2 == b'enable-unstable-format-and-corrupt-my-data': - requirements.remove(b'revlogv1') + requirements.remove(requirementsmod.REVLOGV1_REQUIREMENT) # generaldelta is implied by revlogv2. requirements.discard(b'generaldelta') requirements.add(requirementsmod.REVLOGV2_REQUIREMENT)
--- a/mercurial/requirements.py Thu Feb 18 15:07:45 2021 +0100 +++ b/mercurial/requirements.py Wed Mar 03 14:00:45 2021 +0100 @@ -21,6 +21,8 @@ # Stores manifest in Tree structure TREEMANIFEST_REQUIREMENT = b'treemanifest' +REVLOGV1_REQUIREMENT = b'revlogv1' + # Increment the sub-version when the revlog v2 format changes to lock out old # clients. REVLOGV2_REQUIREMENT = b'exp-revlogv2.1'
--- a/mercurial/streamclone.py Thu Feb 18 15:07:45 2021 +0100 +++ b/mercurial/streamclone.py Wed Mar 03 14:00:45 2021 +0100 @@ -20,6 +20,7 @@ narrowspec, phases, pycompat, + requirements as requirementsmod, scmutil, store, util, @@ -83,7 +84,7 @@ # is advertised and contains a comma-delimited list of requirements. requirements = set() if remote.capable(b'stream'): - requirements.add(b'revlogv1') + requirements.add(requirementsmod.REVLOGV1_REQUIREMENT) else: streamreqs = remote.capable(b'streamreqs') # This is weird and shouldn't happen with modern servers.
--- a/mercurial/upgrade_utils/actions.py Thu Feb 18 15:07:45 2021 +0100 +++ b/mercurial/upgrade_utils/actions.py Wed Mar 03 14:00:45 2021 +0100 @@ -857,7 +857,7 @@ """ return { # Introduced in Mercurial 0.9.2. - b'revlogv1', + requirements.REVLOGV1_REQUIREMENT, # Introduced in Mercurial 0.9.2. b'store', } @@ -937,7 +937,7 @@ b'dotencode', b'fncache', b'generaldelta', - b'revlogv1', + requirements.REVLOGV1_REQUIREMENT, b'store', requirements.SPARSEREVLOG_REQUIREMENT, requirements.SIDEDATA_REQUIREMENT,
--- a/mercurial/wireprotov1server.py Thu Feb 18 15:07:45 2021 +0100 +++ b/mercurial/wireprotov1server.py Wed Mar 03 14:00:45 2021 +0100 @@ -27,6 +27,7 @@ exchange, pushkey as pushkeymod, pycompat, + requirements as requirementsmod, streamclone, util, wireprototypes, @@ -310,7 +311,7 @@ caps.append(b'stream-preferred') requiredformats = repo.requirements & repo.supportedformats # if our local revlogs are just revlogv1, add 'stream' cap - if not requiredformats - {b'revlogv1'}: + if not requiredformats - {requirementsmod.REVLOGV1_REQUIREMENT}: caps.append(b'stream') # otherwise, add 'streamreqs' detailing our local revlog format else: