annotate rust/rhg/src/commands/debugrequirements.rs @ 52038:b7d99348ea36

rust-files: also return filenode and flags when listing a revision's files This is going to be useful when implementing parts of `update` and makes it so we don't have to fetch the manifest and each entry twice.
author Raphaël Gomès <rgomes@octobus.net>
date Mon, 30 Sep 2024 12:10:35 +0200
parents 37bc3edef76f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
45924
a2eda1ff22aa requirements: move loading to hg-core and add parsing
Simon Sapin <simon-commits@exyr.org>
parents: 45923
diff changeset
1 use crate::error::CommandError;
45923
ead435aa5294 rhg: add a `debugrequirements` subcommand
Simon Sapin <simon-commits@exyr.org>
parents:
diff changeset
2
ead435aa5294 rhg: add a `debugrequirements` subcommand
Simon Sapin <simon-commits@exyr.org>
parents:
diff changeset
3 pub const HELP_TEXT: &str = "
ead435aa5294 rhg: add a `debugrequirements` subcommand
Simon Sapin <simon-commits@exyr.org>
parents:
diff changeset
4 Print the current repo requirements.
ead435aa5294 rhg: add a `debugrequirements` subcommand
Simon Sapin <simon-commits@exyr.org>
parents:
diff changeset
5 ";
ead435aa5294 rhg: add a `debugrequirements` subcommand
Simon Sapin <simon-commits@exyr.org>
parents:
diff changeset
6
49640
37bc3edef76f rhg: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents: 46593
diff changeset
7 pub fn args() -> clap::Command {
37bc3edef76f rhg: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents: 46593
diff changeset
8 clap::command!("debugrequirements").about(HELP_TEXT)
46501
1ecaf09d9964 rhg: Move subcommand CLI arguments definitions to respective modules
Simon Sapin <simon.sapin@octobus.net>
parents: 46500
diff changeset
9 }
1ecaf09d9964 rhg: Move subcommand CLI arguments definitions to respective modules
Simon Sapin <simon.sapin@octobus.net>
parents: 46500
diff changeset
10
46592
80840b651721 rhg: Group values passed to every sub-command into a struct
Simon Sapin <simon.sapin@octobus.net>
parents: 46503
diff changeset
11 pub fn run(invocation: &crate::CliInvocation) -> Result<(), CommandError> {
46593
5ce2aa7c2ad5 rhg: Move `Repo` object creation into `main()`
Simon Sapin <simon.sapin@octobus.net>
parents: 46592
diff changeset
12 let repo = invocation.repo?;
46500
184e46550dc8 rhg: replace command structs with functions
Simon Sapin <simon.sapin@octobus.net>
parents: 46484
diff changeset
13 let mut output = String::new();
184e46550dc8 rhg: replace command structs with functions
Simon Sapin <simon.sapin@octobus.net>
parents: 46484
diff changeset
14 let mut requirements: Vec<_> = repo.requirements().iter().collect();
184e46550dc8 rhg: replace command structs with functions
Simon Sapin <simon.sapin@octobus.net>
parents: 46484
diff changeset
15 requirements.sort();
184e46550dc8 rhg: replace command structs with functions
Simon Sapin <simon.sapin@octobus.net>
parents: 46484
diff changeset
16 for req in requirements {
184e46550dc8 rhg: replace command structs with functions
Simon Sapin <simon.sapin@octobus.net>
parents: 46484
diff changeset
17 output.push_str(req);
184e46550dc8 rhg: replace command structs with functions
Simon Sapin <simon.sapin@octobus.net>
parents: 46484
diff changeset
18 output.push('\n');
45923
ead435aa5294 rhg: add a `debugrequirements` subcommand
Simon Sapin <simon-commits@exyr.org>
parents:
diff changeset
19 }
46592
80840b651721 rhg: Group values passed to every sub-command into a struct
Simon Sapin <simon.sapin@octobus.net>
parents: 46503
diff changeset
20 invocation.ui.write_stdout(output.as_bytes())?;
46500
184e46550dc8 rhg: replace command structs with functions
Simon Sapin <simon.sapin@octobus.net>
parents: 46484
diff changeset
21 Ok(())
45923
ead435aa5294 rhg: add a `debugrequirements` subcommand
Simon Sapin <simon-commits@exyr.org>
parents:
diff changeset
22 }