diff mercurial/streamclone.py @ 50546:a32d739b0ffb

store: make `walk` return an entry for phase if requested so Instead of having dedicated code in the streamclone code, we should have the store deal with advertising the data it contains.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sun, 21 May 2023 02:15:04 +0200
parents 4cbdfab6f812
children 0925eaf09c8b
line wrap: on
line diff
--- a/mercurial/streamclone.py	Mon May 22 10:20:24 2023 +0100
+++ b/mercurial/streamclone.py	Sun May 21 02:15:04 2023 +0200
@@ -241,8 +241,8 @@
 
 
 # This is it's own function so extensions can override it.
-def _walkstreamfiles(repo, matcher=None):
-    return repo.store.walk(matcher)
+def _walkstreamfiles(repo, matcher=None, phase=False):
+    return repo.store.walk(matcher, phase=phase)
 
 
 def generatev1(repo):
@@ -679,7 +679,8 @@
     if includes or excludes:
         matcher = narrowspec.match(repo.root, includes, excludes)
 
-    for entry in _walkstreamfiles(repo, matcher):
+    phase = not repo.publishing()
+    for entry in _walkstreamfiles(repo, matcher, phase=phase):
         for f in entry.files():
             file_size = f.file_size(repo.store.vfs)
             if file_size:
@@ -688,10 +689,6 @@
                     ft = _filefull
                 entries.append((_srcstore, f.unencoded_path, ft, file_size))
                 totalfilesize += file_size
-    for name in _walkstreamfullstorefiles(repo):
-        if repo.svfs.exists(name):
-            totalfilesize += repo.svfs.lstat(name).st_size
-            entries.append((_srcstore, name, _filefull, None))
     if includeobsmarkers and repo.svfs.exists(b'obsstore'):
         totalfilesize += repo.svfs.lstat(b'obsstore').st_size
         entries.append((_srcstore, b'obsstore', _filefull, None))