# HG changeset patch # User Raphaël Gomès # Date 1670939496 -3600 # Node ID 2be6d5782728efaa29cbfc1178a23e1a30e4dc01 # Parent cf0d7cd6a6fa5621887e8ea6df957530bcb94390 dirstate: add a synchronisation point in the middle of the read This will be useful to test some more race conditions around dirstate. diff -r cf0d7cd6a6fa -r 2be6d5782728 mercurial/configitems.py --- a/mercurial/configitems.py Sun Feb 26 16:27:50 2023 +0100 +++ b/mercurial/configitems.py Tue Dec 13 14:51:36 2022 +0100 @@ -704,6 +704,16 @@ ) coreconfigitem( b'devel', + b'sync.dirstate.post-docket-read-file', + default=None, +) +coreconfigitem( + b'devel', + b'sync.dirstate.post-docket-read-file-timeout', + default=2, +) +coreconfigitem( + b'devel', b'sync.dirstate.pre-read-file', default=None, ) diff -r cf0d7cd6a6fa -r 2be6d5782728 mercurial/dirstatemap.py --- a/mercurial/dirstatemap.py Sun Feb 26 16:27:50 2023 +0100 +++ b/mercurial/dirstatemap.py Tue Dec 13 14:51:36 2022 +0100 @@ -282,6 +282,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()) else: st = self._readdirstatefile() @@ -547,6 +548,9 @@ testing.wait_on_cfg(self._ui, b'dirstate.pre-read-file') if self._use_dirstate_v2: if self.docket.uuid: + testing.wait_on_cfg( + self._ui, b'dirstate.post-docket-read-file' + ) # TODO: use mmap when possible data = self._opener.read(self.docket.data_filename()) else: diff -r cf0d7cd6a6fa -r 2be6d5782728 rust/hg-core/src/repo.rs --- a/rust/hg-core/src/repo.rs Sun Feb 26 16:27:50 2023 +0100 +++ b/rust/hg-core/src/repo.rs Tue Dec 13 14:51:36 2022 +0100 @@ -339,6 +339,10 @@ let docket = crate::dirstate_tree::on_disk::read_docket( &dirstate_file_contents, )?; + debug_wait_for_file_or_print( + self.config(), + "dirstate.post-docket-read-file", + ); self.dirstate_parents.set(docket.parents()); self.dirstate_data_file_uuid .set(Some(docket.uuid.to_owned()));