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