changeset 50480:d4f54aded22e

store: also group files by revlog in fncache version of datafiles One more step.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 15 May 2023 08:58:49 +0200
parents 5217e36356bb
children b08243dbc2e3
files mercurial/store.py
diffstat 1 files changed, 17 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/store.py	Mon May 15 08:58:33 2023 +0200
+++ b/mercurial/store.py	Mon May 15 08:58:49 2023 +0200
@@ -934,23 +934,23 @@
     def datafiles(
         self, matcher=None, undecodable=None
     ) -> Generator[BaseStoreEntry, None, None]:
-        for f in sorted(self.fncache):
-            if not _matchtrackedpath(f, matcher):
-                continue
-            ef = self.encode(f)
-            t = revlog_type(f)
-            if t is None:
-                # Note: this should not be in the fncache then…
-                #
-                # However the fncache might contains such file added by
-                # previous version of Mercurial.
-                continue
-            yield RevlogStoreEntry(
-                unencoded_path=f,
-                revlog_type=FILEFLAGS_FILELOG,
-                is_revlog_main=bool(t & FILEFLAGS_REVLOG_MAIN),
-                is_volatile=bool(t & FILEFLAGS_VOLATILE),
-            )
+        files = ((f, revlog_type(f)) for f in self.fncache)
+        # Note: all files in fncache should be revlog related, However the
+        # fncache might contains such file added by previous version of
+        # Mercurial.
+        files = (f for f in files if f[1] is not None)
+        by_revlog = _gather_revlog(files)
+        for revlog, details in by_revlog:
+            for ext, t in sorted(details.items()):
+                f = revlog + ext
+                if not _matchtrackedpath(f, matcher):
+                    continue
+                yield RevlogStoreEntry(
+                    unencoded_path=f,
+                    revlog_type=FILEFLAGS_FILELOG,
+                    is_revlog_main=bool(t & FILEFLAGS_REVLOG_MAIN),
+                    is_volatile=bool(t & FILEFLAGS_VOLATILE),
+                )
 
     def copylist(self):
         d = (