Mercurial > public > mercurial-scm > hg-stable
diff mercurial/configitems.py @ 33140:bf1292c057ef
configitems: add a devel warning for extensions items overiding core one
We do not want such case to pass silently. In the future we'll likely have
useful tool for an extension to alter the existing definition in core.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sun, 18 Jun 2017 19:52:54 +0200 |
parents | c467d13334ee |
children | 77e666f943a6 |
line wrap: on
line diff
--- a/mercurial/configitems.py Sat Jun 17 13:48:20 2017 +0200 +++ b/mercurial/configitems.py Sun Jun 18 19:52:54 2017 +0200 @@ -16,7 +16,15 @@ def loadconfigtable(ui, extname, configtable): """update config item known to the ui with the extension ones""" for section, items in configtable.items(): - ui._knownconfig.setdefault(section, {}).update(items) + knownitems = ui._knownconfig.setdefault(section, {}) + knownkeys = set(knownitems) + newkeys = set(items) + for key in sorted(knownkeys & newkeys): + msg = "extension '%s' overwrite config item '%s.%s'" + msg %= (extname, section, key) + ui.develwarn(msg, config='warn-config') + + knownitems.update(items) class configitem(object): """represent a known config item