rust/hg-core/src/dirstate_tree/dirstate_map.rs
changeset 49112 a55934393078
parent 49111 8a17fc501eda
child 49120 3df46f3a3d6c
--- a/rust/hg-core/src/dirstate_tree/dirstate_map.rs	Wed Mar 23 17:16:10 2022 +0100
+++ b/rust/hg-core/src/dirstate_tree/dirstate_map.rs	Wed Mar 23 17:19:32 2022 +0100
@@ -727,49 +727,6 @@
         Ok(new)
     }
 
-    fn add_or_remove_file(
-        &mut self,
-        path: &HgPath,
-        old_state: Option<EntryState>,
-        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,