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 @@ -727,49 +727,6 @@ Ok(new) } - fn add_or_remove_file( - &mut self, - path: &HgPath, - old_state: Option, - new_entry: DirstateEntry, - ) -> Result<(), DirstateV2ParseError> { - let had_entry = old_state.is_some(); - let was_tracked = old_state.map_or(false, |s| s.is_tracked()); - let tracked_count_increment = - match (was_tracked, new_entry.state().is_tracked()) { - (false, true) => 1, - (true, false) => -1, - _ => 0, - }; - - let node = Self::get_or_insert_node( - self.on_disk, - &mut self.unreachable_bytes, - &mut self.root, - path, - WithBasename::to_cow_owned, - |ancestor| { - if !had_entry { - ancestor.descendants_with_entry_count += 1; - } - - // We can’t use `+= increment` because the counter is unsigned, - // and we want debug builds to detect accidental underflow - // through zero - match tracked_count_increment { - 1 => ancestor.tracked_descendants_count += 1, - -1 => ancestor.tracked_descendants_count -= 1, - _ => {} - } - }, - )?; - if !had_entry { - self.nodes_with_entry_count += 1 - } - node.data = NodeData::Entry(new_entry); - Ok(()) - } - /// It is the responsibility of the caller to know that there was an entry /// there before. Does not handle the removal of copy source fn set_untracked( @@ -938,17 +895,6 @@ }) } - pub fn add_file( - &mut self, - filename: &HgPath, - entry: DirstateEntry, - ) -> Result<(), DirstateError> { - let old_state = self.get(filename)?.map(|e| e.state()); - self.with_dmap_mut(|map| { - Ok(map.add_or_remove_file(filename, old_state, entry)?) - }) - } - pub fn set_tracked( &mut self, filename: &HgPath, diff --git a/rust/hg-cpython/src/dirstate/dirstate_map.rs b/rust/hg-cpython/src/dirstate/dirstate_map.rs --- a/rust/hg-cpython/src/dirstate/dirstate_map.rs +++ b/rust/hg-cpython/src/dirstate/dirstate_map.rs @@ -118,20 +118,6 @@ Ok(py.None()) } - def addfile( - &self, - f: PyBytes, - item: DirstateItem, - ) -> PyResult { - let filename = HgPath::new(f.data(py)); - let entry = item.get_entry(py); - self.inner(py) - .borrow_mut() - .add_file(filename, entry) - .map_err(|e |dirstate_error(py, e))?; - Ok(PyNone) - } - def set_tracked(&self, f: PyObject) -> PyResult { let bytes = f.extract::(py)?; let path = HgPath::new(bytes.data(py));