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