comparison 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
comparison
equal deleted inserted replaced
44303:d42eea9a0494 44304:2fe89bec8011
119 Path(HgPathError), 119 Path(HgPathError),
120 UnsupportedSyntax(String), 120 UnsupportedSyntax(String),
121 UnsupportedSyntaxInFile(String, String, usize), 121 UnsupportedSyntaxInFile(String, String, usize),
122 TooLong(usize), 122 TooLong(usize),
123 IO(std::io::Error), 123 IO(std::io::Error),
124 /// Needed a pattern that can be turned into a regex but got one that
125 /// can't. This should only happen through programmer error.
126 NonRegexPattern(IgnorePattern),
124 } 127 }
125 128
126 impl ToString for PatternError { 129 impl ToString for PatternError {
127 fn to_string(&self) -> String { 130 fn to_string(&self) -> String {
128 match self { 131 match self {
138 PatternError::TooLong(size) => { 141 PatternError::TooLong(size) => {
139 format!("matcher pattern is too long ({} bytes)", size) 142 format!("matcher pattern is too long ({} bytes)", size)
140 } 143 }
141 PatternError::IO(e) => e.to_string(), 144 PatternError::IO(e) => e.to_string(),
142 PatternError::Path(e) => e.to_string(), 145 PatternError::Path(e) => e.to_string(),
146 PatternError::NonRegexPattern(pattern) => {
147 format!("'{:?}' cannot be turned into a regex", pattern)
148 }
143 } 149 }
144 } 150 }
145 } 151 }
146 152
147 impl From<DirstateMapError> for DirstateError { 153 impl From<DirstateMapError> for DirstateError {