Read about our upcoming Code of Conduct on this issue

Commit 608ed97f authored by Arseniy Alekseyev's avatar Arseniy Alekseyev
Browse files

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:
parent 1421c75b20de
......@@ -33,6 +33,15 @@ pub fn args() -> clap::App<'static, 'static> {
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 ' = 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(),
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment