Show More
@@ -57,7 +57,7 b' pub enum PatternSyntax {' | |||||
57 | RelRegexp, |
|
57 | RelRegexp, | |
58 | /// A path relative to repository root, which is matched non-recursively |
|
58 | /// A path relative to repository root, which is matched non-recursively | |
59 | /// (will not match subdirectories) |
|
59 | /// (will not match subdirectories) | |
60 | RootFiles, |
|
60 | RootFilesIn, | |
61 | /// A file of patterns to read and include |
|
61 | /// A file of patterns to read and include | |
62 | Include, |
|
62 | Include, | |
63 | /// A file of patterns to match against files under the same directory |
|
63 | /// A file of patterns to match against files under the same directory | |
@@ -158,7 +158,7 b' pub fn parse_pattern_syntax(' | |||||
158 | b"path:" => Ok(PatternSyntax::Path), |
|
158 | b"path:" => Ok(PatternSyntax::Path), | |
159 | b"filepath:" => Ok(PatternSyntax::FilePath), |
|
159 | b"filepath:" => Ok(PatternSyntax::FilePath), | |
160 | b"relpath:" => Ok(PatternSyntax::RelPath), |
|
160 | b"relpath:" => Ok(PatternSyntax::RelPath), | |
161 | b"rootfilesin:" => Ok(PatternSyntax::RootFiles), |
|
161 | b"rootfilesin:" => Ok(PatternSyntax::RootFilesIn), | |
162 | b"relglob:" => Ok(PatternSyntax::RelGlob), |
|
162 | b"relglob:" => Ok(PatternSyntax::RelGlob), | |
163 | b"relre:" => Ok(PatternSyntax::RelRegexp), |
|
163 | b"relre:" => Ok(PatternSyntax::RelRegexp), | |
164 | b"glob:" => Ok(PatternSyntax::Glob), |
|
164 | b"glob:" => Ok(PatternSyntax::Glob), | |
@@ -227,7 +227,7 b' fn _build_single_regex(entry: &IgnorePat' | |||||
227 | } |
|
227 | } | |
228 | [escape_pattern(pattern).as_slice(), b"(?:/|$)"].concat() |
|
228 | [escape_pattern(pattern).as_slice(), b"(?:/|$)"].concat() | |
229 | } |
|
229 | } | |
230 | PatternSyntax::RootFiles => { |
|
230 | PatternSyntax::RootFilesIn => { | |
231 | let mut res = if pattern == b"." { |
|
231 | let mut res = if pattern == b"." { | |
232 | vec![] |
|
232 | vec![] | |
233 | } else { |
|
233 | } else { | |
@@ -316,7 +316,7 b' pub fn build_single_regex(' | |||||
316 | | PatternSyntax::Path |
|
316 | | PatternSyntax::Path | |
317 | | PatternSyntax::RelGlob |
|
317 | | PatternSyntax::RelGlob | |
318 | | PatternSyntax::RelPath |
|
318 | | PatternSyntax::RelPath | |
319 | | PatternSyntax::RootFiles => normalize_path_bytes(pattern), |
|
319 | | PatternSyntax::RootFilesIn => normalize_path_bytes(pattern), | |
320 | PatternSyntax::Include | PatternSyntax::SubInclude => { |
|
320 | PatternSyntax::Include | PatternSyntax::SubInclude => { | |
321 | return Err(PatternError::NonRegexPattern(entry.clone())) |
|
321 | return Err(PatternError::NonRegexPattern(entry.clone())) | |
322 | } |
|
322 | } | |
@@ -342,7 +342,7 b' lazy_static! {' | |||||
342 | m.insert(b"path:".as_ref(), PatternSyntax::Path); |
|
342 | m.insert(b"path:".as_ref(), PatternSyntax::Path); | |
343 | m.insert(b"filepath:".as_ref(), PatternSyntax::FilePath); |
|
343 | m.insert(b"filepath:".as_ref(), PatternSyntax::FilePath); | |
344 | m.insert(b"relpath:".as_ref(), PatternSyntax::RelPath); |
|
344 | m.insert(b"relpath:".as_ref(), PatternSyntax::RelPath); | |
345 | m.insert(b"rootfilesin:".as_ref(), PatternSyntax::RootFiles); |
|
345 | m.insert(b"rootfilesin:".as_ref(), PatternSyntax::RootFilesIn); | |
346 | m.insert(b"relglob:".as_ref(), PatternSyntax::RelGlob); |
|
346 | m.insert(b"relglob:".as_ref(), PatternSyntax::RelGlob); | |
347 | m.insert(b"relre:".as_ref(), PatternSyntax::RelRegexp); |
|
347 | m.insert(b"relre:".as_ref(), PatternSyntax::RelRegexp); | |
348 | m.insert(b"glob:".as_ref(), PatternSyntax::Glob); |
|
348 | m.insert(b"glob:".as_ref(), PatternSyntax::Glob); | |
@@ -385,7 +385,7 b' pub fn parse_one_pattern(' | |||||
385 | | PatternSyntax::Glob |
|
385 | | PatternSyntax::Glob | |
386 | | PatternSyntax::RelGlob |
|
386 | | PatternSyntax::RelGlob | |
387 | | PatternSyntax::RelPath |
|
387 | | PatternSyntax::RelPath | |
388 | | PatternSyntax::RootFiles |
|
388 | | PatternSyntax::RootFilesIn | |
389 | if normalize => |
|
389 | if normalize => | |
390 | { |
|
390 | { | |
391 | normalize_path_bytes(pattern_bytes) |
|
391 | normalize_path_bytes(pattern_bytes) |
@@ -395,7 +395,7 b" impl<'a> Matcher for PatternMatcher<'a> " | |||||
395 | /// assert_eq!(matcher.matches(HgPath::new(b"but not this")), false); |
|
395 | /// assert_eq!(matcher.matches(HgPath::new(b"but not this")), false); | |
396 | /// /// |
|
396 | /// /// | |
397 | /// let ignore_patterns = |
|
397 | /// let ignore_patterns = | |
398 | /// vec![IgnorePattern::new(PatternSyntax::RootFiles, b"dir/subdir", Path::new(""))]; |
|
398 | /// vec![IgnorePattern::new(PatternSyntax::RootFilesIn, b"dir/subdir", Path::new(""))]; | |
399 | /// let matcher = IncludeMatcher::new(ignore_patterns).unwrap(); |
|
399 | /// let matcher = IncludeMatcher::new(ignore_patterns).unwrap(); | |
400 | /// /// |
|
400 | /// /// | |
401 | /// assert!(!matcher.matches(HgPath::new(b"file"))); |
|
401 | /// assert!(!matcher.matches(HgPath::new(b"file"))); | |
@@ -866,7 +866,7 b' fn roots_and_dirs(' | |||||
866 | }); |
|
866 | }); | |
867 | roots.push(pat.to_owned()); |
|
867 | roots.push(pat.to_owned()); | |
868 | } |
|
868 | } | |
869 | PatternSyntax::RootFiles => { |
|
869 | PatternSyntax::RootFilesIn => { | |
870 | let pat = if pattern == b"." { |
|
870 | let pat = if pattern == b"." { | |
871 | &[] as &[u8] |
|
871 | &[] as &[u8] | |
872 | } else { |
|
872 | } else { | |
@@ -963,7 +963,7 b" fn build_match<'a>(" | |||||
963 | // with a regex. |
|
963 | // with a regex. | |
964 | if ignore_patterns |
|
964 | if ignore_patterns | |
965 | .iter() |
|
965 | .iter() | |
966 | .all(|k| k.syntax == PatternSyntax::RootFiles) |
|
966 | .all(|k| k.syntax == PatternSyntax::RootFilesIn) | |
967 | { |
|
967 | { | |
968 | let dirs: HashSet<_> = ignore_patterns |
|
968 | let dirs: HashSet<_> = ignore_patterns | |
969 | .iter() |
|
969 | .iter() | |
@@ -1324,7 +1324,7 b' mod tests {' | |||||
1324 |
|
1324 | |||
1325 | // VisitdirRootfilesin |
|
1325 | // VisitdirRootfilesin | |
1326 | let m = PatternMatcher::new(vec![IgnorePattern::new( |
|
1326 | let m = PatternMatcher::new(vec![IgnorePattern::new( | |
1327 | PatternSyntax::RootFiles, |
|
1327 | PatternSyntax::RootFilesIn, | |
1328 | b"dir/subdir", |
|
1328 | b"dir/subdir", | |
1329 | Path::new(""), |
|
1329 | Path::new(""), | |
1330 | )]) |
|
1330 | )]) | |
@@ -1353,7 +1353,7 b' mod tests {' | |||||
1353 |
|
1353 | |||
1354 | // VisitchildrensetRootfilesin |
|
1354 | // VisitchildrensetRootfilesin | |
1355 | let m = PatternMatcher::new(vec![IgnorePattern::new( |
|
1355 | let m = PatternMatcher::new(vec![IgnorePattern::new( | |
1356 | PatternSyntax::RootFiles, |
|
1356 | PatternSyntax::RootFilesIn, | |
1357 | b"dir/subdir", |
|
1357 | b"dir/subdir", | |
1358 | Path::new(""), |
|
1358 | Path::new(""), | |
1359 | )]) |
|
1359 | )]) | |
@@ -1537,7 +1537,7 b' mod tests {' | |||||
1537 |
|
1537 | |||
1538 | // VisitchildrensetRootfilesin |
|
1538 | // VisitchildrensetRootfilesin | |
1539 | let matcher = IncludeMatcher::new(vec![IgnorePattern::new( |
|
1539 | let matcher = IncludeMatcher::new(vec![IgnorePattern::new( | |
1540 | PatternSyntax::RootFiles, |
|
1540 | PatternSyntax::RootFilesIn, | |
1541 | b"dir/subdir", |
|
1541 | b"dir/subdir", | |
1542 | Path::new(""), |
|
1542 | Path::new(""), | |
1543 | )]) |
|
1543 | )]) | |
@@ -1672,7 +1672,7 b' mod tests {' | |||||
1672 | )]) |
|
1672 | )]) | |
1673 | .unwrap(); |
|
1673 | .unwrap(); | |
1674 | let m2 = IncludeMatcher::new(vec![IgnorePattern::new( |
|
1674 | let m2 = IncludeMatcher::new(vec![IgnorePattern::new( | |
1675 | PatternSyntax::RootFiles, |
|
1675 | PatternSyntax::RootFilesIn, | |
1676 | b"dir", |
|
1676 | b"dir", | |
1677 | Path::new(""), |
|
1677 | Path::new(""), | |
1678 | )]) |
|
1678 | )]) | |
@@ -1833,7 +1833,7 b' mod tests {' | |||||
1833 | ); |
|
1833 | ); | |
1834 | let m2 = Box::new( |
|
1834 | let m2 = Box::new( | |
1835 | IncludeMatcher::new(vec![IgnorePattern::new( |
|
1835 | IncludeMatcher::new(vec![IgnorePattern::new( | |
1836 | PatternSyntax::RootFiles, |
|
1836 | PatternSyntax::RootFilesIn, | |
1837 | b"dir", |
|
1837 | b"dir", | |
1838 | Path::new(""), |
|
1838 | Path::new(""), | |
1839 | )]) |
|
1839 | )]) | |
@@ -2084,7 +2084,7 b' mod tests {' | |||||
2084 | ); |
|
2084 | ); | |
2085 | let m2 = Box::new( |
|
2085 | let m2 = Box::new( | |
2086 | IncludeMatcher::new(vec![IgnorePattern::new( |
|
2086 | IncludeMatcher::new(vec![IgnorePattern::new( | |
2087 | PatternSyntax::RootFiles, |
|
2087 | PatternSyntax::RootFilesIn, | |
2088 | b"dir", |
|
2088 | b"dir", | |
2089 | Path::new("/repo"), |
|
2089 | Path::new("/repo"), | |
2090 | )]) |
|
2090 | )]) | |
@@ -2342,7 +2342,7 b' mod tests {' | |||||
2342 | ]; |
|
2342 | ]; | |
2343 | let file_abcdfile = FileMatcher::new(files).unwrap(); |
|
2343 | let file_abcdfile = FileMatcher::new(files).unwrap(); | |
2344 | let _rootfilesin_dir = PatternMatcher::new(vec![IgnorePattern::new( |
|
2344 | let _rootfilesin_dir = PatternMatcher::new(vec![IgnorePattern::new( | |
2345 | PatternSyntax::RootFiles, |
|
2345 | PatternSyntax::RootFilesIn, | |
2346 | b"dir", |
|
2346 | b"dir", | |
2347 | Path::new(""), |
|
2347 | Path::new(""), | |
2348 | )]) |
|
2348 | )]) |
General Comments 0
You need to be logged in to leave comments.
Login now