Mercurial > hg
changeset 49350:0b00998e336a
rust-dirstate: add `intersectionmatcher` to the allowed matchers
`IntersectionMatcher` is now implemented in Rust.
author | Raphaël Gomès <rgomes@octobus.net> |
---|---|
date | Wed, 08 Jun 2022 18:12:55 +0200 |
parents | 5e53ecbc308f |
children | 97dcd6906e6f |
files | mercurial/dirstate.py rust/hg-cpython/src/dirstate/status.rs |
diffstat | 2 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/dirstate.py Wed Jun 08 18:09:24 2022 +0200 +++ b/mercurial/dirstate.py Wed Jun 08 18:12:55 2022 +0200 @@ -1247,6 +1247,7 @@ matchmod.alwaysmatcher, matchmod.exactmatcher, matchmod.includematcher, + matchmod.intersectionmatcher, matchmod.unionmatcher, )
--- a/rust/hg-cpython/src/dirstate/status.rs Wed Jun 08 18:09:24 2022 +0200 +++ b/rust/hg-cpython/src/dirstate/status.rs Wed Jun 08 18:12:55 2022 +0200 @@ -15,7 +15,7 @@ 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 @@ 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::<FallbackError, _>( py, format!("Unsupported matcher {}", e),