Mercurial > hg
changeset 48601:baddab229b86
stream-clone: add a explicit set list requirements relevant to stream clone
This set explicitly lists all the requirements that "stream clone" will
preserve. Any other one will not be preserved.
The role of listing the relevant one was previously filled by
`repo.supportedformat`, but it seems clearer to use that such global and
explicit set. The `repo.supportedformat` attribute will be cleaned up in a later
changeset
The true meaning of `repo.supportedformat` vs `repo._basesupported` was lost
over time so, the content is currently bad. For example, `dirstate-v2` is
currently considered relevant to the stream clone, or internal phase is
missing. We kept the same content in this changeset and we will fix them later.
Differential Revision: https://phab.mercurial-scm.org/D12032
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 17 Jan 2022 19:26:36 +0100 |
parents | d9017df70135 |
children | 66b59fbb0cdd |
files | mercurial/bundlecaches.py mercurial/requirements.py mercurial/streamclone.py |
diffstat | 3 files changed, 26 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/bundlecaches.py Mon Jan 24 11:49:06 2022 +0100 +++ b/mercurial/bundlecaches.py Mon Jan 17 19:26:36 2022 +0100 @@ -195,7 +195,7 @@ # repo supports and error if the bundle isn't compatible. if version == b'packed1' and b'requirements' in params: requirements = set(params[b'requirements'].split(b',')) - missingreqs = requirements - repo.supportedformats + missingreqs = requirements - requirementsmod.STREAM_FIXED_REQUIREMENTS if missingreqs: raise error.UnsupportedBundleSpecification( _(b'missing support for repository features: %s')
--- a/mercurial/requirements.py Mon Jan 24 11:49:06 2022 +0100 +++ b/mercurial/requirements.py Mon Jan 17 19:26:36 2022 +0100 @@ -89,3 +89,23 @@ SHARESAFE_REQUIREMENT, DIRSTATE_V2_REQUIREMENT, } + +# List of requirement that impact "stream-clone" (and hardlink clone) and +# cannot be changed in such cases. +# +# requirements not in this list are safe to be altered during stream-clone. +# +# note: the list is currently inherited from previous code and miss some relevant requirement while containing some irrelevant ones. +STREAM_FIXED_REQUIREMENTS = { + BOOKMARKS_IN_STORE_REQUIREMENT, + CHANGELOGV2_REQUIREMENT, + COPIESSDC_REQUIREMENT, + DIRSTATE_V2_REQUIREMENT, + GENERALDELTA_REQUIREMENT, + NODEMAP_REQUIREMENT, + REVLOGV1_REQUIREMENT, + REVLOGV2_REQUIREMENT, + SHARESAFE_REQUIREMENT, + SPARSEREVLOG_REQUIREMENT, + TREEMANIFEST_REQUIREMENT, +}
--- a/mercurial/streamclone.py Mon Jan 24 11:49:06 2022 +0100 +++ b/mercurial/streamclone.py Mon Jan 17 19:26:36 2022 +0100 @@ -32,9 +32,7 @@ ) -def new_stream_clone_requirements( - supported_formats, default_requirements, streamed_requirements -): +def new_stream_clone_requirements(default_requirements, streamed_requirements): """determine the final set of requirement for a new stream clone this method combine the "default" requirements that a new repository would @@ -42,7 +40,7 @@ configuration choice when possible. """ requirements = set(default_requirements) - requirements -= supported_formats + requirements -= requirementsmod.STREAM_FIXED_REQUIREMENTS requirements.update(streamed_requirements) return requirements @@ -52,7 +50,9 @@ This is used for advertising the stream options and to generate the actual stream content.""" - requiredformats = repo.requirements & repo.supportedformats + requiredformats = ( + repo.requirements & requirementsmod.STREAM_FIXED_REQUIREMENTS + ) return requiredformats @@ -209,7 +209,6 @@ with repo.lock(): consumev1(repo, fp, filecount, bytecount) repo.requirements = new_stream_clone_requirements( - repo.supportedformats, repo.requirements, requirements, ) @@ -820,7 +819,6 @@ consumev2(repo, fp, filecount, filesize) repo.requirements = new_stream_clone_requirements( - repo.supportedformats, repo.requirements, requirements, )