equal
deleted
inserted
replaced
3 use clap::ArgMatches; |
3 use clap::ArgMatches; |
4 use format_bytes::format_bytes; |
4 use format_bytes::format_bytes; |
5 use hg::config::Config; |
5 use hg::config::Config; |
6 use hg::repo::Repo; |
6 use hg::repo::Repo; |
7 use hg::utils::files::get_bytes_from_path; |
7 use hg::utils::files::get_bytes_from_path; |
|
8 use std::path::Path; |
8 |
9 |
9 pub const HELP_TEXT: &str = " |
10 pub const HELP_TEXT: &str = " |
10 Print the root directory of the current repository. |
11 Print the root directory of the current repository. |
11 |
12 |
12 Returns 0 on success. |
13 Returns 0 on success. |
17 } |
18 } |
18 |
19 |
19 pub fn run( |
20 pub fn run( |
20 ui: &Ui, |
21 ui: &Ui, |
21 config: &Config, |
22 config: &Config, |
|
23 repo_path: Option<&Path>, |
22 _args: &ArgMatches, |
24 _args: &ArgMatches, |
23 ) -> Result<(), CommandError> { |
25 ) -> Result<(), CommandError> { |
24 let repo = Repo::find(config)?; |
26 let repo = Repo::find(config, repo_path)?; |
25 let bytes = get_bytes_from_path(repo.working_directory_path()); |
27 let bytes = get_bytes_from_path(repo.working_directory_path()); |
26 ui.write_stdout(&format_bytes!(b"{}\n", bytes.as_slice()))?; |
28 ui.write_stdout(&format_bytes!(b"{}\n", bytes.as_slice()))?; |
27 Ok(()) |
29 Ok(()) |
28 } |
30 } |