stream: in v3, skip the "size" fast path if the entries as some unknown size
authorPierre-Yves David <pierre-yves.david@octobus.net>
Tue, 26 Mar 2024 18:55:40 +0000
changeset 51547 8e2a68e10f5c
parent 51546 f376c4d5c4b6
child 51548 1b17eeba9deb
stream: in v3, skip the "size" fast path if the entries as some unknown size We are about to prefetch size during the lock less in the v3 case. So we need to avoid trying to use that prefetched size when it is not available. See next changeset for the motivation.
mercurial/store.py
--- a/mercurial/store.py	Tue Mar 26 08:43:20 2024 +0000
+++ b/mercurial/store.py	Tue Mar 26 18:55:40 2024 +0000
@@ -453,6 +453,10 @@
                 self._file_size = 0
         return self._file_size
 
+    @property
+    def has_size(self):
+        return self._file_size is not None
+
     def get_stream(self, vfs, copies):
         """return data "stream" information for this file
 
@@ -601,7 +605,8 @@
         max_changeset=None,
         preserve_file_count=False,
     ):
-        if (
+        pre_sized = all(f.has_size for f in self.files())
+        if pre_sized and (
             repo is None
             or max_changeset is None
             # This use revlog-v2, ignore for now