comparison rust/hg-core/src/dirstate_tree/dirstate_map.rs @ 47692:e5fb14a07866

dirstate-map: move most of `dirstate.update_file` logic in the dsmap A new `reset_state` method is introduced to deal with most of that logic. This move things one layer lower, but the ultimate goal is to deal with most of this at the DirstateItem level. This reveal various imperfection with the data passed to update_file by `mergestate.recordupdates`, however this is orthogonal to this patch and should be dealt with at a higher level. Differential Revision: https://phab.mercurial-scm.org/D11134
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 19 Jul 2021 07:23:55 +0200
parents 284a20269a97
children f2a9db29cb2d
comparison
equal deleted inserted replaced
47691:33beeb32f73a 47692:e5fb14a07866
755 self.root = Default::default(); 755 self.root = Default::default();
756 self.nodes_with_entry_count = 0; 756 self.nodes_with_entry_count = 0;
757 self.nodes_with_copy_source_count = 0; 757 self.nodes_with_copy_source_count = 0;
758 } 758 }
759 759
760 fn set_v1(&mut self, filename: &HgPath, entry: DirstateEntry) {
761 let node =
762 self.get_or_insert(&filename).expect("no parse error in v1");
763 node.data = NodeData::Entry(entry);
764 node.children = ChildNodes::default();
765 node.copy_source = None;
766 node.descendants_with_entry_count = 0;
767 node.tracked_descendants_count = 0;
768 }
769
760 fn add_file( 770 fn add_file(
761 &mut self, 771 &mut self,
762 filename: &HgPath, 772 filename: &HgPath,
763 entry: DirstateEntry, 773 entry: DirstateEntry,
764 added: bool, 774 added: bool,
980 } else { 990 } else {
981 false 991 false
982 }) 992 })
983 } 993 }
984 994
985 fn non_normal_entries_remove(&mut self, _key: &HgPath) { 995 fn non_normal_entries_remove(&mut self, key: &HgPath) -> bool {
996 // Do nothing, this `DirstateMap` does not have a separate "non normal
997 // entries" set that need to be kept up to date.
998 if let Ok(Some(v)) = self.get(key) {
999 return v.is_non_normal();
1000 }
1001 false
1002 }
1003
1004 fn non_normal_entries_add(&mut self, _key: &HgPath) {
986 // Do nothing, this `DirstateMap` does not have a separate "non normal 1005 // Do nothing, this `DirstateMap` does not have a separate "non normal
987 // entries" set that need to be kept up to date 1006 // entries" set that need to be kept up to date
988 } 1007 }
989 1008
990 fn non_normal_or_other_parent_paths( 1009 fn non_normal_or_other_parent_paths(