# HG changeset patch # User Raphaël Gomès # Date 2021-11-26 14:07:59 # Node ID 9ff246cd62004cfbe68d9b0a520aeab9f7b06a69 # Parent 1d940d76571b57d3319ac88db765136aa4517e4f rhg: don't run `blackbox` if not activated You currently have no way of turning off blackbox. Aside from being a bug, this can be annoying if you use `rhg` in your shell prompt, but also because the current implementation of blackbox is quite slow due to `user` querying. Differential Revision: https://phab.mercurial-scm.org/D11813 diff --git a/rust/rhg/src/main.rs b/rust/rhg/src/main.rs --- a/rust/rhg/src/main.rs +++ b/rust/rhg/src/main.rs @@ -110,18 +110,23 @@ fn main_with_result( } } - let blackbox = blackbox::Blackbox::new(&invocation, process_start_time)?; - blackbox.log_command_start(); - let result = run(&invocation); - blackbox.log_command_end(exit_code( - &result, - // TODO: show a warning or combine with original error if `get_bool` - // returns an error - config - .get_bool(b"ui", b"detailed-exit-code") - .unwrap_or(false), - )); - result + if config.is_extension_enabled(b"blackbox") { + let blackbox = + blackbox::Blackbox::new(&invocation, process_start_time)?; + blackbox.log_command_start(); + let result = run(&invocation); + blackbox.log_command_end(exit_code( + &result, + // TODO: show a warning or combine with original error if + // `get_bool` returns an error + config + .get_bool(b"ui", b"detailed-exit-code") + .unwrap_or(false), + )); + result + } else { + run(&invocation) + } } fn main() {