diff rust/hg-core/src/lib.rs @ 44304:2fe89bec8011

rust-filepatterns: add support for `include` and `subinclude` patterns This prepares a future patch for `IncludeMatcher` on the road to bare `hg status` support. Differential Revision: https://phab.mercurial-scm.org/D7909
author Raphaël Gomès <rgomes@octobus.net>
date Thu, 16 Jan 2020 11:27:12 +0100
parents d42eea9a0494
children d8d4fa9a7f18
line wrap: on
line diff
--- a/rust/hg-core/src/lib.rs	Thu Jan 16 10:28:40 2020 +0100
+++ b/rust/hg-core/src/lib.rs	Thu Jan 16 11:27:12 2020 +0100
@@ -121,6 +121,9 @@
     UnsupportedSyntaxInFile(String, String, usize),
     TooLong(usize),
     IO(std::io::Error),
+    /// 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),
 }
 
 impl ToString for PatternError {
@@ -140,6 +143,9 @@
             }
             PatternError::IO(e) => e.to_string(),
             PatternError::Path(e) => e.to_string(),
+            PatternError::NonRegexPattern(pattern) => {
+                format!("'{:?}' cannot be turned into a regex", pattern)
+            }
         }
     }
 }