Mercurial > hg
view rust/rhg/src/commands/debugrequirements.rs @ 45924:a2eda1ff22aa
requirements: move loading to hg-core and add parsing
No functional change, checking comes later.
Differential Revision: https://phab.mercurial-scm.org/D9398
author | Simon Sapin <simon-commits@exyr.org> |
---|---|
date | Tue, 24 Nov 2020 17:49:16 +0100 |
parents | ead435aa5294 |
children | dca9cb99971c |
line wrap: on
line source
use crate::commands::Command; use crate::error::CommandError; use crate::ui::Ui; use hg::operations::FindRoot; use hg::requirements; pub const HELP_TEXT: &str = " Print the current repo requirements. "; pub struct DebugRequirementsCommand {} impl DebugRequirementsCommand { pub fn new() -> Self { DebugRequirementsCommand {} } } impl Command for DebugRequirementsCommand { fn run(&self, ui: &Ui) -> Result<(), CommandError> { let root = FindRoot::new().run()?; let mut output = String::new(); for req in requirements::load(&root)? { output.push_str(&req); output.push('\n'); } ui.write_stdout(output.as_bytes())?; Ok(()) } }