##// END OF EJS Templates
rust-dirstate: add support for nevermatcher...
Raphaël Gomès -
r50247:97dcd690 default
parent child Browse files
Show More
@@ -1248,6 +1248,7 b' class dirstate:'
1248 matchmod.exactmatcher,
1248 matchmod.exactmatcher,
1249 matchmod.includematcher,
1249 matchmod.includematcher,
1250 matchmod.intersectionmatcher,
1250 matchmod.intersectionmatcher,
1251 matchmod.nevermatcher,
1251 matchmod.unionmatcher,
1252 matchmod.unionmatcher,
1252 )
1253 )
1253
1254
@@ -134,6 +134,31 b' impl Matcher for AlwaysMatcher {'
134 }
134 }
135 }
135 }
136
136
137 /// Matches nothing.
138 #[derive(Debug)]
139 pub struct NeverMatcher;
140
141 impl Matcher for NeverMatcher {
142 fn file_set(&self) -> Option<&HashSet<HgPathBuf>> {
143 None
144 }
145 fn exact_match(&self, _filename: &HgPath) -> bool {
146 false
147 }
148 fn matches(&self, _filename: &HgPath) -> bool {
149 false
150 }
151 fn visit_children_set(&self, _directory: &HgPath) -> VisitChildrenSet {
152 VisitChildrenSet::Empty
153 }
154 fn matches_everything(&self) -> bool {
155 false
156 }
157 fn is_exact(&self) -> bool {
158 true
159 }
160 }
161
137 /// Matches the input files exactly. They are interpreted as paths, not
162 /// Matches the input files exactly. They are interpreted as paths, not
138 /// patterns.
163 /// patterns.
139 ///
164 ///
@@ -15,7 +15,7 b' use cpython::{'
15 PyResult, PyTuple, Python, PythonObject, ToPyObject,
15 PyResult, PyTuple, Python, PythonObject, ToPyObject,
16 };
16 };
17 use hg::dirstate::status::StatusPath;
17 use hg::dirstate::status::StatusPath;
18 use hg::matchers::{Matcher, UnionMatcher, IntersectionMatcher};
18 use hg::matchers::{IntersectionMatcher, Matcher, NeverMatcher, UnionMatcher};
19 use hg::{
19 use hg::{
20 matchers::{AlwaysMatcher, FileMatcher, IncludeMatcher},
20 matchers::{AlwaysMatcher, FileMatcher, IncludeMatcher},
21 parse_pattern_syntax,
21 parse_pattern_syntax,
@@ -158,6 +158,7 b' fn extract_matcher('
158 ) -> PyResult<Box<dyn Matcher + Sync>> {
158 ) -> PyResult<Box<dyn Matcher + Sync>> {
159 match matcher.get_type(py).name(py).borrow() {
159 match matcher.get_type(py).name(py).borrow() {
160 "alwaysmatcher" => Ok(Box::new(AlwaysMatcher)),
160 "alwaysmatcher" => Ok(Box::new(AlwaysMatcher)),
161 "nevermatcher" => Ok(Box::new(NeverMatcher)),
161 "exactmatcher" => {
162 "exactmatcher" => {
162 let files = matcher.call_method(
163 let files = matcher.call_method(
163 py,
164 py,
General Comments 0
You need to be logged in to leave comments. Login now