extensions: factor extra data loading out
authorBoris Feld <boris.feld@octobus.net>
Tue, 05 Sep 2017 00:31:59 +0200
changeset 34186 f7c9c5d8c7f4
parent 34185 f84358f75978
child 34187 4c5730c21523
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.
mercurial/extensions.py
tests/test-devel-warnings.t
--- 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)