changeset 34186:f7c9c5d8c7f4

extensions: factor extra data loading out Some of the extra data need to be registered earlier than they currently are (eg: config items). We first factor out the logic to registered them in a small function before reusing it in the next changeset.
author Boris Feld <boris.feld@octobus.net>
date Tue, 05 Sep 2017 00:31:59 +0200
parents f84358f75978
children 4c5730c21523
files mercurial/extensions.py tests/test-devel-warnings.t
diffstat 2 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/extensions.py	Fri Jun 30 03:45:56 2017 +0200
+++ b/mercurial/extensions.py	Tue Sep 05 00:31:59 2017 +0200
@@ -288,7 +288,9 @@
         ('templatefunc', templater, 'loadfunction'),
         ('templatekeyword', templatekw, 'loadkeyword'),
     ]
+    _loadextra(ui, newindex, extraloaders)
 
+def _loadextra(ui, newindex, extraloaders):
     for name in _order[newindex:]:
         module = _extensions[name]
         if not module:
--- a/tests/test-devel-warnings.t	Fri Jun 30 03:45:56 2017 +0200
+++ b/tests/test-devel-warnings.t	Tue Sep 05 00:31:59 2017 +0200
@@ -242,8 +242,8 @@
   > EOF
 
   $ hg --config "extensions.buggyconfig=${TESTTMP}/buggyconfig.py" buggyconfig
-  devel-warn: extension 'buggyconfig' overwrite config item 'ui.interactive' at: */mercurial/extensions.py:* (loadall) (glob)
-  devel-warn: extension 'buggyconfig' overwrite config item 'ui.quiet' at: */mercurial/extensions.py:* (loadall) (glob)
+  devel-warn: extension 'buggyconfig' overwrite config item 'ui.interactive' at: */mercurial/extensions.py:* (_loadextra) (glob)
+  devel-warn: extension 'buggyconfig' overwrite config item 'ui.quiet' at: */mercurial/extensions.py:* (_loadextra) (glob)
   devel-warn: specifying a default value for a registered config item: 'ui.quiet' 'False' at: $TESTTMP/buggyconfig.py:* (cmdbuggyconfig) (glob)
   devel-warn: specifying a default value for a registered config item: 'ui.interactive' 'None' at: $TESTTMP/buggyconfig.py:* (cmdbuggyconfig) (glob)
   devel-warn: specifying a default value for a registered config item: 'test.some' 'foo' at: $TESTTMP/buggyconfig.py:* (cmdbuggyconfig) (glob)