Mercurial > public > mercurial-scm > hg-stable
annotate rust/rhg/src/commands/debugrequirements.rs @ 53040:cdd7bf612c7b stable tip
bundle-spec: properly format boolean parameter (issue6960)
This was breaking automatic clone bundle generation. This changeset fixes it and
add a test to catch it in the future.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 11 Mar 2025 02:29:42 +0100 |
parents | 37bc3edef76f |
children |
rev | line source |
---|---|
45939
a2eda1ff22aa
requirements: move loading to hg-core and add parsing
Simon Sapin <simon-commits@exyr.org>
parents:
45938
diff
changeset
|
1 use crate::error::CommandError; |
45938
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 |
49758
37bc3edef76f
rhg: upgrade `clap` dependency
Rapha?l Gom?s <rgomes@octobus.net>
parents:
46632
diff
changeset
|
7 pub fn args() -> clap::Command { |
37bc3edef76f
rhg: upgrade `clap` dependency
Rapha?l Gom?s <rgomes@octobus.net>
parents:
46632
diff
changeset
|
8 clap::command!("debugrequirements").about(HELP_TEXT) |
46553
1ecaf09d9964
rhg: Move subcommand CLI arguments definitions to respective modules
Simon Sapin <simon.sapin@octobus.net>
parents:
46552
diff
changeset
|
9 } |
1ecaf09d9964
rhg: Move subcommand CLI arguments definitions to respective modules
Simon Sapin <simon.sapin@octobus.net>
parents:
46552
diff
changeset
|
10 |
46631
80840b651721
rhg: Group values passed to every sub-command into a struct
Simon Sapin <simon.sapin@octobus.net>
parents:
46555
diff
changeset
|
11 pub fn run(invocation: &crate::CliInvocation) -> Result<(), CommandError> { |
46632
5ce2aa7c2ad5
rhg: Move `Repo` object creation into `main()`
Simon Sapin <simon.sapin@octobus.net>
parents:
46631
diff
changeset
|
12 let repo = invocation.repo?; |
46552
184e46550dc8
rhg: replace command structs with functions
Simon Sapin <simon.sapin@octobus.net>
parents:
46543
diff
changeset
|
13 let mut output = String::new(); |
184e46550dc8
rhg: replace command structs with functions
Simon Sapin <simon.sapin@octobus.net>
parents:
46543
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:
46543
diff
changeset
|
15 requirements.sort(); |
184e46550dc8
rhg: replace command structs with functions
Simon Sapin <simon.sapin@octobus.net>
parents:
46543
diff
changeset
|
16 for req in requirements { |
184e46550dc8
rhg: replace command structs with functions
Simon Sapin <simon.sapin@octobus.net>
parents:
46543
diff
changeset
|
17 output.push_str(req); |
184e46550dc8
rhg: replace command structs with functions
Simon Sapin <simon.sapin@octobus.net>
parents:
46543
diff
changeset
|
18 output.push('\n'); |
45938
ead435aa5294
rhg: add a `debugrequirements` subcommand
Simon Sapin <simon-commits@exyr.org>
parents:
diff
changeset
|
19 } |
46631
80840b651721
rhg: Group values passed to every sub-command into a struct
Simon Sapin <simon.sapin@octobus.net>
parents:
46555
diff
changeset
|
20 invocation.ui.write_stdout(output.as_bytes())?; |
46552
184e46550dc8
rhg: replace command structs with functions
Simon Sapin <simon.sapin@octobus.net>
parents:
46543
diff
changeset
|
21 Ok(()) |
45938
ead435aa5294
rhg: add a `debugrequirements` subcommand
Simon Sapin <simon-commits@exyr.org>
parents:
diff
changeset
|
22 } |