Mercurial > public > mercurial-scm > hg-stable
diff rust/hg-core/src/lib.rs @ 44529:52d40f8fb82d
rust-matchers: add function to generate a regex matcher function
This function will be used to help build the upcoming `IncludeMatcher`. While
Re2 is still used and behind a feature flag, this function returns an error
meant for fallback in the default case.
Differential Revision: https://phab.mercurial-scm.org/D7922
author | Rapha?l Gom?s <rgomes@octobus.net> |
---|---|
date | Fri, 17 Jan 2020 11:29:33 +0100 |
parents | d8d4fa9a7f18 |
children | 483fce658e43 |
line wrap: on
line diff
--- a/rust/hg-core/src/lib.rs Tue Mar 10 16:04:30 2020 +0100 +++ b/rust/hg-core/src/lib.rs Fri Jan 17 11:29:33 2020 +0100 @@ -126,6 +126,9 @@ /// Needed a pattern that can be turned into a regex but got one that /// can't. This should only happen through programmer error. NonRegexPattern(IgnorePattern), + /// This is temporary, see `re2/mod.rs`. + /// This will cause a fallback to Python. + Re2NotInstalled, } impl ToString for PatternError { @@ -148,6 +151,10 @@ PatternError::NonRegexPattern(pattern) => { format!("'{:?}' cannot be turned into a regex", pattern) } + PatternError::Re2NotInstalled => { + "Re2 is not installed, cannot use regex functionality." + .to_string() + } } } }