Mercurial > public > mercurial-scm > hg
diff 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 |
line wrap: on
line diff
--- a/rust/hg-core/src/sparse.rs Tue Feb 18 16:57:50 2025 +0100 +++ b/rust/hg-core/src/sparse.rs Tue Feb 18 22:49:43 2025 +0100 @@ -89,6 +89,10 @@ /// An invalid pattern prefix was given to the narrow spec. Includes the /// entire pattern for context. InvalidNarrowPrefix(Vec<u8>), + /// Narrow/sparse patterns can not begin or end in whitespace + /// because the Python parser strips the whitespace when parsing + /// the config file. + WhitespaceAtEdgeOfPattern(Vec<u8>), #[from] HgError(HgError), #[from] @@ -138,6 +142,20 @@ VALID_PREFIXES.join(", ") )), }, + SparseConfigError::WhitespaceAtEdgeOfPattern(vec) => { + HgError::Abort { + message: String::from_utf8_lossy(&format_bytes!( + b"narrow pattern with whitespace at the edge: {}", + vec + )) + .to_string(), + detailed_exit_code: STATE_ERROR, + hint: Some( + "narrow patterns can't begin or end in whitespace" + .to_string(), + ), + } + } SparseConfigError::HgError(hg_error) => hg_error, SparseConfigError::PatternError(pattern_error) => HgError::Abort { message: pattern_error.to_string(),