Show More
@@ -150,21 +150,21 b' fn escape_pattern(pattern: &[u8]) -> Vec' | |||
|
150 | 150 | .collect() |
|
151 | 151 | } |
|
152 | 152 | |
|
153 | pub fn parse_pattern_syntax( | |
|
153 | pub fn parse_pattern_syntax_kind( | |
|
154 | 154 | kind: &[u8], |
|
155 | 155 | ) -> Result<PatternSyntax, PatternError> { |
|
156 | 156 | match kind { |
|
157 |
b"re |
|
|
158 |
b"path |
|
|
159 |
b"filepath |
|
|
160 |
b"relpath |
|
|
161 |
b"rootfilesin |
|
|
162 |
b"relglob |
|
|
163 |
b"relre |
|
|
164 |
b"glob |
|
|
165 |
b"rootglob |
|
|
166 |
b"include |
|
|
167 |
b"subinclude |
|
|
157 | b"re" => Ok(PatternSyntax::Regexp), | |
|
158 | b"path" => Ok(PatternSyntax::Path), | |
|
159 | b"filepath" => Ok(PatternSyntax::FilePath), | |
|
160 | b"relpath" => Ok(PatternSyntax::RelPath), | |
|
161 | b"rootfilesin" => Ok(PatternSyntax::RootFilesIn), | |
|
162 | b"relglob" => Ok(PatternSyntax::RelGlob), | |
|
163 | b"relre" => Ok(PatternSyntax::RelRegexp), | |
|
164 | b"glob" => Ok(PatternSyntax::Glob), | |
|
165 | b"rootglob" => Ok(PatternSyntax::RootGlob), | |
|
166 | b"include" => Ok(PatternSyntax::Include), | |
|
167 | b"subinclude" => Ok(PatternSyntax::SubInclude), | |
|
168 | 168 | _ => Err(PatternError::UnsupportedSyntax( |
|
169 | 169 | String::from_utf8_lossy(kind).to_string(), |
|
170 | 170 | )), |
@@ -41,7 +41,7 b' pub mod vfs;' | |||
|
41 | 41 | |
|
42 | 42 | use crate::utils::hg_path::{HgPathBuf, HgPathError}; |
|
43 | 43 | pub use filepatterns::{ |
|
44 | parse_pattern_syntax, read_pattern_file, IgnorePattern, | |
|
44 | parse_pattern_syntax_kind, read_pattern_file, IgnorePattern, | |
|
45 | 45 | PatternFileWarning, PatternSyntax, |
|
46 | 46 | }; |
|
47 | 47 | use std::collections::HashMap; |
@@ -21,7 +21,7 b' use hg::matchers::{' | |||
|
21 | 21 | }; |
|
22 | 22 | use hg::{ |
|
23 | 23 | matchers::{AlwaysMatcher, FileMatcher, IncludeMatcher}, |
|
24 | parse_pattern_syntax, | |
|
24 | parse_pattern_syntax_kind, | |
|
25 | 25 | utils::{ |
|
26 | 26 | files::{get_bytes_from_path, get_path_from_bytes}, |
|
27 | 27 | hg_path::{HgPath, HgPathBuf}, |
@@ -162,12 +162,8 b' fn collect_kindpats(' | |||
|
162 | 162 | .iter(py)? |
|
163 | 163 | .map(|k| { |
|
164 | 164 | let k = k?; |
|
165 | let syntax = parse_pattern_syntax( | |
|
166 | &[ | |
|
167 | k.get_item(py, 0)?.extract::<PyBytes>(py)?.data(py), | |
|
168 | &b":"[..], | |
|
169 | ] | |
|
170 | .concat(), | |
|
165 | let syntax = parse_pattern_syntax_kind( | |
|
166 | k.get_item(py, 0)?.extract::<PyBytes>(py)?.data(py), | |
|
171 | 167 | ) |
|
172 | 168 | .map_err(|e| handle_fallback(py, StatusError::Pattern(e)))?; |
|
173 | 169 | let pattern = k.get_item(py, 1)?.extract::<PyBytes>(py)?; |
General Comments 0
You need to be logged in to leave comments.
Login now