diff rust/hg-core/src/matchers.rs @ 49351:97dcd6906e6f

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.
author Rapha?l Gom?s <rgomes@octobus.net>
date Wed, 08 Jun 2022 18:18:19 +0200
parents 5e53ecbc308f
children 90512ca6a255
line wrap: on
line diff
--- 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<HgPathBuf>> {
+        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.
 ///