##// END OF EJS Templates
rust-status: save new dircache even if just invalidated...
Raphaël Gomès -
r50450:8ee3889b stable
parent child Browse files
Show More
@@ -303,7 +303,7 b" impl<'a, 'tree, 'on_disk> StatusCommon<'"
303 303 fn check_for_outdated_directory_cache(
304 304 &self,
305 305 dirstate_node: &NodeRef<'tree, 'on_disk>,
306 ) -> Result<(), DirstateV2ParseError> {
306 ) -> Result<bool, DirstateV2ParseError> {
307 307 if self.ignore_patterns_have_changed == Some(true)
308 308 && dirstate_node.cached_directory_mtime()?.is_some()
309 309 {
@@ -311,9 +311,10 b" impl<'a, 'tree, 'on_disk> StatusCommon<'"
311 311 dirstate_node
312 312 .full_path_borrowed(self.dmap.on_disk)?
313 313 .detach_from_tree(),
314 )
314 );
315 return Ok(true);
315 316 }
316 Ok(())
317 Ok(false)
317 318 }
318 319
319 320 /// If this returns true, we can get accurate results by only using
@@ -473,6 +474,7 b" impl<'a, 'tree, 'on_disk> StatusCommon<'"
473 474 dirstate_node: NodeRef<'tree, 'on_disk>,
474 475 has_ignored_ancestor: &'ancestor HasIgnoredAncestor<'ancestor>,
475 476 ) -> Result<(), DirstateV2ParseError> {
477 let outdated_dircache =
476 478 self.check_for_outdated_directory_cache(&dirstate_node)?;
477 479 let hg_path = &dirstate_node.full_path_borrowed(self.dmap.on_disk)?;
478 480 let file_type = fs_metadata.file_type();
@@ -510,6 +512,7 b" impl<'a, 'tree, 'on_disk> StatusCommon<'"
510 512 children_all_have_dirstate_node_or_are_ignored,
511 513 fs_metadata,
512 514 dirstate_node,
515 outdated_dircache,
513 516 )?
514 517 } else {
515 518 if file_or_symlink && self.matcher.matches(&hg_path) {
@@ -549,11 +552,17 b" impl<'a, 'tree, 'on_disk> StatusCommon<'"
549 552 Ok(())
550 553 }
551 554
555 /// Save directory mtime if applicable.
556 ///
557 /// `outdated_directory_cache` is `true` if we've just invalidated the
558 /// cache for this directory in `check_for_outdated_directory_cache`,
559 /// which forces the update.
552 560 fn maybe_save_directory_mtime(
553 561 &self,
554 562 children_all_have_dirstate_node_or_are_ignored: bool,
555 563 directory_metadata: &std::fs::Metadata,
556 564 dirstate_node: NodeRef<'tree, 'on_disk>,
565 outdated_directory_cache: bool,
557 566 ) -> Result<(), DirstateV2ParseError> {
558 567 if !children_all_have_dirstate_node_or_are_ignored {
559 568 return Ok(());
@@ -621,9 +630,10 b" impl<'a, 'tree, 'on_disk> StatusCommon<'"
621 630 // We deem this scenario (unlike the previous one) to be
622 631 // unlikely enough in practice.
623 632
624 let is_up_to_date =
625 if let Some(cached) = dirstate_node.cached_directory_mtime()? {
626 cached.likely_equal(directory_mtime)
633 let is_up_to_date = if let Some(cached) =
634 dirstate_node.cached_directory_mtime()?
635 {
636 !outdated_directory_cache && cached.likely_equal(directory_mtime)
627 637 } else {
628 638 false
629 639 };
@@ -993,16 +993,8 b' Changing the hgignore rules makes us rec'
993 993 $ hg status
994 994 ? another-subdir/something-else
995 995
996 $ hg debugdirstate --all --no-dates | grep '^ '
997 0 -1 unset subdir (known-bad-output !)
998
999 For some reason the first [status] is not enough to save the updated
1000 directory mtime into the cache. The second invocation does it.
1001 The first call only clears the directory cache by marking the directories
1002 as "outdated", which seems like a bug.
1003
1004 $ hg status
1005 ? another-subdir/something-else
996 One invocation of status is enough to populate the cache even if it's invalidated
997 in the same run.
1006 998
1007 999 $ hg debugdirstate --all --no-dates | grep '^ '
1008 1000 0 -1 set subdir
General Comments 0
You need to be logged in to leave comments. Login now