Mercurial > hg > hg-git
changeset 1062:a2eccdeed26d
config: provide a central place to define and access defaults
Provides a place to register the defaults for all config options in one
place, and a helper to read them. This will let us eliminate deprecation
warnings on hg 4.4 (in a future change) while remaining compatible with
older versions.
author | Kevin Bullock <kbullock@ringworld.org> |
---|---|
date | Tue, 24 Oct 2017 13:56:26 -0500 |
parents | b236d7259c2d |
children | c249de74742b |
files | hggit/compat.py |
diffstat | 1 files changed, 10 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/hggit/compat.py +++ b/hggit/compat.py @@ -60,3 +60,13 @@ if len(refs) == 0: return None, set([]) return refs, set(server_capabilities) + + +CONFIG_DEFAULTS = { +} + +def config(ui, subtype, section, item): + if subtype == 'string': + subtype = '' + getconfig = getattr(ui, 'config' + subtype) + return getconfig(section, item, CONFIG_DEFAULTS[section][item])