##// END OF EJS Templates
rust: add explicit resolver field to top-level cargo manifest file...
rust: add explicit resolver field to top-level cargo manifest file Since Rust 1.51.0, Cargo has support for a better dependency resolver. Workspace packages (like ours) need to explicitely set the field, so let's. https://doc.rust-lang.org/edition-guide/rust-2021/default-cargo-resolver.html

File last commit:

r52013:532e74ad default
r52014:34e0670c default
Show More
root.rs
28 lines | 861 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::Command {
clap::command!("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(())
}