Show More
@@ -6,6 +6,7 b' use crate::matchers::get_ignore_function' | |||
|
6 | 6 | use crate::matchers::Matcher; |
|
7 | 7 | use crate::utils::files::get_bytes_from_os_string; |
|
8 | 8 | use crate::utils::hg_path::HgPath; |
|
9 | use crate::BadMatch; | |
|
9 | 10 | use crate::DirstateStatus; |
|
10 | 11 | use crate::EntryState; |
|
11 | 12 | use crate::HgPathBuf; |
@@ -69,17 +70,37 b" struct StatusCommon<'tree, 'a> {" | |||
|
69 | 70 | } |
|
70 | 71 | |
|
71 | 72 | impl<'tree, 'a> StatusCommon<'tree, 'a> { |
|
73 | fn read_dir( | |
|
74 | &mut self, | |
|
75 | hg_path: &HgPath, | |
|
76 | fs_path: &Path, | |
|
77 | is_at_repo_root: bool, | |
|
78 | ) -> Result<Vec<DirEntry>, ()> { | |
|
79 | DirEntry::read_dir(fs_path, is_at_repo_root).map_err(|error| { | |
|
80 | let errno = error.raw_os_error().expect("expected real OS error"); | |
|
81 | self.outcome | |
|
82 | .bad | |
|
83 | .push((hg_path.to_owned().into(), BadMatch::OsError(errno))) | |
|
84 | }) | |
|
85 | } | |
|
86 | ||
|
72 | 87 | fn traverse_fs_directory_and_dirstate( |
|
73 | 88 | &mut self, |
|
74 | 89 | has_ignored_ancestor: bool, |
|
75 | 90 | dirstate_nodes: &'tree mut ChildNodes, |
|
76 | directory_hg_path: &HgPath, | |
|
77 | fs_path: &Path, | |
|
91 | directory_hg_path: &'tree HgPath, | |
|
92 | directory_fs_path: &Path, | |
|
78 | 93 | is_at_repo_root: bool, |
|
79 | 94 | ) { |
|
80 | // TODO: handle I/O errors | |
|
81 | let mut fs_entries = | |
|
82 | DirEntry::read_dir(fs_path, is_at_repo_root).unwrap(); | |
|
95 | let mut fs_entries = if let Ok(entries) = self.read_dir( | |
|
96 | directory_hg_path, | |
|
97 | directory_fs_path, | |
|
98 | is_at_repo_root, | |
|
99 | ) { | |
|
100 | entries | |
|
101 | } else { | |
|
102 | return; | |
|
103 | }; | |
|
83 | 104 | |
|
84 | 105 | // `merge_join_by` requires both its input iterators to be sorted: |
|
85 | 106 | |
@@ -295,16 +316,18 b" impl<'tree, 'a> StatusCommon<'tree, 'a> " | |||
|
295 | 316 | }; |
|
296 | 317 | if traverse_children { |
|
297 | 318 | let is_at_repo_root = false; |
|
298 | // TODO: handle I/O errors | |
|
299 | let children_fs_entries = | |
|
300 |
|
|
|
301 |
|
|
|
302 | for child_fs_entry in children_fs_entries { | |
|
303 | self.traverse_fs_only( | |
|
304 |
|
|
|
305 |
|
|
|
306 |
& |
|
|
307 |
|
|
|
319 | if let Ok(children_fs_entries) = self.read_dir( | |
|
320 | &hg_path, | |
|
321 | &fs_entry.full_path, | |
|
322 | is_at_repo_root, | |
|
323 | ) { | |
|
324 | for child_fs_entry in children_fs_entries { | |
|
325 | self.traverse_fs_only( | |
|
326 | is_ignored, | |
|
327 | &hg_path, | |
|
328 | &child_fs_entry, | |
|
329 | ) | |
|
330 | } | |
|
308 | 331 | } |
|
309 | 332 | } |
|
310 | 333 | if self.options.collect_traversed_dirs { |
General Comments 0
You need to be logged in to leave comments.
Login now