[Updated] 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 14:44:18 UTC 2022


marmoute updated this revision to Diff 31737.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D12032?vs=31732&id=31737

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D12032/new/

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 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,
+}
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, Alphare
Cc: Alphare, mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20220124/7997bb74/attachment-0002.html>


More information about the Mercurial-patches mailing list