comparison rust/hg-core/src/dirstate_tree/dirstate_map.rs @ 49121:10edc54d18f1

rust-dirstatemap: remove `set_dirstate_entry`/`set_entry` methods These methods were needed crutches before the Rust implementation caught up to Python. Calling `set_entry` (whether from Python or Rust) was dangerous since it didn't update any of the counters of the DirstateMap data structure, while having no real way of knowing when to use it "correctly" except it you were one of the 3 people who looked deep enough into the soul of this code. Differential Revision: https://phab.mercurial-scm.org/D12519
author Raphaël Gomès <rgomes@octobus.net>
date Tue, 29 Mar 2022 00:57:06 +0200
parents 3df46f3a3d6c
children afe60def963d
comparison
equal deleted inserted replaced
49120:3df46f3a3d6c 49121:10edc54d18f1
880 self.with_dmap_mut(|map| { 880 self.with_dmap_mut(|map| {
881 map.root = Default::default(); 881 map.root = Default::default();
882 map.nodes_with_entry_count = 0; 882 map.nodes_with_entry_count = 0;
883 map.nodes_with_copy_source_count = 0; 883 map.nodes_with_copy_source_count = 0;
884 }); 884 });
885 }
886
887 pub fn set_entry(
888 &mut self,
889 filename: &HgPath,
890 entry: DirstateEntry,
891 ) -> Result<(), DirstateV2ParseError> {
892 self.with_dmap_mut(|map| {
893 map.get_or_insert(&filename)?.data = NodeData::Entry(entry);
894 Ok(())
895 })
896 } 885 }
897 886
898 pub fn set_tracked( 887 pub fn set_tracked(
899 &mut self, 888 &mut self,
900 filename: &HgPath, 889 filename: &HgPath,