Mercurial > public > mercurial-scm > hg-stable
diff rust/rhg/src/error.rs @ 46744:3d692e724d06
rhg: Align config file parse error formatting with Python
Differences can cause tests to fail
Differential Revision: https://phab.mercurial-scm.org/D10110
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Wed, 03 Mar 2021 19:47:48 +0100 |
parents | 33f2d56acc73 |
children | 12d59eec7f1d |
line wrap: on
line diff
--- a/rust/rhg/src/error.rs Wed Mar 03 19:08:27 2021 +0100 +++ b/rust/rhg/src/error.rs Wed Mar 03 19:47:48 2021 +0100 @@ -87,7 +87,7 @@ let NoRepoInCwdError { cwd } = error; CommandError::Abort { message: format_bytes!( - b"no repository found in '{}' (.hg not found)!", + b"abort: no repository found in '{}' (.hg not found)!", get_bytes_from_path(cwd) ), } @@ -108,19 +108,19 @@ let ConfigParseError { origin, line, - bytes, + message, } = error; let line_message = if let Some(line_number) = line { - format_bytes!(b" at line {}", line_number.to_string().into_bytes()) + format_bytes!(b":{}", line_number.to_string().into_bytes()) } else { Vec::new() }; CommandError::Abort { message: format_bytes!( - b"config parse error in {}{}: '{}'", + b"config error at {}{}: {}", origin, line_message, - bytes + message ), } } @@ -130,11 +130,11 @@ fn from((err, rev): (RevlogError, &str)) -> CommandError { match err { RevlogError::InvalidRevision => CommandError::abort(format!( - "invalid revision identifier {}", + "abort: invalid revision identifier: {}", rev )), RevlogError::AmbiguousPrefix => CommandError::abort(format!( - "ambiguous revision identifier {}", + "abort: ambiguous revision identifier: {}", rev )), RevlogError::Other(error) => error.into(),