# HG changeset patch # User Raphaël Gomès # Date 1654705099 -7200 # Node ID 97dcd6906e6f038a488725f5737c27d6f6e15aba # Parent 0b00998e336a6c90abd5d147d4328c93c25f456f rust-dirstate: add support for nevermatcher This is in case this ever comes up, it's very easy to support, so might as well do it. diff -r 0b00998e336a -r 97dcd6906e6f mercurial/dirstate.py --- a/mercurial/dirstate.py Wed Jun 08 18:12:55 2022 +0200 +++ b/mercurial/dirstate.py Wed Jun 08 18:18:19 2022 +0200 @@ -1248,6 +1248,7 @@ matchmod.exactmatcher, matchmod.includematcher, matchmod.intersectionmatcher, + matchmod.nevermatcher, matchmod.unionmatcher, ) diff -r 0b00998e336a -r 97dcd6906e6f rust/hg-core/src/matchers.rs --- a/rust/hg-core/src/matchers.rs Wed Jun 08 18:12:55 2022 +0200 +++ b/rust/hg-core/src/matchers.rs Wed Jun 08 18:18:19 2022 +0200 @@ -134,6 +134,31 @@ } } +/// Matches nothing. +#[derive(Debug)] +pub struct NeverMatcher; + +impl Matcher for NeverMatcher { + fn file_set(&self) -> Option<&HashSet> { + None + } + fn exact_match(&self, _filename: &HgPath) -> bool { + false + } + fn matches(&self, _filename: &HgPath) -> bool { + false + } + fn visit_children_set(&self, _directory: &HgPath) -> VisitChildrenSet { + VisitChildrenSet::Empty + } + fn matches_everything(&self) -> bool { + false + } + fn is_exact(&self) -> bool { + true + } +} + /// Matches the input files exactly. They are interpreted as paths, not /// patterns. /// diff -r 0b00998e336a -r 97dcd6906e6f rust/hg-cpython/src/dirstate/status.rs --- a/rust/hg-cpython/src/dirstate/status.rs Wed Jun 08 18:12:55 2022 +0200 +++ b/rust/hg-cpython/src/dirstate/status.rs Wed Jun 08 18:18:19 2022 +0200 @@ -15,7 +15,7 @@ PyResult, PyTuple, Python, PythonObject, ToPyObject, }; use hg::dirstate::status::StatusPath; -use hg::matchers::{Matcher, UnionMatcher, IntersectionMatcher}; +use hg::matchers::{IntersectionMatcher, Matcher, NeverMatcher, UnionMatcher}; use hg::{ matchers::{AlwaysMatcher, FileMatcher, IncludeMatcher}, parse_pattern_syntax, @@ -158,6 +158,7 @@ ) -> PyResult> { match matcher.get_type(py).name(py).borrow() { "alwaysmatcher" => Ok(Box::new(AlwaysMatcher)), + "nevermatcher" => Ok(Box::new(NeverMatcher)), "exactmatcher" => { let files = matcher.call_method( py,