equal
deleted
inserted
replaced
54 let is_at_repo_root = true; |
54 let is_at_repo_root = true; |
55 let hg_path = HgPath::new(""); |
55 let hg_path = HgPath::new(""); |
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 &mut dmap.root, |
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, |
63 ); |
63 ); |
64 Ok((common.outcome.into_inner().unwrap(), warnings)) |
64 Ok((common.outcome.into_inner().unwrap(), warnings)) |
91 } |
91 } |
92 |
92 |
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 mut ChildNodes, |
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, |
100 ) { |
100 ) { |
101 let mut fs_entries = if let Ok(entries) = self.read_dir( |
101 let mut fs_entries = if let Ok(entries) = self.read_dir( |
149 |
149 |
150 fn traverse_fs_and_dirstate( |
150 fn traverse_fs_and_dirstate( |
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 mut Node, |
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(); |
158 let file_or_symlink = file_type.is_file() || file_type.is_symlink(); |
158 let file_or_symlink = file_type.is_file() || file_type.is_symlink(); |
159 if !file_or_symlink { |
159 if !file_or_symlink { |
171 } |
171 } |
172 let is_ignored = has_ignored_ancestor || (self.ignore_fn)(hg_path); |
172 let is_ignored = has_ignored_ancestor || (self.ignore_fn)(hg_path); |
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 &mut dirstate_node.children, |
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, |
180 ); |
180 ); |
181 } else { |
181 } else { |
218 full_path, |
218 full_path, |
219 ) |
219 ) |
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 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, |
227 ) |
227 ) |
228 } |
228 } |
276 |
276 |
277 /// A node in the dirstate tree has no corresponding filesystem entry |
277 /// A node in the dirstate tree has no corresponding filesystem entry |
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 mut Node, |
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_mut().for_each( |
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(), |
288 child_node, |
288 child_node, |
289 ) |
289 ) |