Mercurial > public > mercurial-scm > hg-stable
comparison 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 |
comparison
equal
deleted
inserted
replaced
33139:c467d13334ee | 33140:bf1292c057ef |
---|---|
14 ) | 14 ) |
15 | 15 |
16 def loadconfigtable(ui, extname, configtable): | 16 def loadconfigtable(ui, extname, configtable): |
17 """update config item known to the ui with the extension ones""" | 17 """update config item known to the ui with the extension ones""" |
18 for section, items in configtable.items(): | 18 for section, items in configtable.items(): |
19 ui._knownconfig.setdefault(section, {}).update(items) | 19 knownitems = ui._knownconfig.setdefault(section, {}) |
20 knownkeys = set(knownitems) | |
21 newkeys = set(items) | |
22 for key in sorted(knownkeys & newkeys): | |
23 msg = "extension '%s' overwrite config item '%s.%s'" | |
24 msg %= (extname, section, key) | |
25 ui.develwarn(msg, config='warn-config') | |
26 | |
27 knownitems.update(items) | |
20 | 28 |
21 class configitem(object): | 29 class configitem(object): |
22 """represent a known config item | 30 """represent a known config item |
23 | 31 |
24 :section: the official config section where to find this item, | 32 :section: the official config section where to find this item, |