Show More
@@ -11,7 +11,7 b'' | |||
|
11 | 11 | |
|
12 | 12 | use crate::{dirstate::DirstateMap, exceptions::FallbackError}; |
|
13 | 13 | use cpython::{ |
|
14 | exc::ValueError, ObjectProtocol, PyBytes, PyErr, PyList, PyObject, | |
|
14 | exc::ValueError, ObjectProtocol, PyBool, PyBytes, PyErr, PyList, PyObject, | |
|
15 | 15 | PyResult, PyTuple, Python, PythonObject, ToPyObject, |
|
16 | 16 | }; |
|
17 | 17 | use hg::dirstate::status::StatusPath; |
@@ -26,8 +26,8 b' use hg::{' | |||
|
26 | 26 | files::{get_bytes_from_path, get_path_from_bytes}, |
|
27 | 27 | hg_path::{HgPath, HgPathBuf}, |
|
28 | 28 | }, |
|
29 |
BadMatch, DirstateStatus, IgnorePattern, PatternFileWarning, |
|
|
30 | StatusOptions, | |
|
29 | BadMatch, DirstateStatus, IgnorePattern, PatternError, PatternFileWarning, | |
|
30 | StatusError, StatusOptions, | |
|
31 | 31 | }; |
|
32 | 32 | use std::borrow::Borrow; |
|
33 | 33 | |
@@ -158,6 +158,18 b' fn extract_matcher(' | |||
|
158 | 158 | py: Python, |
|
159 | 159 | matcher: PyObject, |
|
160 | 160 | ) -> PyResult<Box<dyn Matcher + Sync>> { |
|
161 | let tampered = matcher | |
|
162 | .call_method(py, "was_tampered_with", PyTuple::empty(py), None)? | |
|
163 | .extract::<PyBool>(py)? | |
|
164 | .is_true(); | |
|
165 | if tampered { | |
|
166 | return Err(handle_fallback( | |
|
167 | py, | |
|
168 | StatusError::Pattern(PatternError::UnsupportedSyntax( | |
|
169 | "Pattern matcher was tampered with!".to_string(), | |
|
170 | )), | |
|
171 | )); | |
|
172 | }; | |
|
161 | 173 | match matcher.get_type(py).name(py).borrow() { |
|
162 | 174 | "alwaysmatcher" => Ok(Box::new(AlwaysMatcher)), |
|
163 | 175 | "nevermatcher" => Ok(Box::new(NeverMatcher)), |
General Comments 0
You need to be logged in to leave comments.
Login now