diff mercurial/verify.py @ 50474:4cbdfab6f812

store: lazily get file size on demand for the fncache case We don't have the information in the first place, so we can avoid querying the file system inconditionnaly for use case we don't needs it. This change requires the StoreFile class to be passed a vfs to retrieve the file_size if needed. In the non-fncache case, we already have the information from file system walking, so we keep it and use it.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 15 May 2023 08:58:01 +0200
parents 9fdc28e21b68
children 862e3a13da44
line wrap: on
line diff
--- a/mercurial/verify.py	Mon May 15 08:57:45 2023 +0200
+++ b/mercurial/verify.py	Mon May 15 08:58:01 2023 +0200
@@ -410,7 +410,7 @@
             for entry in repo.store.datafiles(undecodable=undecodable):
                 for file_ in entry.files():
                     f = file_.unencoded_path
-                    size = file_.file_size
+                    size = file_.file_size(repo.store.vfs)
                     if (size > 0 or not revlogv1) and f.startswith(b'meta/'):
                         storefiles.add(_normpath(f))
                         subdirs.add(os.path.dirname(f))
@@ -477,7 +477,7 @@
         undecodable = []
         for entry in repo.store.datafiles(undecodable=undecodable):
             for file_ in entry.files():
-                size = file_.file_size
+                size = file_.file_size(repo.store.vfs)
                 f = file_.unencoded_path
                 if (size > 0 or not revlogv1) and f.startswith(b'data/'):
                     storefiles.add(_normpath(f))