Mercurial > hg
view rust/rhg/src/commands/debugrequirements.rs @ 46462:d03b0601e0eb
rhg: initial support for shared repositories
Differential Revision: https://phab.mercurial-scm.org/D9941
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Thu, 14 Jan 2021 13:04:12 +0100 |
parents | 8a4914397d02 |
children | a6e4e4650bac |
line wrap: on
line source
use crate::commands::Command; use crate::error::CommandError; use crate::ui::Ui; use hg::repo::Repo; 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 repo = Repo::find()?; 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'); } ui.write_stdout(output.as_bytes())?; Ok(()) } }