--- a/rust/rhg/src/error.rs Mon Feb 15 20:05:32 2021 +0100
+++ b/rust/rhg/src/error.rs Mon Feb 15 20:13:09 2021 +0100
@@ -1,5 +1,6 @@
use crate::ui::utf8_to_local;
use crate::ui::UiError;
+use crate::NoRepoInCwdError;
use format_bytes::format_bytes;
use hg::config::{ConfigError, ConfigParseError};
use hg::errors::HgError;
@@ -64,7 +65,7 @@
match error {
RepoError::NotFound { at } => CommandError::Abort {
message: format_bytes!(
- b"no repository found in '{}' (.hg not found)!",
+ b"repository {} not found",
get_bytes_from_path(at)
),
},
@@ -74,6 +75,18 @@
}
}
+impl<'a> From<&'a NoRepoInCwdError> for CommandError {
+ fn from(error: &'a NoRepoInCwdError) -> Self {
+ let NoRepoInCwdError { cwd } = error;
+ CommandError::Abort {
+ message: format_bytes!(
+ b"no repository found in '{}' (.hg not found)!",
+ get_bytes_from_path(cwd)
+ ),
+ }
+ }
+}
+
impl From<ConfigError> for CommandError {
fn from(error: ConfigError) -> Self {
match error {