Mercurial > public > mercurial-scm > hg
diff rust/hg-core/src/dirstate_tree/dispatch.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 | 357307feaf61 |
line wrap: on
line diff
--- a/rust/hg-core/src/dirstate_tree/dispatch.rs Fri Jul 16 22:30:11 2021 +0200 +++ b/rust/hg-core/src/dirstate_tree/dispatch.rs Mon Jul 19 07:23:55 2021 +0200 @@ -37,6 +37,8 @@ /// Remove information about all files in this map fn clear(&mut self); + fn set_v1(&mut self, filename: &HgPath, entry: DirstateEntry); + /// Add or change the information associated to a given file. /// /// `old_state` is the state in the entry that `get` would have returned @@ -95,7 +97,13 @@ /// Mark the given path as "normal" file. This is only relevant in the flat /// dirstate map where there is a separate `HashSet` that needs to be kept /// up to date. - fn non_normal_entries_remove(&mut self, key: &HgPath); + /// Returns whether the key was present in the set. + fn non_normal_entries_remove(&mut self, key: &HgPath) -> bool; + + /// Mark the given path as "non-normal" file. + /// This is only relevant in the flat dirstate map where there is a + /// separate `HashSet` that needs to be kept up to date. + fn non_normal_entries_add(&mut self, key: &HgPath); /// Return an iterator of paths whose respective entry are either /// "non-normal" (see `non_normal_entries_contains`) or "from other @@ -305,6 +313,14 @@ self.clear() } + /// Used to set a value directory. + /// + /// XXX Is temporary during a refactor of V1 dirstate and will disappear + /// shortly. + fn set_v1(&mut self, filename: &HgPath, entry: DirstateEntry) { + self.set_v1_inner(&filename, entry) + } + fn add_file( &mut self, filename: &HgPath, @@ -346,10 +362,14 @@ Ok(non_normal.contains(key)) } - fn non_normal_entries_remove(&mut self, key: &HgPath) { + fn non_normal_entries_remove(&mut self, key: &HgPath) -> bool { self.non_normal_entries_remove(key) } + fn non_normal_entries_add(&mut self, key: &HgPath) { + self.non_normal_entries_add(key) + } + fn non_normal_or_other_parent_paths( &mut self, ) -> Box<dyn Iterator<Item = Result<&HgPath, DirstateV2ParseError>> + '_>