rhg: Return an error code for `rhg config Section.idontexist`
This is what Python-based hg does.
Differential Revision: https://phab.mercurial-scm.org/D10145
--- a/rust/rhg/src/commands/config.rs Mon Mar 08 20:04:20 2021 +0100
+++ b/rust/rhg/src/commands/config.rs Tue Mar 09 09:17:24 2021 +0100
@@ -29,8 +29,10 @@
.split_2(b'.')
.ok_or_else(|| HgError::unsupported("hg config <section>"))?;
- let value = invocation.config.get(section, name).unwrap_or(b"");
-
- invocation.ui.write_stdout(&format_bytes!(b"{}\n", value))?;
- Ok(())
+ if let Some(value) = invocation.config.get(section, name) {
+ invocation.ui.write_stdout(&format_bytes!(b"{}\n", value))?;
+ Ok(())
+ } else {
+ Err(CommandError::Unsuccessful)
+ }
}