Mercurial > public > mercurial-scm > hg
diff rust/rhg/src/main.rs @ 49569:5318ac25dfdc stable
rhg: add a config option to fall back immediately
This is useful for debugging the behavior of the "default" `hg` in tests
without having to manually substitute the fallback path.
author | Rapha?l Gom?s <rgomes@octobus.net> |
---|---|
date | Thu, 03 Nov 2022 16:30:35 +0100 |
parents | 05ef5f097df4 |
children | 37bc3edef76f |
line wrap: on
line diff
--- a/rust/rhg/src/main.rs Thu Nov 03 15:57:37 2022 +0100 +++ b/rust/rhg/src/main.rs Thu Nov 03 16:30:35 2022 +0100 @@ -348,6 +348,24 @@ let config = config_cow.as_ref(); let ui = Ui::new(&config) .unwrap_or_else(|error| early_exit(&config, error.into())); + + if let Ok(true) = config.get_bool(b"rhg", b"fallback-immediately") { + exit( + &argv, + &initial_current_dir, + &ui, + OnUnsupported::Fallback { + executable: config + .get(b"rhg", b"fallback-executable") + .map(ToOwned::to_owned), + }, + Err(CommandError::unsupported( + "`rhg.fallback-immediately is true`", + )), + false, + ) + } + let result = main_with_result( argv.iter().map(|s| s.to_owned()).collect(), &process_start_time,