Mercurial > hg > hg-git
diff hggit/compat.py @ 1063:c249de74742b
compat: use config registrar if available
author | Kevin Bullock <kbullock@ringworld.org> |
---|---|
date | Wed, 01 Nov 2017 20:05:44 -0500 |
parents | a2eccdeed26d |
children | ae5759bf5bcd |
line wrap: on
line diff
--- a/hggit/compat.py +++ b/hggit/compat.py @@ -65,8 +65,19 @@ CONFIG_DEFAULTS = { } +hasconfigitems = False + +def registerconfigs(configitem): + global hasconfigitems + hasconfigitems = True + for section, items in CONFIG_DEFAULTS.iteritems(): + for item, default in items.iteritems(): + configitem(section, item, default=default) + def config(ui, subtype, section, item): if subtype == 'string': subtype = '' getconfig = getattr(ui, 'config' + subtype) + if hasconfigitems: + return getconfig(section, item) return getconfig(section, item, CONFIG_DEFAULTS[section][item])