# HG changeset patch # User Raphaël Gomès # Date 1630512575 -7200 # Node ID b44e1184b7e178ea34e2c9e71c6305d5e337ba7c # Parent f11f233546ce7f98054e11033c9974b71d972bdd rhg: fallback if `defaults` config is set for the current command Differential Revision: https://phab.mercurial-scm.org/D11381 diff -r f11f233546ce -r b44e1184b7e1 rust/rhg/src/main.rs --- a/rust/rhg/src/main.rs Wed Sep 01 17:41:51 2021 +0200 +++ b/rust/rhg/src/main.rs Wed Sep 01 18:09:35 2021 +0200 @@ -69,6 +69,14 @@ let (subcommand_name, subcommand_matches) = matches.subcommand(); + // Mercurial allows users to define "defaults" for commands, fallback + // if a default is detected for the current command + let defaults = config.get_str(b"defaults", subcommand_name.as_bytes()); + if defaults?.is_some() { + let msg = "`defaults` config set"; + return Err(CommandError::unsupported(msg)); + } + for prefix in ["pre", "post", "fail"].iter() { // Mercurial allows users to define generic hooks for commands, // fallback if any are detected diff -r f11f233546ce -r b44e1184b7e1 tests/test-rhg.t --- a/tests/test-rhg.t Wed Sep 01 17:41:51 2021 +0200 +++ b/tests/test-rhg.t Wed Sep 01 18:09:35 2021 +0200 @@ -228,6 +228,12 @@ unsupported feature: fail-cat hook defined [252] +Fallback with [defaults] + $ $NO_FALLBACK rhg cat original --config "defaults.cat=-r null" + unsupported feature: `defaults` config set + [252] + + Requirements $ $NO_FALLBACK rhg debugrequirements dotencode