Patchwork D11759: rhg: Propagate config errors in `rhg status`

login
register
mail settings
Submitter phabricator
Date Nov. 15, 2021, 5:42 p.m.
Message ID <differential-rev-PHID-DREV-4c3cn5pk6bs7k4catrms-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/50084/
State Superseded
Headers show

Comments

phabricator - Nov. 15, 2021, 5:42 p.m.
SimonSapin created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This code was calling `Result::unwrap_or` instead of `Option::unwrap_or`
  as was presumably intended.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11759

AFFECTED FILES
  rust/rhg/src/commands/status.rs

CHANGE DETAILS




To: SimonSapin, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/rust/rhg/src/commands/status.rs b/rust/rhg/src/commands/status.rs
--- a/rust/rhg/src/commands/status.rs
+++ b/rust/rhg/src/commands/status.rs
@@ -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(