##// END OF EJS Templates
configitems: introduce a central registry for config option...
marmoute -
r32984:6d983e8a default
parent child Browse files
Show More
@@ -7,6 +7,10 b''
7 7
8 8 from __future__ import absolute_import
9 9
10 from . import (
11 error,
12 )
13
10 14 class configitem(object):
11 15 """represent a known config item
12 16
@@ -19,3 +23,13 b' class configitem(object):'
19 23 self.section = section
20 24 self.name = name
21 25 self.default = default
26
27 coreitems = {}
28
29 def coreconfigitem(*args, **kwargs):
30 item = configitem(*args, **kwargs)
31 section = coreitems.setdefault(item.section, {})
32 if item.name in section:
33 msg = "duplicated config item registration for '%s.%s'"
34 raise error.ProgrammingError(msg % (item.section, item.name))
35 section[item.name] = item
@@ -27,6 +27,7 b' from .node import hex'
27 27 from . import (
28 28 color,
29 29 config,
30 configitems,
30 31 encoding,
31 32 error,
32 33 formatter,
@@ -178,6 +179,7 b' class ui(object):'
178 179 self._bufferapplylabels = None
179 180 self.quiet = self.verbose = self.debugflag = self.tracebackflag = False
180 181 self._reportuntrusted = True
182 self._knownconfig = configitems.coreitems
181 183 self._ocfg = config.config() # overlay
182 184 self._tcfg = config.config() # trusted
183 185 self._ucfg = config.config() # untrusted
General Comments 0
You need to be logged in to leave comments. Login now