changeset 48337:3bd62274cbc9

rhg: Propagate config errors in `rhg status` This code was calling `Result::unwrap_or` instead of `Option::unwrap_or` as was presumably intended. Differential Revision: https://phab.mercurial-scm.org/D11759
author Simon Sapin <simon.sapin@octobus.net>
date Tue, 09 Nov 2021 18:39:37 +0100
parents 5b9865032533
children f9db8eeb3aec
files rust/rhg/src/commands/status.rs
diffstat 1 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/rust/rhg/src/commands/status.rs	Tue Nov 09 17:09:40 2021 +0100
+++ b/rust/rhg/src/commands/status.rs	Tue Nov 09 18:39:37 2021 +0100
@@ -138,12 +138,12 @@
     }
 
     // TODO: lift these limitations
-    if invocation.config.get_bool(b"ui", b"tweakdefaults").ok() == Some(true) {
+    if invocation.config.get_bool(b"ui", b"tweakdefaults")? {
         return Err(CommandError::unsupported(
             "ui.tweakdefaults is not yet supported with rhg status",
         ));
     }
-    if invocation.config.get_bool(b"ui", b"statuscopies").ok() == Some(true) {
+    if invocation.config.get_bool(b"ui", b"statuscopies")? {
         return Err(CommandError::unsupported(
             "ui.statuscopies is not yet supported with rhg status",
         ));
@@ -263,10 +263,9 @@
     status_prefix: &[u8],
 ) -> Result<(), CommandError> {
     paths.sort_unstable();
-    let mut relative: bool =
-        config.get_bool(b"ui", b"relative-paths").unwrap_or(false);
+    let mut relative: bool = config.get_bool(b"ui", b"relative-paths")?;
     relative = config
-        .get_bool(b"commands", b"status.relative")
+        .get_option(b"commands", b"status.relative")?
         .unwrap_or(relative);
     if relative && !ui.plain() {
         relativize_paths(