[Updated] D11723: rhg: make it possible to opt out of `rhg cat`

aalekseyev (Arseniy Alekseyev) phabricator at mercurial-scm.org
Tue Nov 9 15:02:58 UTC 2021


Closed by commit rHG698b70b9e8ea: rhg: make it possible to opt out of `rhg cat` (authored by aalekseyev).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D11723?vs=30996&id=31040

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D11723/new/

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, spectral, SimonSapin
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20211109/f2d81616/attachment.html>


More information about the Mercurial-patches mailing list