diff tests/test-extension.t @ 48362:7e6488aa1261

extensions: add a default "*" suboptions prefix This is similar to what we do in other section (e.g. `paths`) and allow to change the behavior for all extensions. Sub options on individual extensions overwrite the default settings. Differential Revision: https://phab.mercurial-scm.org/D11823
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 26 Nov 2021 17:22:14 +0100
parents 0d0ce2529540
children 0b2469bf1227
line wrap: on
line diff
--- a/tests/test-extension.t	Fri Nov 26 17:17:49 2021 +0100
+++ b/tests/test-extension.t	Fri Nov 26 17:22:14 2021 +0100
@@ -2035,3 +2035,20 @@
   abort: failed to import extension "missing" from foo/bar/baz/I/do/not/exist/: [Errno 2] $ENOENT$: 'foo/bar/baz/I/do/not/exist'
   (loading of this extension was required, see `hg help config.extensions` for details)
   [255]
+
+Have a "default" setting for the suboption:
+
+  $ cat > $TESTTMP/mandatory-extensions/.hg/hgrc << EOF
+  > [extensions]
+  > bad = $TESTTMP/mandatory-extensions/.hg/bad.py
+  > bad:required = no
+  > good = $TESTTMP/mandatory-extensions/.hg/good.py
+  > syntax = $TESTTMP/mandatory-extensions/.hg/syntax.py
+  > *:required = yes
+  > EOF
+
+  $ hg -R mandatory-extensions id
+  *** failed to import extension "bad" from $TESTTMP/mandatory-extensions/.hg/bad.py: babar
+  abort: failed to import extension "syntax" from $TESTTMP/mandatory-extensions/.hg/syntax.py: invalid syntax (*syntax.py, line 1) (glob)
+  (loading of this extension was required, see `hg help config.extensions` for details)
+  [255]