comparison rust/hg-core/src/sparse.rs @ 52963:42f78c859dd1

branching: merge with stable
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 18 Feb 2025 22:49:43 +0100
parents 94e2547e6f3d 77b95a4abbb2
children
comparison
equal deleted inserted replaced
52958:6a8a1792aab7 52963:42f78c859dd1
87 /// Narrow config does not support '%include' directives 87 /// Narrow config does not support '%include' directives
88 IncludesInNarrow, 88 IncludesInNarrow,
89 /// An invalid pattern prefix was given to the narrow spec. Includes the 89 /// An invalid pattern prefix was given to the narrow spec. Includes the
90 /// entire pattern for context. 90 /// entire pattern for context.
91 InvalidNarrowPrefix(Vec<u8>), 91 InvalidNarrowPrefix(Vec<u8>),
92 /// Narrow/sparse patterns can not begin or end in whitespace
93 /// because the Python parser strips the whitespace when parsing
94 /// the config file.
95 WhitespaceAtEdgeOfPattern(Vec<u8>),
92 #[from] 96 #[from]
93 HgError(HgError), 97 HgError(HgError),
94 #[from] 98 #[from]
95 PatternError(PatternError), 99 PatternError(PatternError),
96 } 100 }
136 hint: Some(format!( 140 hint: Some(format!(
137 "narrow patterns must begin with one of the following: {}", 141 "narrow patterns must begin with one of the following: {}",
138 VALID_PREFIXES.join(", ") 142 VALID_PREFIXES.join(", ")
139 )), 143 )),
140 }, 144 },
145 SparseConfigError::WhitespaceAtEdgeOfPattern(vec) => {
146 HgError::Abort {
147 message: String::from_utf8_lossy(&format_bytes!(
148 b"narrow pattern with whitespace at the edge: {}",
149 vec
150 ))
151 .to_string(),
152 detailed_exit_code: STATE_ERROR,
153 hint: Some(
154 "narrow patterns can't begin or end in whitespace"
155 .to_string(),
156 ),
157 }
158 }
141 SparseConfigError::HgError(hg_error) => hg_error, 159 SparseConfigError::HgError(hg_error) => hg_error,
142 SparseConfigError::PatternError(pattern_error) => HgError::Abort { 160 SparseConfigError::PatternError(pattern_error) => HgError::Abort {
143 message: pattern_error.to_string(), 161 message: pattern_error.to_string(),
144 detailed_exit_code: STATE_ERROR, 162 detailed_exit_code: STATE_ERROR,
145 hint: None, 163 hint: None,