diff mercurial/store.py @ 50706:0452af304808

stream-clone: add a v3 version of the protocol This new version is less rigid regarding the extract number of files and number of bytes to be actually transfered, it also lays the groundwork for other improvements. The format stays experimental, but this is an interesting base to build upon.
author Arseniy Alekseyev <aalekseyev@janestreet.com>
date Thu, 01 Jun 2023 17:39:22 +0100
parents e324329fc97e
children 30381812708d
line wrap: on
line diff
--- a/mercurial/store.py	Thu Jun 01 18:20:28 2023 +0100
+++ b/mercurial/store.py	Thu Jun 01 17:39:22 2023 +0100
@@ -490,6 +490,7 @@
         vfs=None,
         copies=None,
         max_changeset=None,
+        preserve_file_count=False,
     ):
         """return a list of data stream associated to files for this entry
 
@@ -599,6 +600,7 @@
         vfs=None,
         copies=None,
         max_changeset=None,
+        preserve_file_count=False,
     ):
         if (
             repo is None
@@ -613,7 +615,18 @@
                 vfs=vfs,
                 copies=copies,
                 max_changeset=max_changeset,
+                preserve_file_count=preserve_file_count,
             )
+        elif not preserve_file_count:
+            stream = [
+                f.get_stream(vfs, copies)
+                for f in self.files()
+                if not f.unencoded_path.endswith((b'.i', b'.d'))
+            ]
+            rl = self.get_revlog_instance(repo).get_revlog()
+            rl_stream = rl.get_streams(max_changeset)
+            stream.extend(rl_stream)
+            return stream
 
         name_to_size = {}
         for f in self.files():