# HG changeset patch # User Arseniy Alekseyev # Date 1635359866 -3600 # Node ID 698b70b9e8ea9ea11db1b3733cc6f11cab9a5f0d # Parent 1421c75b20dedd5a0918402dfcef78d95d384fa1 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 diff -r 1421c75b20de -r 698b70b9e8ea rust/rhg/src/commands/cat.rs --- 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(),