Mercurial > hg
changeset 51568:2a89d2f6336f stable
match: rename RootFiles to RootFilesIn for more consistency
author | Arseniy Alekseyev <aalekseyev@janestreet.com> |
---|---|
date | Fri, 12 Apr 2024 14:21:14 +0100 |
parents | cae0be933434 |
children | b32c3146ec34 |
files | rust/hg-core/src/filepatterns.rs rust/hg-core/src/matchers.rs |
diffstat | 2 files changed, 16 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/rust/hg-core/src/filepatterns.rs Fri Apr 12 14:17:10 2024 +0100 +++ b/rust/hg-core/src/filepatterns.rs Fri Apr 12 14:21:14 2024 +0100 @@ -57,7 +57,7 @@ RelRegexp, /// A path relative to repository root, which is matched non-recursively /// (will not match subdirectories) - RootFiles, + RootFilesIn, /// A file of patterns to read and include Include, /// A file of patterns to match against files under the same directory @@ -158,7 +158,7 @@ b"path:" => Ok(PatternSyntax::Path), b"filepath:" => Ok(PatternSyntax::FilePath), b"relpath:" => Ok(PatternSyntax::RelPath), - b"rootfilesin:" => Ok(PatternSyntax::RootFiles), + b"rootfilesin:" => Ok(PatternSyntax::RootFilesIn), b"relglob:" => Ok(PatternSyntax::RelGlob), b"relre:" => Ok(PatternSyntax::RelRegexp), b"glob:" => Ok(PatternSyntax::Glob), @@ -227,7 +227,7 @@ } [escape_pattern(pattern).as_slice(), b"(?:/|$)"].concat() } - PatternSyntax::RootFiles => { + PatternSyntax::RootFilesIn => { let mut res = if pattern == b"." { vec![] } else { @@ -316,7 +316,7 @@ | PatternSyntax::Path | PatternSyntax::RelGlob | PatternSyntax::RelPath - | PatternSyntax::RootFiles => normalize_path_bytes(pattern), + | PatternSyntax::RootFilesIn => normalize_path_bytes(pattern), PatternSyntax::Include | PatternSyntax::SubInclude => { return Err(PatternError::NonRegexPattern(entry.clone())) } @@ -342,7 +342,7 @@ m.insert(b"path:".as_ref(), PatternSyntax::Path); m.insert(b"filepath:".as_ref(), PatternSyntax::FilePath); m.insert(b"relpath:".as_ref(), PatternSyntax::RelPath); - m.insert(b"rootfilesin:".as_ref(), PatternSyntax::RootFiles); + m.insert(b"rootfilesin:".as_ref(), PatternSyntax::RootFilesIn); m.insert(b"relglob:".as_ref(), PatternSyntax::RelGlob); m.insert(b"relre:".as_ref(), PatternSyntax::RelRegexp); m.insert(b"glob:".as_ref(), PatternSyntax::Glob); @@ -385,7 +385,7 @@ | PatternSyntax::Glob | PatternSyntax::RelGlob | PatternSyntax::RelPath - | PatternSyntax::RootFiles + | PatternSyntax::RootFilesIn if normalize => { normalize_path_bytes(pattern_bytes)
--- a/rust/hg-core/src/matchers.rs Fri Apr 12 14:17:10 2024 +0100 +++ b/rust/hg-core/src/matchers.rs Fri Apr 12 14:21:14 2024 +0100 @@ -395,7 +395,7 @@ /// assert_eq!(matcher.matches(HgPath::new(b"but not this")), false); /// /// /// let ignore_patterns = -/// vec![IgnorePattern::new(PatternSyntax::RootFiles, b"dir/subdir", Path::new(""))]; +/// vec![IgnorePattern::new(PatternSyntax::RootFilesIn, b"dir/subdir", Path::new(""))]; /// let matcher = IncludeMatcher::new(ignore_patterns).unwrap(); /// /// /// assert!(!matcher.matches(HgPath::new(b"file"))); @@ -866,7 +866,7 @@ }); roots.push(pat.to_owned()); } - PatternSyntax::RootFiles => { + PatternSyntax::RootFilesIn => { let pat = if pattern == b"." { &[] as &[u8] } else { @@ -963,7 +963,7 @@ // with a regex. if ignore_patterns .iter() - .all(|k| k.syntax == PatternSyntax::RootFiles) + .all(|k| k.syntax == PatternSyntax::RootFilesIn) { let dirs: HashSet<_> = ignore_patterns .iter() @@ -1324,7 +1324,7 @@ // VisitdirRootfilesin let m = PatternMatcher::new(vec![IgnorePattern::new( - PatternSyntax::RootFiles, + PatternSyntax::RootFilesIn, b"dir/subdir", Path::new(""), )]) @@ -1353,7 +1353,7 @@ // VisitchildrensetRootfilesin let m = PatternMatcher::new(vec![IgnorePattern::new( - PatternSyntax::RootFiles, + PatternSyntax::RootFilesIn, b"dir/subdir", Path::new(""), )]) @@ -1537,7 +1537,7 @@ // VisitchildrensetRootfilesin let matcher = IncludeMatcher::new(vec![IgnorePattern::new( - PatternSyntax::RootFiles, + PatternSyntax::RootFilesIn, b"dir/subdir", Path::new(""), )]) @@ -1672,7 +1672,7 @@ )]) .unwrap(); let m2 = IncludeMatcher::new(vec![IgnorePattern::new( - PatternSyntax::RootFiles, + PatternSyntax::RootFilesIn, b"dir", Path::new(""), )]) @@ -1833,7 +1833,7 @@ ); let m2 = Box::new( IncludeMatcher::new(vec![IgnorePattern::new( - PatternSyntax::RootFiles, + PatternSyntax::RootFilesIn, b"dir", Path::new(""), )]) @@ -2084,7 +2084,7 @@ ); let m2 = Box::new( IncludeMatcher::new(vec![IgnorePattern::new( - PatternSyntax::RootFiles, + PatternSyntax::RootFilesIn, b"dir", Path::new("/repo"), )]) @@ -2342,7 +2342,7 @@ ]; let file_abcdfile = FileMatcher::new(files).unwrap(); let _rootfilesin_dir = PatternMatcher::new(vec![IgnorePattern::new( - PatternSyntax::RootFiles, + PatternSyntax::RootFilesIn, b"dir", Path::new(""), )])