--- a/rust/rhg/src/commands/config.rs Mon Feb 15 20:05:32 2021 +0100
+++ b/rust/rhg/src/commands/config.rs Mon Feb 15 20:13:09 2021 +0100
@@ -2,7 +2,6 @@
use clap::Arg;
use format_bytes::format_bytes;
use hg::errors::HgError;
-use hg::repo::Repo;
use hg::utils::SliceExt;
pub const HELP_TEXT: &str = "
@@ -22,13 +21,6 @@
}
pub fn run(invocation: &crate::CliInvocation) -> Result<(), CommandError> {
- let opt_repo =
- Repo::find_optional(invocation.non_repo_config, invocation.repo_path)?;
- let config = if let Some(repo) = &opt_repo {
- repo.config()
- } else {
- invocation.non_repo_config
- };
let (section, name) = invocation
.subcommand_args
.value_of("name")
@@ -37,7 +29,7 @@
.split_2(b'.')
.ok_or_else(|| HgError::abort(""))?;
- let value = config.get(section, name).unwrap_or(b"");
+ let value = invocation.config().get(section, name).unwrap_or(b"");
invocation.ui.write_stdout(&format_bytes!(b"{}\n", value))?;
Ok(())