store: have the revlog determine which files are volatile itself
authorPierre-Yves David <pierre-yves.david@octobus.net>
Tue, 30 May 2023 16:33:28 +0100
changeset 50668 6b522a9e7451
parent 50666 60f9602b413e
child 50669 cdb471c8ebcf
store: have the revlog determine which files are volatile itself This is a first step toward simplifying the walk step.
mercurial/store.py
--- a/mercurial/store.py	Wed Mar 08 14:23:43 2023 +0100
+++ b/mercurial/store.py	Tue May 30 16:33:28 2023 +0100
@@ -608,7 +608,14 @@
             for ext in sorted(self._details, key=_ext_key):
                 path = self._path_prefix + ext
                 data = self._details[ext]
-                self._files.append(StoreFile(unencoded_path=path, **data))
+                # files that are "volatile" and might change between
+                # listing and streaming
+                #
+                # note: the ".nd" file are nodemap data and won't "change"
+                # but they might be deleted.
+                volatile = ext.endswith(REVLOG_FILES_VOLATILE_EXT)
+                f = StoreFile(unencoded_path=path, is_volatile=volatile, **data)
+                self._files.append(f)
         return self._files
 
     def get_streams(
@@ -796,7 +803,6 @@
                     revlog_target_id += b'/'
                 for ext, (t, s) in sorted(details.items()):
                     file_details[ext] = {
-                        'is_volatile': bool(t & FILEFLAGS_VOLATILE),
                         'file_size': s,
                     }
                 yield RevlogStoreEntry(
@@ -852,7 +858,6 @@
                 file_details = {}
                 for ext, (t, s) in details.items():
                     file_details[ext] = {
-                        'is_volatile': bool(t & FILEFLAGS_VOLATILE),
                         'file_size': s,
                     }
                 yield RevlogStoreEntry(
@@ -1155,9 +1160,7 @@
                 # unreachable
                 assert False, revlog
             for ext, t in details.items():
-                file_details[ext] = {
-                    'is_volatile': bool(t & FILEFLAGS_VOLATILE),
-                }
+                file_details[ext] = {}
             entry = RevlogStoreEntry(
                 path_prefix=revlog,
                 revlog_type=rl_type,