[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mercurial-devel
Subject:    D11723: rhg: make it possible to opt out of [rhg cat]
From:       "aalekseyev (Arseniy Alekseyev)" <phabricator () mercurial-scm ! org>
Date:       2021-10-27 18:38:05
Message-ID: differential-rev-PHID-DREV-agrdumzn35tk2gkxald3-req () mercurial-scm ! org
[Download RAW message or body]

aalekseyev created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

REVISION DETAIL
  https://phab.mercurial-scm.org/D11723

AFFECTED FILES
  rust/rhg/src/commands/cat.rs

CHANGE DETAILS

diff --git a/rust/rhg/src/commands/cat.rs b/rust/rhg/src/commands/cat.rs
--- a/rust/rhg/src/commands/cat.rs
+++ b/rust/rhg/src/commands/cat.rs
@@ -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(),



To: aalekseyev, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic