Show More
@@ -291,6 +291,8 b' def loadall(ui, whitelist=None):' | |||||
291 | ) |
|
291 | ) | |
292 | ui.log(b'extension', b'- processing %d entries\n', len(result)) |
|
292 | ui.log(b'extension', b'- processing %d entries\n', len(result)) | |
293 | with util.timedcm('load all extensions') as stats: |
|
293 | with util.timedcm('load all extensions') as stats: | |
|
294 | default_sub_options = ui.configsuboptions(b"extensions", b"*")[1] | |||
|
295 | ||||
294 | for (name, path) in result: |
|
296 | for (name, path) in result: | |
295 | if path: |
|
297 | if path: | |
296 | if path[0:1] == b'!': |
|
298 | if path[0:1] == b'!': | |
@@ -315,8 +317,10 b' def loadall(ui, whitelist=None):' | |||||
315 | error_msg = _(b'failed to import extension "%s": %s') |
|
317 | error_msg = _(b'failed to import extension "%s": %s') | |
316 | error_msg %= (name, msg) |
|
318 | error_msg %= (name, msg) | |
317 |
|
319 | |||
|
320 | options = default_sub_options.copy() | |||
318 | ext_options = ui.configsuboptions(b"extensions", name)[1] |
|
321 | ext_options = ui.configsuboptions(b"extensions", name)[1] | |
319 | if stringutil.parsebool(ext_options.get(b"required", b'no')): |
|
322 | options.update(ext_options) | |
|
323 | if stringutil.parsebool(options.get(b"required", b'no')): | |||
320 | hint = None |
|
324 | hint = None | |
321 | if isinstance(inst, error.Hint) and inst.hint: |
|
325 | if isinstance(inst, error.Hint) and inst.hint: | |
322 | hint = inst.hint |
|
326 | hint = inst.hint |
@@ -861,6 +861,13 b' suboption in the config::' | |||||
861 | To debug extension loading issue, one can add `--traceback` to their mercurial |
|
861 | To debug extension loading issue, one can add `--traceback` to their mercurial | |
862 | invocation. |
|
862 | invocation. | |
863 |
|
863 | |||
|
864 | A default setting can we set using the special `*` extension key:: | |||
|
865 | ||||
|
866 | [extensions] | |||
|
867 | *:required = yes | |||
|
868 | myfeature = ~/.hgext/myfeature.py | |||
|
869 | rebase= | |||
|
870 | ||||
864 |
|
871 | |||
865 | ``format`` |
|
872 | ``format`` | |
866 | ---------- |
|
873 | ---------- |
@@ -41,4 +41,5 b' will likely receive warnings about a dir' | |||||
41 | > -X tests/test-demandimport.py \ |
|
41 | > -X tests/test-demandimport.py \ | |
42 | > -X tests/test-imports-checker.t \ |
|
42 | > -X tests/test-imports-checker.t \ | |
43 | > -X tests/test-verify-repo-operations.py \ |
|
43 | > -X tests/test-verify-repo-operations.py \ | |
|
44 | > -X tests/test-extension.t \ | |||
44 | > | sed 's-\\-/-g' | "$PYTHON" "$import_checker" - |
|
45 | > | sed 's-\\-/-g' | "$PYTHON" "$import_checker" - |
@@ -2035,3 +2035,20 b' Same check with a missing one' | |||||
2035 | abort: failed to import extension "missing" from foo/bar/baz/I/do/not/exist/: [Errno 2] $ENOENT$: 'foo/bar/baz/I/do/not/exist' |
|
2035 | abort: failed to import extension "missing" from foo/bar/baz/I/do/not/exist/: [Errno 2] $ENOENT$: 'foo/bar/baz/I/do/not/exist' | |
2036 | (loading of this extension was required, see `hg help config.extensions` for details) |
|
2036 | (loading of this extension was required, see `hg help config.extensions` for details) | |
2037 | [255] |
|
2037 | [255] | |
|
2038 | ||||
|
2039 | Have a "default" setting for the suboption: | |||
|
2040 | ||||
|
2041 | $ cat > $TESTTMP/mandatory-extensions/.hg/hgrc << EOF | |||
|
2042 | > [extensions] | |||
|
2043 | > bad = $TESTTMP/mandatory-extensions/.hg/bad.py | |||
|
2044 | > bad:required = no | |||
|
2045 | > good = $TESTTMP/mandatory-extensions/.hg/good.py | |||
|
2046 | > syntax = $TESTTMP/mandatory-extensions/.hg/syntax.py | |||
|
2047 | > *:required = yes | |||
|
2048 | > EOF | |||
|
2049 | ||||
|
2050 | $ hg -R mandatory-extensions id | |||
|
2051 | *** failed to import extension "bad" from $TESTTMP/mandatory-extensions/.hg/bad.py: babar | |||
|
2052 | abort: failed to import extension "syntax" from $TESTTMP/mandatory-extensions/.hg/syntax.py: invalid syntax (*syntax.py, line 1) (glob) | |||
|
2053 | (loading of this extension was required, see `hg help config.extensions` for details) | |||
|
2054 | [255] |
General Comments 0
You need to be logged in to leave comments.
Login now