##// END OF EJS Templates
revlog-compression: use zstd by default (if available)...
revlog-compression: use zstd by default (if available) As see in changeset bb271ec2fbfb, zstd is 20% to 50% faster for reading and writing. Use take advantage of the new config behavior to try zstd by default, falling back to zlib is zstd is not available on that plateform. Differential Revision: https://phab.mercurial-scm.org/D10326

File last commit:

r47474:97ac588b default
r47636:84a93fa7 default
Show More
root.rs
28 lines | 889 B | application/rls-services+xml | RustLexer
use crate::error::CommandError;
use format_bytes::format_bytes;
use hg::errors::{IoErrorContext, IoResultExt};
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.
";
pub fn args() -> clap::App<'static, 'static> {
clap::SubCommand::with_name("root").about(HELP_TEXT)
}
pub fn run(invocation: &crate::CliInvocation) -> Result<(), CommandError> {
let repo = invocation.repo?;
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);
invocation
.ui
.write_stdout(&format_bytes!(b"{}\n", bytes.as_slice()))?;
Ok(())
}