changeset 50516:43ed1f12b00a

stream-clone: yield cache entry in `_entries_walk` too The new function now cover the same ground as _v2_walk.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sun, 21 May 2023 03:21:00 +0200
parents 06d580b8f432
children cd2a2963b982
files mercurial/streamclone.py
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/streamclone.py	Sun May 21 03:10:59 2023 +0200
+++ b/mercurial/streamclone.py	Sun May 21 03:21:00 2023 +0200
@@ -682,6 +682,15 @@
     for entry in entries:
         yield (_srcstore, entry)
 
+    for name in cacheutil.cachetocopy(repo):
+        if repo.cachevfs.exists(name):
+            # not really a StoreEntry, but close enough
+            entry = store.SimpleStoreEntry(
+                entry_path=name,
+                is_volatile=True,
+            )
+            yield (_srccache, entry)
+
 
 def _v2_walk(repo, includes, excludes, includeobsmarkers):
     """emit a seris of files information useful to clone a repo
@@ -711,10 +720,6 @@
                     ft = _filefull
                 files.append((vfs_key, f.unencoded_path, ft, file_size))
                 totalfilesize += file_size
-    for name in cacheutil.cachetocopy(repo):
-        if repo.cachevfs.exists(name):
-            totalfilesize += repo.cachevfs.lstat(name).st_size
-            files.append((_srccache, name, _filefull, None))
     return files, totalfilesize