[Updated] [+ ] D11381: rhg: fallback if `defaults` config is set for the current command
Alphare (Raphaël Gomès)
phabricator at mercurial-scm.org
Fri Sep 10 22:10:29 UTC 2021
Alphare updated this revision to Diff 30205.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D11381?vs=30171&id=30205
BRANCH
default
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D11381/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D11381
AFFECTED FILES
rust/rhg/src/main.rs
tests/test-rhg.t
CHANGE DETAILS
diff --git a/tests/test-rhg.t b/tests/test-rhg.t
--- a/tests/test-rhg.t
+++ b/tests/test-rhg.t
@@ -225,6 +225,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
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
@@ -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
To: Alphare, #hg-reviewers, SimonSapin
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20210910/e927019f/attachment-0002.html>
More information about the Mercurial-patches
mailing list