[Updated] D12525: rust-dirstatemap: add `clear_cached_mtime` helper method
Alphare (Raphaël Gomès)
phabricator at mercurial-scm.org
Tue Apr 19 21:55:48 UTC 2022
Closed by commit rHGf3e8b0b0a8c2: rust-dirstatemap: add `clear_cached_mtime` helper method (authored by Alphare).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D12525?vs=33088&id=33279
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D12525/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D12525
AFFECTED FILES
rust/hg-core/src/dirstate_tree/dirstate_map.rs
rust/hg-core/src/dirstate_tree/status.rs
CHANGE DETAILS
diff --git a/rust/hg-core/src/dirstate_tree/status.rs b/rust/hg-core/src/dirstate_tree/status.rs
--- a/rust/hg-core/src/dirstate_tree/status.rs
+++ b/rust/hg-core/src/dirstate_tree/status.rs
@@ -140,10 +140,7 @@
// Remove outdated mtimes before adding new mtimes, in case a given
// directory is both
for path in &outdated {
- let node = dmap.get_or_insert(path)?;
- if let NodeData::CachedDirectory { .. } = &node.data {
- node.data = NodeData::None
- }
+ dmap.clear_cached_mtime(path)?;
}
for (path, mtime) in &new_cachable {
let node = dmap.get_or_insert(path)?;
diff --git a/rust/hg-core/src/dirstate_tree/dirstate_map.rs b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
--- a/rust/hg-core/src/dirstate_tree/dirstate_map.rs
+++ b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
@@ -803,6 +803,26 @@
Ok(())
}
+ /// Clears the cached mtime for the (potential) folder at `path`.
+ pub(super) fn clear_cached_mtime(
+ &mut self,
+ path: &HgPath,
+ ) -> Result<(), DirstateV2ParseError> {
+ let node = match DirstateMap::get_node_mut(
+ self.on_disk,
+ &mut self.unreachable_bytes,
+ &mut self.root,
+ path,
+ )? {
+ Some(node) => node,
+ None => return Ok(()),
+ };
+ if let NodeData::CachedDirectory { .. } = &node.data {
+ node.data = NodeData::None
+ }
+ Ok(())
+ }
+
fn iter_nodes<'tree>(
&'tree self,
) -> impl Iterator<
To: Alphare, #hg-reviewers
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20220419/9cc37bd1/attachment-0002.html>
More information about the Mercurial-patches
mailing list