--- a/rust/rhg/src/error.rs Wed Jul 29 10:26:17 2020 +0200
+++ b/rust/rhg/src/error.rs Wed Jul 29 15:49:44 2020 +0200
@@ -1,5 +1,6 @@
use crate::exitcode;
use crate::ui::UiError;
+use hg::operations::{FindRootError, FindRootErrorKind};
use hg::utils::files::get_bytes_from_path;
use std::convert::From;
use std::path::PathBuf;
@@ -90,3 +91,16 @@
}
}
}
+
+impl From<FindRootError> for CommandError {
+ fn from(err: FindRootError) -> Self {
+ match err.kind {
+ FindRootErrorKind::RootNotFound(path) => CommandError {
+ kind: CommandErrorKind::RootNotFound(path),
+ },
+ FindRootErrorKind::GetCurrentDirError(e) => CommandError {
+ kind: CommandErrorKind::CurrentDirNotFound(e),
+ },
+ }
+ }
+}