##// END OF EJS Templates
configitems: register the 'color.pagermode' config
Boris Feld -
r33472:d0869a6e default
parent child Browse files
Show More
@@ -1,218 +1,221
1 # configitems.py - centralized declaration of configuration option
1 # configitems.py - centralized declaration of configuration option
2 #
2 #
3 # Copyright 2017 Pierre-Yves David <pierre-yves.david@octobus.net>
3 # Copyright 2017 Pierre-Yves David <pierre-yves.david@octobus.net>
4 #
4 #
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 from __future__ import absolute_import
8 from __future__ import absolute_import
9
9
10 import functools
10 import functools
11
11
12 from . import (
12 from . import (
13 error,
13 error,
14 )
14 )
15
15
16 def loadconfigtable(ui, extname, configtable):
16 def loadconfigtable(ui, extname, configtable):
17 """update config item known to the ui with the extension ones"""
17 """update config item known to the ui with the extension ones"""
18 for section, items in configtable.items():
18 for section, items in configtable.items():
19 knownitems = ui._knownconfig.setdefault(section, {})
19 knownitems = ui._knownconfig.setdefault(section, {})
20 knownkeys = set(knownitems)
20 knownkeys = set(knownitems)
21 newkeys = set(items)
21 newkeys = set(items)
22 for key in sorted(knownkeys & newkeys):
22 for key in sorted(knownkeys & newkeys):
23 msg = "extension '%s' overwrite config item '%s.%s'"
23 msg = "extension '%s' overwrite config item '%s.%s'"
24 msg %= (extname, section, key)
24 msg %= (extname, section, key)
25 ui.develwarn(msg, config='warn-config')
25 ui.develwarn(msg, config='warn-config')
26
26
27 knownitems.update(items)
27 knownitems.update(items)
28
28
29 class configitem(object):
29 class configitem(object):
30 """represent a known config item
30 """represent a known config item
31
31
32 :section: the official config section where to find this item,
32 :section: the official config section where to find this item,
33 :name: the official name within the section,
33 :name: the official name within the section,
34 :default: default value for this item,
34 :default: default value for this item,
35 :alias: optional list of tuples as alternatives.
35 :alias: optional list of tuples as alternatives.
36 """
36 """
37
37
38 def __init__(self, section, name, default=None, alias=()):
38 def __init__(self, section, name, default=None, alias=()):
39 self.section = section
39 self.section = section
40 self.name = name
40 self.name = name
41 self.default = default
41 self.default = default
42 self.alias = list(alias)
42 self.alias = list(alias)
43
43
44 coreitems = {}
44 coreitems = {}
45
45
46 def _register(configtable, *args, **kwargs):
46 def _register(configtable, *args, **kwargs):
47 item = configitem(*args, **kwargs)
47 item = configitem(*args, **kwargs)
48 section = configtable.setdefault(item.section, {})
48 section = configtable.setdefault(item.section, {})
49 if item.name in section:
49 if item.name in section:
50 msg = "duplicated config item registration for '%s.%s'"
50 msg = "duplicated config item registration for '%s.%s'"
51 raise error.ProgrammingError(msg % (item.section, item.name))
51 raise error.ProgrammingError(msg % (item.section, item.name))
52 section[item.name] = item
52 section[item.name] = item
53
53
54 # special value for case where the default is derived from other values
54 # special value for case where the default is derived from other values
55 dynamicdefault = object()
55 dynamicdefault = object()
56
56
57 # Registering actual config items
57 # Registering actual config items
58
58
59 def getitemregister(configtable):
59 def getitemregister(configtable):
60 return functools.partial(_register, configtable)
60 return functools.partial(_register, configtable)
61
61
62 coreconfigitem = getitemregister(coreitems)
62 coreconfigitem = getitemregister(coreitems)
63
63
64 coreconfigitem('auth', 'cookiefile',
64 coreconfigitem('auth', 'cookiefile',
65 default=None,
65 default=None,
66 )
66 )
67 # bookmarks.pushing: internal hack for discovery
67 # bookmarks.pushing: internal hack for discovery
68 coreconfigitem('bookmarks', 'pushing',
68 coreconfigitem('bookmarks', 'pushing',
69 default=list,
69 default=list,
70 )
70 )
71 # bundle.mainreporoot: internal hack for bundlerepo
71 # bundle.mainreporoot: internal hack for bundlerepo
72 coreconfigitem('bundle', 'mainreporoot',
72 coreconfigitem('bundle', 'mainreporoot',
73 default='',
73 default='',
74 )
74 )
75 # bundle.reorder: experimental config
75 # bundle.reorder: experimental config
76 coreconfigitem('bundle', 'reorder',
76 coreconfigitem('bundle', 'reorder',
77 default='auto',
77 default='auto',
78 )
78 )
79 coreconfigitem('color', 'mode',
79 coreconfigitem('color', 'mode',
80 default='auto',
80 default='auto',
81 )
81 )
82 coreconfigitem('color', 'pagermode',
83 default=dynamicdefault,
84 )
82 coreconfigitem('devel', 'all-warnings',
85 coreconfigitem('devel', 'all-warnings',
83 default=False,
86 default=False,
84 )
87 )
85 coreconfigitem('devel', 'bundle2.debug',
88 coreconfigitem('devel', 'bundle2.debug',
86 default=False,
89 default=False,
87 )
90 )
88 coreconfigitem('devel', 'check-locks',
91 coreconfigitem('devel', 'check-locks',
89 default=False,
92 default=False,
90 )
93 )
91 coreconfigitem('devel', 'check-relroot',
94 coreconfigitem('devel', 'check-relroot',
92 default=False,
95 default=False,
93 )
96 )
94 coreconfigitem('devel', 'disableloaddefaultcerts',
97 coreconfigitem('devel', 'disableloaddefaultcerts',
95 default=False,
98 default=False,
96 )
99 )
97 coreconfigitem('devel', 'legacy.exchange',
100 coreconfigitem('devel', 'legacy.exchange',
98 default=list,
101 default=list,
99 )
102 )
100 coreconfigitem('devel', 'servercafile',
103 coreconfigitem('devel', 'servercafile',
101 default='',
104 default='',
102 )
105 )
103 coreconfigitem('devel', 'serverexactprotocol',
106 coreconfigitem('devel', 'serverexactprotocol',
104 default='',
107 default='',
105 )
108 )
106 coreconfigitem('devel', 'serverrequirecert',
109 coreconfigitem('devel', 'serverrequirecert',
107 default=False,
110 default=False,
108 )
111 )
109 coreconfigitem('devel', 'strip-obsmarkers',
112 coreconfigitem('devel', 'strip-obsmarkers',
110 default=True,
113 default=True,
111 )
114 )
112 coreconfigitem('format', 'aggressivemergedeltas',
115 coreconfigitem('format', 'aggressivemergedeltas',
113 default=False,
116 default=False,
114 )
117 )
115 coreconfigitem('format', 'chunkcachesize',
118 coreconfigitem('format', 'chunkcachesize',
116 default=None,
119 default=None,
117 )
120 )
118 coreconfigitem('format', 'dotencode',
121 coreconfigitem('format', 'dotencode',
119 default=True,
122 default=True,
120 )
123 )
121 coreconfigitem('format', 'generaldelta',
124 coreconfigitem('format', 'generaldelta',
122 default=False,
125 default=False,
123 )
126 )
124 coreconfigitem('format', 'manifestcachesize',
127 coreconfigitem('format', 'manifestcachesize',
125 default=None,
128 default=None,
126 )
129 )
127 coreconfigitem('format', 'maxchainlen',
130 coreconfigitem('format', 'maxchainlen',
128 default=None,
131 default=None,
129 )
132 )
130 coreconfigitem('format', 'obsstore-version',
133 coreconfigitem('format', 'obsstore-version',
131 default=None,
134 default=None,
132 )
135 )
133 coreconfigitem('format', 'usefncache',
136 coreconfigitem('format', 'usefncache',
134 default=True,
137 default=True,
135 )
138 )
136 coreconfigitem('format', 'usegeneraldelta',
139 coreconfigitem('format', 'usegeneraldelta',
137 default=True,
140 default=True,
138 )
141 )
139 coreconfigitem('format', 'usestore',
142 coreconfigitem('format', 'usestore',
140 default=True,
143 default=True,
141 )
144 )
142 coreconfigitem('hostsecurity', 'ciphers',
145 coreconfigitem('hostsecurity', 'ciphers',
143 default=None,
146 default=None,
144 )
147 )
145 coreconfigitem('hostsecurity', 'disabletls10warning',
148 coreconfigitem('hostsecurity', 'disabletls10warning',
146 default=False,
149 default=False,
147 )
150 )
148 coreconfigitem('patch', 'eol',
151 coreconfigitem('patch', 'eol',
149 default='strict',
152 default='strict',
150 )
153 )
151 coreconfigitem('patch', 'fuzz',
154 coreconfigitem('patch', 'fuzz',
152 default=2,
155 default=2,
153 )
156 )
154 coreconfigitem('progress', 'assume-tty',
157 coreconfigitem('progress', 'assume-tty',
155 default=False,
158 default=False,
156 )
159 )
157 coreconfigitem('progress', 'clear-complete',
160 coreconfigitem('progress', 'clear-complete',
158 default=True,
161 default=True,
159 )
162 )
160 coreconfigitem('progress', 'estimate',
163 coreconfigitem('progress', 'estimate',
161 default=2,
164 default=2,
162 )
165 )
163 coreconfigitem('server', 'bundle1',
166 coreconfigitem('server', 'bundle1',
164 default=True,
167 default=True,
165 )
168 )
166 coreconfigitem('server', 'bundle1gd',
169 coreconfigitem('server', 'bundle1gd',
167 default=None,
170 default=None,
168 )
171 )
169 coreconfigitem('server', 'compressionengines',
172 coreconfigitem('server', 'compressionengines',
170 default=list,
173 default=list,
171 )
174 )
172 coreconfigitem('server', 'concurrent-push-mode',
175 coreconfigitem('server', 'concurrent-push-mode',
173 default='strict',
176 default='strict',
174 )
177 )
175 coreconfigitem('server', 'disablefullbundle',
178 coreconfigitem('server', 'disablefullbundle',
176 default=False,
179 default=False,
177 )
180 )
178 coreconfigitem('server', 'maxhttpheaderlen',
181 coreconfigitem('server', 'maxhttpheaderlen',
179 default=1024,
182 default=1024,
180 )
183 )
181 coreconfigitem('server', 'preferuncompressed',
184 coreconfigitem('server', 'preferuncompressed',
182 default=False,
185 default=False,
183 )
186 )
184 coreconfigitem('server', 'uncompressedallowsecret',
187 coreconfigitem('server', 'uncompressedallowsecret',
185 default=False,
188 default=False,
186 )
189 )
187 coreconfigitem('server', 'validate',
190 coreconfigitem('server', 'validate',
188 default=False,
191 default=False,
189 )
192 )
190 coreconfigitem('server', 'zliblevel',
193 coreconfigitem('server', 'zliblevel',
191 default=-1,
194 default=-1,
192 )
195 )
193 coreconfigitem('ui', 'clonebundleprefers',
196 coreconfigitem('ui', 'clonebundleprefers',
194 default=list,
197 default=list,
195 )
198 )
196 coreconfigitem('ui', 'interactive',
199 coreconfigitem('ui', 'interactive',
197 default=None,
200 default=None,
198 )
201 )
199 coreconfigitem('ui', 'quiet',
202 coreconfigitem('ui', 'quiet',
200 default=False,
203 default=False,
201 )
204 )
202 coreconfigitem('ui', 'username',
205 coreconfigitem('ui', 'username',
203 alias=[('ui', 'user')]
206 alias=[('ui', 'user')]
204 )
207 )
205 # Windows defaults to a limit of 512 open files. A buffer of 128
208 # Windows defaults to a limit of 512 open files. A buffer of 128
206 # should give us enough headway.
209 # should give us enough headway.
207 coreconfigitem('worker', 'backgroundclosemaxqueue',
210 coreconfigitem('worker', 'backgroundclosemaxqueue',
208 default=384,
211 default=384,
209 )
212 )
210 coreconfigitem('worker', 'backgroundcloseminfilecount',
213 coreconfigitem('worker', 'backgroundcloseminfilecount',
211 default=2048,
214 default=2048,
212 )
215 )
213 coreconfigitem('worker', 'backgroundclosethreadcount',
216 coreconfigitem('worker', 'backgroundclosethreadcount',
214 default=4,
217 default=4,
215 )
218 )
216 coreconfigitem('worker', 'numcpus',
219 coreconfigitem('worker', 'numcpus',
217 default=None,
220 default=None,
218 )
221 )
General Comments 0
You need to be logged in to leave comments. Login now