diff rust/hg-core/src/repo.rs @ 50228:fc8e37c380d3 stable

dirstate: add a synchronisation point before doing a full dirstate read This will be useful to test some race conditions around the dirstate.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sat, 25 Feb 2023 01:07:44 +0100
parents cbd4c9234e25
children 2be6d5782728
line wrap: on
line diff
--- a/rust/hg-core/src/repo.rs	Tue Feb 28 12:15:19 2023 +0100
+++ b/rust/hg-core/src/repo.rs	Sat Feb 25 01:07:44 2023 +0100
@@ -10,6 +10,7 @@
 use crate::manifest::{Manifest, Manifestlog};
 use crate::revlog::filelog::Filelog;
 use crate::revlog::revlog::RevlogError;
+use crate::utils::debug::debug_wait_for_file_or_print;
 use crate::utils::files::get_path_from_bytes;
 use crate::utils::hg_path::HgPath;
 use crate::utils::SliceExt;
@@ -308,6 +309,10 @@
         if self.has_dirstate_v2() {
             self.read_docket_and_data_file()
         } else {
+            debug_wait_for_file_or_print(
+                self.config(),
+                "dirstate.pre-read-file",
+            );
             let dirstate_file_contents = self.dirstate_file_contents()?;
             if dirstate_file_contents.is_empty() {
                 self.dirstate_parents.set(DirstateParents::NULL);
@@ -324,6 +329,7 @@
     fn read_docket_and_data_file(
         &self,
     ) -> Result<OwningDirstateMap, DirstateError> {
+        debug_wait_for_file_or_print(self.config(), "dirstate.pre-read-file");
         let dirstate_file_contents = self.dirstate_file_contents()?;
         if dirstate_file_contents.is_empty() {
             self.dirstate_parents.set(DirstateParents::NULL);