##// END OF EJS Templates
dirstate: narrow gathering of parent data...
dirstate: narrow gathering of parent data The parent data are only going to be useful is the file might be clean. And it might only be clean if it is tracked in both p1 and the working copy. Differential Revision: https://phab.mercurial-scm.org/D11584

File last commit:

r47474:97ac588b default
r48953:42ab0bcb default
Show More
root.rs
28 lines | 889 B | application/rls-services+xml | RustLexer
Antoine Cezar
rhg: simplify `FindRootError` handling...
r45922 use crate::error::CommandError;
Raphaël Gomès
rhg: use `format_bytes!` for error messages...
r46598 use format_bytes::format_bytes;
Simon Sapin
rhg: Don’t make repository path absolute too early...
r47474 use hg::errors::{IoErrorContext, IoResultExt};
Antoine Cezar
rhg: add RootCommand using hg-core FindRoot operation to prepare `hg root`...
r45592 use hg::utils::files::get_bytes_from_path;
pub const HELP_TEXT: &str = "
Print the root directory of the current repository.
Returns 0 on success.
";
Simon Sapin
rhg: Move subcommand CLI arguments definitions to respective modules...
r47251 pub fn args() -> clap::App<'static, 'static> {
clap::SubCommand::with_name("root").about(HELP_TEXT)
}
Simon Sapin
rhg: Group values passed to every sub-command into a struct...
r47334 pub fn run(invocation: &crate::CliInvocation) -> Result<(), CommandError> {
Simon Sapin
rhg: Move `Repo` object creation into `main()`...
r47335 let repo = invocation.repo?;
Simon Sapin
rhg: Don’t make repository path absolute too early...
r47474 let working_directory = repo.working_directory_path();
let working_directory = std::fs::canonicalize(working_directory)
.with_context(|| {
IoErrorContext::CanonicalizingPath(working_directory.to_owned())
})?;
let bytes = get_bytes_from_path(&working_directory);
Simon Sapin
rhg: Group values passed to every sub-command into a struct...
r47334 invocation
.ui
.write_stdout(&format_bytes!(b"{}\n", bytes.as_slice()))?;
Simon Sapin
rhg: replace command structs with functions...
r47250 Ok(())
Antoine Cezar
rhg: add RootCommand using hg-core FindRoot operation to prepare `hg root`...
r45592 }