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