diff rust/rhg/src/commands/root.rs @ 46503:d8730ff51d5a

rhg: Add support for -R and --repository command-line arguments Differential Revision: https://phab.mercurial-scm.org/D9970
author Simon Sapin <simon.sapin@octobus.net>
date Mon, 08 Feb 2021 21:37:30 +0100
parents 1ecaf09d9964
children 80840b651721
line wrap: on
line diff
--- a/rust/rhg/src/commands/root.rs	Mon Feb 08 21:28:52 2021 +0100
+++ b/rust/rhg/src/commands/root.rs	Mon Feb 08 21:37:30 2021 +0100
@@ -5,6 +5,7 @@
 use hg::config::Config;
 use hg::repo::Repo;
 use hg::utils::files::get_bytes_from_path;
+use std::path::Path;
 
 pub const HELP_TEXT: &str = "
 Print the root directory of the current repository.
@@ -19,9 +20,10 @@
 pub fn run(
     ui: &Ui,
     config: &Config,
+    repo_path: Option<&Path>,
     _args: &ArgMatches,
 ) -> Result<(), CommandError> {
-    let repo = Repo::find(config)?;
+    let repo = Repo::find(config, repo_path)?;
     let bytes = get_bytes_from_path(repo.working_directory_path());
     ui.write_stdout(&format_bytes!(b"{}\n", bytes.as_slice()))?;
     Ok(())