# HG changeset patch
# User Kevin Bullock <kbullock@ringworld.org>
# Date 1508871386 18000
#      Tue Oct 24 13:56:26 2017 -0500
# Node ID a2eccdeed26d809e084ec211858c711b45d31b56
# Parent  b236d7259c2d843a5d53595f7ebc6d0315e28988
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.

diff --git a/hggit/compat.py b/hggit/compat.py
--- 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])