##// END OF EJS Templates
rhg: Add support for -R and --repository command-line arguments...
rhg: Add support for -R and --repository command-line arguments Differential Revision: https://phab.mercurial-scm.org/D9970

File last commit:

r47231:1a00a578 default
r47231:1a00a578 default
Show More
debugrequirements.rs
32 lines | 790 B | application/rls-services+xml | RustLexer
/ rust / rhg / src / commands / debugrequirements.rs
Simon Sapin
requirements: move loading to hg-core and add parsing...
r46536 use crate::error::CommandError;
Simon Sapin
rhg: add a `debugrequirements` subcommand...
r46535 use crate::ui::Ui;
Simon Sapin
rhg: replace command structs with functions...
r47228 use clap::ArgMatches;
Simon Sapin
rhg: Parse system and user configuration at program start...
r47213 use hg::config::Config;
Simon Sapin
rust: introduce Repo and Vfs types for filesystem abstraction...
r46782 use hg::repo::Repo;
Simon Sapin
rhg: Add support for -R and --repository command-line arguments...
r47231 use std::path::Path;
Simon Sapin
rhg: add a `debugrequirements` subcommand...
r46535
pub const HELP_TEXT: &str = "
Print the current repo requirements.
";
Simon Sapin
rhg: Move subcommand CLI arguments definitions to respective modules...
r47229 pub fn args() -> clap::App<'static, 'static> {
clap::SubCommand::with_name("debugrequirements").about(HELP_TEXT)
}
Simon Sapin
rhg: replace command structs with functions...
r47228 pub fn run(
ui: &Ui,
config: &Config,
Simon Sapin
rhg: Add support for -R and --repository command-line arguments...
r47231 repo_path: Option<&Path>,
Simon Sapin
rhg: replace command structs with functions...
r47228 _args: &ArgMatches,
) -> Result<(), CommandError> {
Simon Sapin
rhg: Add support for -R and --repository command-line arguments...
r47231 let repo = Repo::find(config, repo_path)?;
Simon Sapin
rhg: replace command structs with functions...
r47228 let mut output = String::new();
let mut requirements: Vec<_> = repo.requirements().iter().collect();
requirements.sort();
for req in requirements {
output.push_str(req);
output.push('\n');
Simon Sapin
rhg: add a `debugrequirements` subcommand...
r46535 }
Simon Sapin
rhg: replace command structs with functions...
r47228 ui.write_stdout(output.as_bytes())?;
Ok(())
Simon Sapin
rhg: add a `debugrequirements` subcommand...
r46535 }