Show More
@@ -17,7 +17,7 b' use crate::{' | |||||
17 | PatternFileWarning, PatternResult, |
|
17 | PatternFileWarning, PatternResult, | |
18 | }, |
|
18 | }, | |
19 | utils::{ |
|
19 | utils::{ | |
20 | files::find_dirs, |
|
20 | files::{dir_ancestors, find_dirs}, | |
21 | hg_path::{HgPath, HgPathBuf, HgPathError}, |
|
21 | hg_path::{HgPath, HgPathBuf, HgPathError}, | |
22 | Escaped, |
|
22 | Escaped, | |
23 | }, |
|
23 | }, | |
@@ -354,7 +354,7 b" impl<'a> Matcher for PatternMatcher<'a> " | |||||
354 | if self.prefix && self.files.contains(directory) { |
|
354 | if self.prefix && self.files.contains(directory) { | |
355 | return VisitChildrenSet::Recursive; |
|
355 | return VisitChildrenSet::Recursive; | |
356 | } |
|
356 | } | |
357 |
let path_or_parents_in_set = |
|
357 | let path_or_parents_in_set = dir_ancestors(directory) | |
358 | .any(|parent_dir| self.files.contains(parent_dir)); |
|
358 | .any(|parent_dir| self.files.contains(parent_dir)); | |
359 | if self.dirs.contains(directory) || path_or_parents_in_set { |
|
359 | if self.dirs.contains(directory) || path_or_parents_in_set { | |
360 | VisitChildrenSet::This |
|
360 | VisitChildrenSet::This | |
@@ -2298,7 +2298,7 b' mod tests {' | |||||
2298 | #[test] |
|
2298 | #[test] | |
2299 | fn test_pattern_matcher_visit_children_set() { |
|
2299 | fn test_pattern_matcher_visit_children_set() { | |
2300 | let tree = make_example_tree(); |
|
2300 | let tree = make_example_tree(); | |
2301 |
let |
|
2301 | let pattern_dir1_glob_c = | |
2302 | PatternMatcher::new(vec![IgnorePattern::new( |
|
2302 | PatternMatcher::new(vec![IgnorePattern::new( | |
2303 | PatternSyntax::Glob, |
|
2303 | PatternSyntax::Glob, | |
2304 | b"dir1/*.c", |
|
2304 | b"dir1/*.c", | |
@@ -2327,10 +2327,6 b' mod tests {' | |||||
2327 | )]) |
|
2327 | )]) | |
2328 | .unwrap() |
|
2328 | .unwrap() | |
2329 | }; |
|
2329 | }; | |
2330 | // // TODO: re-enable this test when the corresponding bug is |
|
|||
2331 | // fixed if false { |
|
|||
2332 | // tree.check_matcher(&pattern_dir1_glob_c); |
|
|||
2333 | // } |
|
|||
2334 | let files = vec![HgPathBuf::from_bytes(b"dir/subdir/b.txt")]; |
|
2330 | let files = vec![HgPathBuf::from_bytes(b"dir/subdir/b.txt")]; | |
2335 | let file_dir_subdir_b = FileMatcher::new(files).unwrap(); |
|
2331 | let file_dir_subdir_b = FileMatcher::new(files).unwrap(); | |
2336 |
|
2332 | |||
@@ -2393,6 +2389,7 b' mod tests {' | |||||
2393 |
|
2389 | |||
2394 | tree.check_matcher(&pattern_dir1(), 25); |
|
2390 | tree.check_matcher(&pattern_dir1(), 25); | |
2395 | tree.check_matcher(&pattern_dir1_a, 1); |
|
2391 | tree.check_matcher(&pattern_dir1_a, 1); | |
|
2392 | tree.check_matcher(&pattern_dir1_glob_c, 2); | |||
2396 | tree.check_matcher(&pattern_relglob_c(), 14); |
|
2393 | tree.check_matcher(&pattern_relglob_c(), 14); | |
2397 | tree.check_matcher(&AlwaysMatcher, 112); |
|
2394 | tree.check_matcher(&AlwaysMatcher, 112); | |
2398 | tree.check_matcher(&NeverMatcher, 0); |
|
2395 | tree.check_matcher(&NeverMatcher, 0); |
@@ -120,6 +120,10 b' pub fn find_dirs(path: &HgPath) -> Ances' | |||||
120 | dirs |
|
120 | dirs | |
121 | } |
|
121 | } | |
122 |
|
122 | |||
|
123 | pub fn dir_ancestors(path: &HgPath) -> Ancestors { | |||
|
124 | Ancestors { next: Some(path) } | |||
|
125 | } | |||
|
126 | ||||
123 | /// Returns an iterator yielding ancestor directories of the given repository |
|
127 | /// Returns an iterator yielding ancestor directories of the given repository | |
124 | /// path. |
|
128 | /// path. | |
125 | /// |
|
129 | /// |
@@ -842,19 +842,19 b' Check the output' | |||||
842 | C clean |
|
842 | C clean | |
843 | C subdir/clean |
|
843 | C subdir/clean | |
844 |
|
844 | |||
|
845 | Test various matchers interatction with dirstate code: | |||
|
846 | ||||
845 | $ hg status path:subdir |
|
847 | $ hg status path:subdir | |
846 | M subdir/modified |
|
848 | M subdir/modified | |
847 | R subdir/removed |
|
849 | R subdir/removed | |
848 | ! subdir/deleted |
|
850 | ! subdir/deleted | |
849 | ? subdir/unknown |
|
851 | ? subdir/unknown | |
850 |
|
852 | |||
851 | FIXME: it's a bug in rhg that the status below is empty: |
|
|||
852 |
|
||||
853 | $ hg status 'glob:subdir/*' |
|
853 | $ hg status 'glob:subdir/*' | |
854 |
M subdir/modified |
|
854 | M subdir/modified | |
855 |
R subdir/removed |
|
855 | R subdir/removed | |
856 |
! subdir/deleted |
|
856 | ! subdir/deleted | |
857 |
? subdir/unknown |
|
857 | ? subdir/unknown | |
858 |
|
858 | |||
859 | FIXME: it's a bug (both in rhg and in Python) that the status below is wrong, |
|
859 | FIXME: it's a bug (both in rhg and in Python) that the status below is wrong, | |
860 |
in |
|
860 | in rhg it's empty, in Python it's missing the unknown file: |
General Comments 0
You need to be logged in to leave comments.
Login now