dirstate: abstract the reading of the data file in v2 in a method stable
authorPierre-Yves David <pierre-yves.david@octobus.net>
Wed, 01 Mar 2023 16:05:28 +0100
branchstable
changeset 50236 53f196622699
parent 50235 385977432227
child 50237 a3b1ab5f5dee
dirstate: abstract the reading of the data file in v2 in a method We will need more changes to avoid some race conditions during read, so we first isolate the simple logic before making it more complicated.
mercurial/dirstatemap.py
--- a/mercurial/dirstatemap.py	Mon Feb 27 03:14:30 2023 +0100
+++ b/mercurial/dirstatemap.py	Wed Mar 01 16:05:28 2023 +0100
@@ -124,6 +124,9 @@
             )
         return self._docket
 
+    def _read_v2_data(self):
+        return self._opener.read(self.docket.data_filename())
+
     def write_v2_no_append(self, tr, st, meta, packed):
         old_docket = self.docket
         new_docket = docketmod.DirstateDocket.with_new_uuid(
@@ -283,7 +286,7 @@
             if not self.docket.uuid:
                 return
             testing.wait_on_cfg(self._ui, b'dirstate.post-docket-read-file')
-            st = self._opener.read(self.docket.data_filename())
+            st = self._read_v2_data()
         else:
             st = self._readdirstatefile()