D12032: stream-clone: add a explicit set list requirements relevant to stream clone
marmoute (Pierre-Yves David)
phabricator at mercurial-scm.org
Mon Jan 24 11:36:41 UTC 2022
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.
REVISION SUMMARY
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.
REPOSITORY
rHG Mercurial
BRANCH
default
REVISION DETAIL
https://phab.mercurial-scm.org/D12032
AFFECTED FILES
mercurial/bundlecaches.py
mercurial/requirements.py
mercurial/streamclone.py
CHANGE DETAILS
diff --git a/mercurial/streamclone.py b/mercurial/streamclone.py
--- a/mercurial/streamclone.py
+++ b/mercurial/streamclone.py
@@ -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,
)
diff --git a/mercurial/requirements.py b/mercurial/requirements.py
--- a/mercurial/requirements.py
+++ b/mercurial/requirements.py
@@ -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 cache.
+#
+# 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,
+}
diff --git a/mercurial/bundlecaches.py b/mercurial/bundlecaches.py
--- a/mercurial/bundlecaches.py
+++ b/mercurial/bundlecaches.py
@@ -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')
To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
More information about the Mercurial-devel
mailing list