comparison rust/hg-core/src/sparse.rs @ 50818:28c0fcff24e5 stable

rhg: fix the bug where sparse config is interpreted as relglob instead of glob relglob apparently (in contrast with relpath) matches everywhere in the tree, whereas glob only matches at the root. The python version interprets these patterns as "glob" (see "normalize(include, b'glob', ...)" in match.py)
author Arseniy Alekseyev <aalekseyev@janestreet.com>
date Thu, 10 Aug 2023 19:00:19 +0100
parents e98fd81bb151
children 796b5d6693a4
comparison
equal deleted inserted replaced
50817:9ed281bbf864 50818:28c0fcff24e5
280 let mut m: Box<dyn Matcher + Sync> = Box::new(AlwaysMatcher); 280 let mut m: Box<dyn Matcher + Sync> = Box::new(AlwaysMatcher);
281 if !config.includes.is_empty() { 281 if !config.includes.is_empty() {
282 let (patterns, subwarnings) = parse_pattern_file_contents( 282 let (patterns, subwarnings) = parse_pattern_file_contents(
283 &config.includes, 283 &config.includes,
284 Path::new(""), 284 Path::new(""),
285 Some(b"relglob:".as_ref()), 285 Some(b"glob:".as_ref()),
286 false, 286 false,
287 )?; 287 )?;
288 warnings.extend(subwarnings.into_iter().map(From::from)); 288 warnings.extend(subwarnings.into_iter().map(From::from));
289 m = Box::new(IncludeMatcher::new(patterns)?); 289 m = Box::new(IncludeMatcher::new(patterns)?);
290 } 290 }
291 if !config.excludes.is_empty() { 291 if !config.excludes.is_empty() {
292 let (patterns, subwarnings) = parse_pattern_file_contents( 292 let (patterns, subwarnings) = parse_pattern_file_contents(
293 &config.excludes, 293 &config.excludes,
294 Path::new(""), 294 Path::new(""),
295 Some(b"relglob:".as_ref()), 295 Some(b"glob:".as_ref()),
296 false, 296 false,
297 )?; 297 )?;
298 warnings.extend(subwarnings.into_iter().map(From::from)); 298 warnings.extend(subwarnings.into_iter().map(From::from));
299 m = Box::new(DifferenceMatcher::new( 299 m = Box::new(DifferenceMatcher::new(
300 m, 300 m,