##// 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 from __future__ import absolute_import
8 from __future__ import absolute_import
9
9
10 from . import (
11 error,
12 )
13
10 class configitem(object):
14 class configitem(object):
11 """represent a known config item
15 """represent a known config item
12
16
@@ -19,3 +23,13 b' class configitem(object):'
19 self.section = section
23 self.section = section
20 self.name = name
24 self.name = name
21 self.default = default
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 from . import (
27 from . import (
28 color,
28 color,
29 config,
29 config,
30 configitems,
30 encoding,
31 encoding,
31 error,
32 error,
32 formatter,
33 formatter,
@@ -178,6 +179,7 b' class ui(object):'
178 self._bufferapplylabels = None
179 self._bufferapplylabels = None
179 self.quiet = self.verbose = self.debugflag = self.tracebackflag = False
180 self.quiet = self.verbose = self.debugflag = self.tracebackflag = False
180 self._reportuntrusted = True
181 self._reportuntrusted = True
182 self._knownconfig = configitems.coreitems
181 self._ocfg = config.config() # overlay
183 self._ocfg = config.config() # overlay
182 self._tcfg = config.config() # trusted
184 self._tcfg = config.config() # trusted
183 self._ucfg = config.config() # untrusted
185 self._ucfg = config.config() # untrusted
General Comments 0
You need to be logged in to leave comments. Login now