store: only inclure revlog related file in `datafiles`
authorPierre-Yves David <pierre-yves.david@octobus.net>
Mon, 15 May 2023 08:55:34 +0200
changeset 50468 fd5507619d16
parent 50467 0dbab42adca5
child 50469 53af67c70af0
store: only inclure revlog related file in `datafiles` This is a "reading" equivalent of the previous patches (see that patch for details).
mercurial/store.py
--- a/mercurial/store.py	Mon May 15 08:55:19 2023 +0200
+++ b/mercurial/store.py	Mon May 15 08:55:34 2023 +0200
@@ -510,7 +510,8 @@
         to it instead. This is very rarely needed."""
         files = self._walk(b'data', True) + self._walk(b'meta', True)
         for (t, u, s) in files:
-            yield (FILEFLAGS_FILELOG | t, u, s)
+            if t is not None:
+                yield (FILEFLAGS_FILELOG | t, u, s)
 
     def topfiles(self):
         # yield manifest before changelog
@@ -790,10 +791,15 @@
             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
+            t |= FILEFLAGS_FILELOG
             try:
-                t = revlog_type(f)
-                assert t is not None, f
-                t |= FILEFLAGS_FILELOG
                 yield t, f, self.getsize(ef)
             except FileNotFoundError:
                 pass