[PATCH 2 of 3] extensions: factor extra data loading out

Boris Feld boris.feld at octobus.net
Wed Sep 13 06:36:38 UTC 2017


# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1504564319 -7200
#      mar. sept. 05 00:31:59 2017 +0200
# Node ID 61359c114a007e20e8d4799ab9b849d124ae9639
# Parent  24bf823377fcbf49fec9da8adb796924dff91c73
# EXP-Topic config.register.schedule
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.

diff -r 24bf823377fc -r 61359c114a00 mercurial/extensions.py
--- a/mercurial/extensions.py	mar. sept. 12 19:27:01 2017 -0700
+++ b/mercurial/extensions.py	mar. sept. 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:
diff -r 24bf823377fc -r 61359c114a00 tests/test-devel-warnings.t
--- a/tests/test-devel-warnings.t	mar. sept. 12 19:27:01 2017 -0700
+++ b/tests/test-devel-warnings.t	mar. sept. 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)



More information about the Mercurial-devel mailing list