##// END OF EJS Templates
dirstate: add a synchronisation point before doing a full dirstate read...
marmoute -
r51123:fc8e37c3 stable
parent child Browse files
Show More
@@ -704,6 +704,16 b' coreconfigitem('
704 )
704 )
705 coreconfigitem(
705 coreconfigitem(
706 b'devel',
706 b'devel',
707 b'sync.dirstate.pre-read-file',
708 default=None,
709 )
710 coreconfigitem(
711 b'devel',
712 b'sync.dirstate.pre-read-file-timeout',
713 default=2,
714 )
715 coreconfigitem(
716 b'devel',
707 b'strip-obsmarkers',
717 b'strip-obsmarkers',
708 default=True,
718 default=True,
709 )
719 )
@@ -10,6 +10,7 b' from . import ('
10 error,
10 error,
11 pathutil,
11 pathutil,
12 policy,
12 policy,
13 testing,
13 txnutil,
14 txnutil,
14 util,
15 util,
15 )
16 )
@@ -276,7 +277,9 b' class dirstatemap(_dirstatemapcommon):'
276 self._opener.join(self._filename)
277 self._opener.join(self._filename)
277 )
278 )
278
279
280 testing.wait_on_cfg(self._ui, b'dirstate.pre-read-file')
279 if self._use_dirstate_v2:
281 if self._use_dirstate_v2:
282
280 if not self.docket.uuid:
283 if not self.docket.uuid:
281 return
284 return
282 st = self._opener.read(self.docket.data_filename())
285 st = self._opener.read(self.docket.data_filename())
@@ -541,6 +544,7 b' if rustmod is not None:'
541 self._opener.join(self._filename)
544 self._opener.join(self._filename)
542 )
545 )
543
546
547 testing.wait_on_cfg(self._ui, b'dirstate.pre-read-file')
544 if self._use_dirstate_v2:
548 if self._use_dirstate_v2:
545 if self.docket.uuid:
549 if self.docket.uuid:
546 # TODO: use mmap when possible
550 # TODO: use mmap when possible
@@ -10,6 +10,7 b' use crate::lock::{try_with_lock_no_wait,'
10 use crate::manifest::{Manifest, Manifestlog};
10 use crate::manifest::{Manifest, Manifestlog};
11 use crate::revlog::filelog::Filelog;
11 use crate::revlog::filelog::Filelog;
12 use crate::revlog::revlog::RevlogError;
12 use crate::revlog::revlog::RevlogError;
13 use crate::utils::debug::debug_wait_for_file_or_print;
13 use crate::utils::files::get_path_from_bytes;
14 use crate::utils::files::get_path_from_bytes;
14 use crate::utils::hg_path::HgPath;
15 use crate::utils::hg_path::HgPath;
15 use crate::utils::SliceExt;
16 use crate::utils::SliceExt;
@@ -308,6 +309,10 b' impl Repo {'
308 if self.has_dirstate_v2() {
309 if self.has_dirstate_v2() {
309 self.read_docket_and_data_file()
310 self.read_docket_and_data_file()
310 } else {
311 } else {
312 debug_wait_for_file_or_print(
313 self.config(),
314 "dirstate.pre-read-file",
315 );
311 let dirstate_file_contents = self.dirstate_file_contents()?;
316 let dirstate_file_contents = self.dirstate_file_contents()?;
312 if dirstate_file_contents.is_empty() {
317 if dirstate_file_contents.is_empty() {
313 self.dirstate_parents.set(DirstateParents::NULL);
318 self.dirstate_parents.set(DirstateParents::NULL);
@@ -324,6 +329,7 b' impl Repo {'
324 fn read_docket_and_data_file(
329 fn read_docket_and_data_file(
325 &self,
330 &self,
326 ) -> Result<OwningDirstateMap, DirstateError> {
331 ) -> Result<OwningDirstateMap, DirstateError> {
332 debug_wait_for_file_or_print(self.config(), "dirstate.pre-read-file");
327 let dirstate_file_contents = self.dirstate_file_contents()?;
333 let dirstate_file_contents = self.dirstate_file_contents()?;
328 if dirstate_file_contents.is_empty() {
334 if dirstate_file_contents.is_empty() {
329 self.dirstate_parents.set(DirstateParents::NULL);
335 self.dirstate_parents.set(DirstateParents::NULL);
@@ -79,3 +79,9 b' pub fn debug_wait_for_file('
79 Ok(())
79 Ok(())
80 }
80 }
81 }
81 }
82
83 pub fn debug_wait_for_file_or_print(config: &Config, config_option: &str) {
84 if let Err(e) = debug_wait_for_file(&config, config_option) {
85 eprintln!("{e}");
86 };
87 }
General Comments 0
You need to be logged in to leave comments. Login now