##// END OF EJS Templates
dirstate-tree: Downgrade `&mut Node` to `&Node` in status and serialization...
Simon Sapin -
r48122:0252600f default
parent child Browse files
Show More
@@ -68,9 +68,9 b" impl<'on_disk> Node<'on_disk> {"
68 68 }
69 69
70 70 pub(super) fn sorted<'tree>(
71 nodes: &'tree mut ChildNodes<'on_disk>,
72 ) -> Vec<(&'tree NodeKey<'on_disk>, &'tree mut Self)> {
73 let mut vec: Vec<_> = nodes.iter_mut().collect();
71 nodes: &'tree ChildNodes<'on_disk>,
72 ) -> Vec<(&'tree NodeKey<'on_disk>, &'tree Self)> {
73 let mut vec: Vec<_> = nodes.iter().collect();
74 74 // `sort_unstable_by_key` doesn’t allow keys borrowing from the value:
75 75 // https://github.com/rust-lang/rust/issues/34162
76 76 vec.sort_unstable_by(|(path1, _), (path2, _)| path1.cmp(path2));
@@ -258,7 +258,7 b' pub(super) fn write('
258 258 }
259 259
260 260 fn write_nodes(
261 nodes: &mut dirstate_map::ChildNodes,
261 nodes: &dirstate_map::ChildNodes,
262 262 out: &mut Vec<u8>,
263 263 ) -> Result<ChildNodes, DirstateError> {
264 264 // `dirstate_map::ChildNodes` is a `HashMap` with undefined iteration
@@ -269,7 +269,7 b' fn write_nodes('
269 269 let mut on_disk_nodes = Vec::with_capacity(nodes.len());
270 270 for (full_path, node) in nodes {
271 271 on_disk_nodes.push(Node {
272 children: write_nodes(&mut node.children, out)?,
272 children: write_nodes(&node.children, out)?,
273 273 tracked_descendants_count: node.tracked_descendants_count.into(),
274 274 full_path: write_slice::<u8>(
275 275 full_path.full_path().as_bytes(),
@@ -287,7 +287,7 b' fn write_nodes('
287 287 len: 0.into(),
288 288 }
289 289 },
290 entry: if let Some(entry) = &mut node.entry {
290 entry: if let Some(entry) = &node.entry {
291 291 OptEntry {
292 292 state: entry.state.into(),
293 293 mode: entry.mode.into(),
@@ -56,7 +56,7 b" pub fn status<'tree>("
56 56 let has_ignored_ancestor = false;
57 57 common.traverse_fs_directory_and_dirstate(
58 58 has_ignored_ancestor,
59 &mut dmap.root,
59 &dmap.root,
60 60 hg_path,
61 61 &root_dir,
62 62 is_at_repo_root,
@@ -93,7 +93,7 b" impl<'tree, 'a> StatusCommon<'tree, 'a> "
93 93 fn traverse_fs_directory_and_dirstate(
94 94 &self,
95 95 has_ignored_ancestor: bool,
96 dirstate_nodes: &'tree mut ChildNodes,
96 dirstate_nodes: &'tree ChildNodes,
97 97 directory_hg_path: &'tree HgPath,
98 98 directory_fs_path: &Path,
99 99 is_at_repo_root: bool,
@@ -151,7 +151,7 b" impl<'tree, 'a> StatusCommon<'tree, 'a> "
151 151 &self,
152 152 fs_entry: &DirEntry,
153 153 hg_path: &'tree HgPath,
154 dirstate_node: &'tree mut Node,
154 dirstate_node: &'tree Node,
155 155 has_ignored_ancestor: bool,
156 156 ) {
157 157 let file_type = fs_entry.metadata.file_type();
@@ -173,7 +173,7 b" impl<'tree, 'a> StatusCommon<'tree, 'a> "
173 173 let is_at_repo_root = false;
174 174 self.traverse_fs_directory_and_dirstate(
175 175 is_ignored,
176 &mut dirstate_node.children,
176 &dirstate_node.children,
177 177 hg_path,
178 178 &fs_entry.full_path,
179 179 is_at_repo_root,
@@ -220,7 +220,7 b" impl<'tree, 'a> StatusCommon<'tree, 'a> "
220 220 }
221 221 }
222 222
223 for (child_hg_path, child_node) in &mut dirstate_node.children {
223 for (child_hg_path, child_node) in &dirstate_node.children {
224 224 self.traverse_dirstate_only(
225 225 child_hg_path.full_path(),
226 226 child_node,
@@ -278,10 +278,10 b" impl<'tree, 'a> StatusCommon<'tree, 'a> "
278 278 fn traverse_dirstate_only(
279 279 &self,
280 280 hg_path: &'tree HgPath,
281 dirstate_node: &'tree mut Node,
281 dirstate_node: &'tree Node,
282 282 ) {
283 283 self.mark_removed_or_deleted_if_file(hg_path, dirstate_node.state());
284 dirstate_node.children.par_iter_mut().for_each(
284 dirstate_node.children.par_iter().for_each(
285 285 |(child_hg_path, child_node)| {
286 286 self.traverse_dirstate_only(
287 287 child_hg_path.full_path(),
General Comments 0
You need to be logged in to leave comments. Login now