diff --git a/rust/hg-core/src/dirstate/dirstate_map.rs b/rust/hg-core/src/dirstate/dirstate_map.rs --- a/rust/hg-core/src/dirstate/dirstate_map.rs +++ b/rust/hg-core/src/dirstate/dirstate_map.rs @@ -5,6 +5,7 @@ // This software may be used and distributed according to the terms of the // GNU General Public License version 2 or any later version. +use crate::dirstate::parsers::clear_ambiguous_mtime; use crate::dirstate::parsers::Timestamp; use crate::errors::HgError; use crate::revlog::node::NULL_NODE; @@ -188,21 +189,13 @@ now: i32, ) { for filename in filenames { - let mut changed = false; if let Some(entry) = self.state_map.get_mut(&filename) { - if entry.state == EntryState::Normal && entry.mtime == now { - changed = true; - *entry = DirstateEntry { - mtime: MTIME_UNSET, - ..*entry - }; + if clear_ambiguous_mtime(entry, now) { + self.get_non_normal_other_parent_entries() + .0 + .insert(filename.to_owned()); } } - if changed { - self.get_non_normal_other_parent_entries() - .0 - .insert(filename.to_owned()); - } } } 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 @@ -287,12 +287,14 @@ todo!() } - fn clear_ambiguous_times( - &mut self, - _filenames: Vec, - _now: i32, - ) { - todo!() + fn clear_ambiguous_times(&mut self, filenames: Vec, now: i32) { + for filename in filenames { + if let Some(node) = Self::get_node_mut(&mut self.root, &filename) { + if let Some(entry) = node.entry.as_mut() { + clear_ambiguous_mtime(entry, now); + } + } + } } fn non_normal_entries_contains(&mut self, _key: &HgPath) -> bool {