##// END OF EJS Templates
configitems: register the 'format.chunkcachesize' config
marmoute -
r33233:cf6c478b default
parent child Browse files
Show More
@@ -1,174 +1,177 b''
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 """
35 """
36
36
37 def __init__(self, section, name, default=None):
37 def __init__(self, section, name, default=None):
38 self.section = section
38 self.section = section
39 self.name = name
39 self.name = name
40 self.default = default
40 self.default = default
41
41
42 coreitems = {}
42 coreitems = {}
43
43
44 def _register(configtable, *args, **kwargs):
44 def _register(configtable, *args, **kwargs):
45 item = configitem(*args, **kwargs)
45 item = configitem(*args, **kwargs)
46 section = configtable.setdefault(item.section, {})
46 section = configtable.setdefault(item.section, {})
47 if item.name in section:
47 if item.name in section:
48 msg = "duplicated config item registration for '%s.%s'"
48 msg = "duplicated config item registration for '%s.%s'"
49 raise error.ProgrammingError(msg % (item.section, item.name))
49 raise error.ProgrammingError(msg % (item.section, item.name))
50 section[item.name] = item
50 section[item.name] = item
51
51
52 # Registering actual config items
52 # Registering actual config items
53
53
54 def getitemregister(configtable):
54 def getitemregister(configtable):
55 return functools.partial(_register, configtable)
55 return functools.partial(_register, configtable)
56
56
57 coreconfigitem = getitemregister(coreitems)
57 coreconfigitem = getitemregister(coreitems)
58
58
59 coreconfigitem('auth', 'cookiefile',
59 coreconfigitem('auth', 'cookiefile',
60 default=None,
60 default=None,
61 )
61 )
62 # bookmarks.pushing: internal hack for discovery
62 # bookmarks.pushing: internal hack for discovery
63 coreconfigitem('bookmarks', 'pushing',
63 coreconfigitem('bookmarks', 'pushing',
64 default=list,
64 default=list,
65 )
65 )
66 # bundle.mainreporoot: internal hack for bundlerepo
66 # bundle.mainreporoot: internal hack for bundlerepo
67 coreconfigitem('bundle', 'mainreporoot',
67 coreconfigitem('bundle', 'mainreporoot',
68 default='',
68 default='',
69 )
69 )
70 # bundle.reorder: experimental config
70 # bundle.reorder: experimental config
71 coreconfigitem('bundle', 'reorder',
71 coreconfigitem('bundle', 'reorder',
72 default='auto',
72 default='auto',
73 )
73 )
74 coreconfigitem('color', 'mode',
74 coreconfigitem('color', 'mode',
75 default='auto',
75 default='auto',
76 )
76 )
77 coreconfigitem('devel', 'all-warnings',
77 coreconfigitem('devel', 'all-warnings',
78 default=False,
78 default=False,
79 )
79 )
80 coreconfigitem('devel', 'bundle2.debug',
80 coreconfigitem('devel', 'bundle2.debug',
81 default=False,
81 default=False,
82 )
82 )
83 coreconfigitem('devel', 'check-locks',
83 coreconfigitem('devel', 'check-locks',
84 default=False,
84 default=False,
85 )
85 )
86 coreconfigitem('devel', 'check-relroot',
86 coreconfigitem('devel', 'check-relroot',
87 default=False,
87 default=False,
88 )
88 )
89 coreconfigitem('devel', 'disableloaddefaultcerts',
89 coreconfigitem('devel', 'disableloaddefaultcerts',
90 default=False,
90 default=False,
91 )
91 )
92 coreconfigitem('devel', 'legacy.exchange',
92 coreconfigitem('devel', 'legacy.exchange',
93 default=list,
93 default=list,
94 )
94 )
95 coreconfigitem('devel', 'servercafile',
95 coreconfigitem('devel', 'servercafile',
96 default='',
96 default='',
97 )
97 )
98 coreconfigitem('devel', 'serverexactprotocol',
98 coreconfigitem('devel', 'serverexactprotocol',
99 default='',
99 default='',
100 )
100 )
101 coreconfigitem('devel', 'serverrequirecert',
101 coreconfigitem('devel', 'serverrequirecert',
102 default=False,
102 default=False,
103 )
103 )
104 coreconfigitem('devel', 'strip-obsmarkers',
104 coreconfigitem('devel', 'strip-obsmarkers',
105 default=True,
105 default=True,
106 )
106 )
107 coreconfigitem('format', 'aggressivemergedeltas',
107 coreconfigitem('format', 'aggressivemergedeltas',
108 default=False,
108 default=False,
109 )
109 )
110 coreconfigitem('format', 'chunkcachesize',
111 default=None,
112 )
110 coreconfigitem('hostsecurity', 'ciphers',
113 coreconfigitem('hostsecurity', 'ciphers',
111 default=None,
114 default=None,
112 )
115 )
113 coreconfigitem('hostsecurity', 'disabletls10warning',
116 coreconfigitem('hostsecurity', 'disabletls10warning',
114 default=False,
117 default=False,
115 )
118 )
116 coreconfigitem('patch', 'eol',
119 coreconfigitem('patch', 'eol',
117 default='strict',
120 default='strict',
118 )
121 )
119 coreconfigitem('patch', 'fuzz',
122 coreconfigitem('patch', 'fuzz',
120 default=2,
123 default=2,
121 )
124 )
122 coreconfigitem('server', 'bundle1',
125 coreconfigitem('server', 'bundle1',
123 default=True,
126 default=True,
124 )
127 )
125 coreconfigitem('server', 'bundle1gd',
128 coreconfigitem('server', 'bundle1gd',
126 default=None,
129 default=None,
127 )
130 )
128 coreconfigitem('server', 'compressionengines',
131 coreconfigitem('server', 'compressionengines',
129 default=list,
132 default=list,
130 )
133 )
131 coreconfigitem('server', 'concurrent-push-mode',
134 coreconfigitem('server', 'concurrent-push-mode',
132 default='strict',
135 default='strict',
133 )
136 )
134 coreconfigitem('server', 'disablefullbundle',
137 coreconfigitem('server', 'disablefullbundle',
135 default=False,
138 default=False,
136 )
139 )
137 coreconfigitem('server', 'maxhttpheaderlen',
140 coreconfigitem('server', 'maxhttpheaderlen',
138 default=1024,
141 default=1024,
139 )
142 )
140 coreconfigitem('server', 'preferuncompressed',
143 coreconfigitem('server', 'preferuncompressed',
141 default=False,
144 default=False,
142 )
145 )
143 coreconfigitem('server', 'uncompressedallowsecret',
146 coreconfigitem('server', 'uncompressedallowsecret',
144 default=False,
147 default=False,
145 )
148 )
146 coreconfigitem('server', 'validate',
149 coreconfigitem('server', 'validate',
147 default=False,
150 default=False,
148 )
151 )
149 coreconfigitem('server', 'zliblevel',
152 coreconfigitem('server', 'zliblevel',
150 default=-1,
153 default=-1,
151 )
154 )
152 coreconfigitem('ui', 'clonebundleprefers',
155 coreconfigitem('ui', 'clonebundleprefers',
153 default=list,
156 default=list,
154 )
157 )
155 coreconfigitem('ui', 'interactive',
158 coreconfigitem('ui', 'interactive',
156 default=None,
159 default=None,
157 )
160 )
158 coreconfigitem('ui', 'quiet',
161 coreconfigitem('ui', 'quiet',
159 default=False,
162 default=False,
160 )
163 )
161 # Windows defaults to a limit of 512 open files. A buffer of 128
164 # Windows defaults to a limit of 512 open files. A buffer of 128
162 # should give us enough headway.
165 # should give us enough headway.
163 coreconfigitem('worker', 'backgroundclosemaxqueue',
166 coreconfigitem('worker', 'backgroundclosemaxqueue',
164 default=384,
167 default=384,
165 )
168 )
166 coreconfigitem('worker', 'backgroundcloseminfilecount',
169 coreconfigitem('worker', 'backgroundcloseminfilecount',
167 default=2048,
170 default=2048,
168 )
171 )
169 coreconfigitem('worker', 'backgroundclosethreadcount',
172 coreconfigitem('worker', 'backgroundclosethreadcount',
170 default=4,
173 default=4,
171 )
174 )
172 coreconfigitem('worker', 'numcpus',
175 coreconfigitem('worker', 'numcpus',
173 default=None,
176 default=None,
174 )
177 )
General Comments 0
You need to be logged in to leave comments. Login now