# HG changeset patch # User Raphaël Gomès # Date 2022-06-08 16:12:55 # Node ID 0b00998e336a6c90abd5d147d4328c93c25f456f # Parent 5e53ecbc308f48361cb36f38307142a93bf4f2da rust-dirstate: add `intersectionmatcher` to the allowed matchers `IntersectionMatcher` is now implemented in Rust. diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py --- a/mercurial/dirstate.py +++ b/mercurial/dirstate.py @@ -1247,6 +1247,7 @@ class dirstate: matchmod.alwaysmatcher, matchmod.exactmatcher, matchmod.includematcher, + matchmod.intersectionmatcher, matchmod.unionmatcher, ) diff --git a/rust/hg-cpython/src/dirstate/status.rs b/rust/hg-cpython/src/dirstate/status.rs --- a/rust/hg-cpython/src/dirstate/status.rs +++ b/rust/hg-cpython/src/dirstate/status.rs @@ -15,7 +15,7 @@ use cpython::{ PyResult, PyTuple, Python, PythonObject, ToPyObject, }; use hg::dirstate::status::StatusPath; -use hg::matchers::{Matcher, UnionMatcher}; +use hg::matchers::{Matcher, UnionMatcher, IntersectionMatcher}; use hg::{ matchers::{AlwaysMatcher, FileMatcher, IncludeMatcher}, parse_pattern_syntax, @@ -226,6 +226,12 @@ fn extract_matcher( Ok(Box::new(UnionMatcher::new(matchers?))) } + "intersectionmatcher" => { + let m1 = extract_matcher(py, matcher.getattr(py, "_m1")?)?; + let m2 = extract_matcher(py, matcher.getattr(py, "_m2")?)?; + + Ok(Box::new(IntersectionMatcher::new(m1, m2))) + } e => Err(PyErr::new::( py, format!("Unsupported matcher {}", e),