Mercurial > hg
changeset 48308:698b70b9e8ea
rhg: make it possible to opt out of `rhg cat`
The reason an opt-out is needed is that there are still behavior
differences between `rhg cat` and `hg cat`:
- it does not interpret relative paths correctly
- it does not interpret patterns correctly, e.g. 're:foobar$' would be interpreted as a verbatim filename
- it does not implement the correct semantics of relpath matcher: if given a directory, `hg` concatenates all files in this directory, while `rhg` simply complains
Differential Revision: https://phab.mercurial-scm.org/D11723
author | Arseniy Alekseyev <aalekseyev@janestreet.com> |
---|---|
date | Wed, 27 Oct 2021 19:37:46 +0100 |
parents | 1421c75b20de |
children | 594cf89047c8 |
files | rust/rhg/src/commands/cat.rs |
diffstat | 1 files changed, 9 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/rust/rhg/src/commands/cat.rs Wed Oct 20 10:25:51 2021 +0200 +++ b/rust/rhg/src/commands/cat.rs Wed Oct 27 19:37:46 2021 +0100 @@ -33,6 +33,15 @@ #[timed] pub fn run(invocation: &crate::CliInvocation) -> Result<(), CommandError> { + let cat_enabled_default = true; + let cat_enabled = invocation.config.get_option(b"rhg", b"cat")?; + if !cat_enabled.unwrap_or(cat_enabled_default) { + return Err(CommandError::unsupported( + "cat is disabled in rhg (enable it with 'rhg.cat = true' \ + or enable fallback with 'rhg.on-unsupported = fallback')", + )); + } + let rev = invocation.subcommand_args.value_of("rev"); let file_args = match invocation.subcommand_args.values_of("files") { Some(files) => files.collect(),