store: properly compute the targer_id of manifestlog in no-fncache walk
authorPierre-Yves David <pierre-yves.david@octobus.net>
Mon, 29 May 2023 13:29:01 +0200
changeset 50629 309cbd8400ae
parent 50628 3ea3767c23a4
child 50630 8c7b04e69894
store: properly compute the targer_id of manifestlog in no-fncache walk Creating RevlogStoreEntry is good, but we need to drop the final `00manifest` part to create something correct.
mercurial/store.py
--- a/mercurial/store.py	Mon May 29 13:28:33 2023 +0200
+++ b/mercurial/store.py	Mon May 29 13:29:01 2023 +0200
@@ -680,15 +680,18 @@
         be a list and the filenames that can't be decoded are added
         to it instead. This is very rarely needed."""
         dirs = [
-            (b'data', FILEFLAGS_FILELOG),
-            (b'meta', FILEFLAGS_MANIFESTLOG),
+            (b'data', FILEFLAGS_FILELOG, False),
+            (b'meta', FILEFLAGS_MANIFESTLOG, True),
         ]
-        for base_dir, rl_type in dirs:
+        for base_dir, rl_type, strip_filename in dirs:
             files = self._walk(base_dir, True, undecodable=undecodable)
             files = (f for f in files if f[1][0] is not None)
             for revlog, details in _gather_revlog(files):
                 file_details = {}
                 revlog_target_id = revlog.split(b'/', 1)[1]
+                if strip_filename and b'/' in revlog:
+                    revlog_target_id = revlog_target_id.rsplit(b'/', 1)[0]
+                    revlog_target_id += b'/'
                 for ext, (t, s) in sorted(details.items()):
                     file_details[ext] = {
                         'is_volatile': bool(t & FILEFLAGS_VOLATILE),