Show More
@@ -1,668 +1,665 | |||||
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 | encoding, |
|
13 | encoding, | |
14 | error, |
|
14 | error, | |
15 | ) |
|
15 | ) | |
16 |
|
16 | |||
17 | def loadconfigtable(ui, extname, configtable): |
|
17 | def loadconfigtable(ui, extname, configtable): | |
18 | """update config item known to the ui with the extension ones""" |
|
18 | """update config item known to the ui with the extension ones""" | |
19 | for section, items in configtable.items(): |
|
19 | for section, items in configtable.items(): | |
20 | knownitems = ui._knownconfig.setdefault(section, {}) |
|
20 | knownitems = ui._knownconfig.setdefault(section, {}) | |
21 | knownkeys = set(knownitems) |
|
21 | knownkeys = set(knownitems) | |
22 | newkeys = set(items) |
|
22 | newkeys = set(items) | |
23 | for key in sorted(knownkeys & newkeys): |
|
23 | for key in sorted(knownkeys & newkeys): | |
24 | msg = "extension '%s' overwrite config item '%s.%s'" |
|
24 | msg = "extension '%s' overwrite config item '%s.%s'" | |
25 | msg %= (extname, section, key) |
|
25 | msg %= (extname, section, key) | |
26 | ui.develwarn(msg, config='warn-config') |
|
26 | ui.develwarn(msg, config='warn-config') | |
27 |
|
27 | |||
28 | knownitems.update(items) |
|
28 | knownitems.update(items) | |
29 |
|
29 | |||
30 | class configitem(object): |
|
30 | class configitem(object): | |
31 | """represent a known config item |
|
31 | """represent a known config item | |
32 |
|
32 | |||
33 | :section: the official config section where to find this item, |
|
33 | :section: the official config section where to find this item, | |
34 | :name: the official name within the section, |
|
34 | :name: the official name within the section, | |
35 | :default: default value for this item, |
|
35 | :default: default value for this item, | |
36 | :alias: optional list of tuples as alternatives. |
|
36 | :alias: optional list of tuples as alternatives. | |
37 | """ |
|
37 | """ | |
38 |
|
38 | |||
39 | def __init__(self, section, name, default=None, alias=()): |
|
39 | def __init__(self, section, name, default=None, alias=()): | |
40 | self.section = section |
|
40 | self.section = section | |
41 | self.name = name |
|
41 | self.name = name | |
42 | self.default = default |
|
42 | self.default = default | |
43 | self.alias = list(alias) |
|
43 | self.alias = list(alias) | |
44 |
|
44 | |||
45 | coreitems = {} |
|
45 | coreitems = {} | |
46 |
|
46 | |||
47 | def _register(configtable, *args, **kwargs): |
|
47 | def _register(configtable, *args, **kwargs): | |
48 | item = configitem(*args, **kwargs) |
|
48 | item = configitem(*args, **kwargs) | |
49 | section = configtable.setdefault(item.section, {}) |
|
49 | section = configtable.setdefault(item.section, {}) | |
50 | if item.name in section: |
|
50 | if item.name in section: | |
51 | msg = "duplicated config item registration for '%s.%s'" |
|
51 | msg = "duplicated config item registration for '%s.%s'" | |
52 | raise error.ProgrammingError(msg % (item.section, item.name)) |
|
52 | raise error.ProgrammingError(msg % (item.section, item.name)) | |
53 | section[item.name] = item |
|
53 | section[item.name] = item | |
54 |
|
54 | |||
55 | # special value for case where the default is derived from other values |
|
55 | # special value for case where the default is derived from other values | |
56 | dynamicdefault = object() |
|
56 | dynamicdefault = object() | |
57 |
|
57 | |||
58 | # Registering actual config items |
|
58 | # Registering actual config items | |
59 |
|
59 | |||
60 | def getitemregister(configtable): |
|
60 | def getitemregister(configtable): | |
61 | return functools.partial(_register, configtable) |
|
61 | return functools.partial(_register, configtable) | |
62 |
|
62 | |||
63 | coreconfigitem = getitemregister(coreitems) |
|
63 | coreconfigitem = getitemregister(coreitems) | |
64 |
|
64 | |||
65 | coreconfigitem('auth', 'cookiefile', |
|
65 | coreconfigitem('auth', 'cookiefile', | |
66 | default=None, |
|
66 | default=None, | |
67 | ) |
|
67 | ) | |
68 | # bookmarks.pushing: internal hack for discovery |
|
68 | # bookmarks.pushing: internal hack for discovery | |
69 | coreconfigitem('bookmarks', 'pushing', |
|
69 | coreconfigitem('bookmarks', 'pushing', | |
70 | default=list, |
|
70 | default=list, | |
71 | ) |
|
71 | ) | |
72 | # bundle.mainreporoot: internal hack for bundlerepo |
|
72 | # bundle.mainreporoot: internal hack for bundlerepo | |
73 | coreconfigitem('bundle', 'mainreporoot', |
|
73 | coreconfigitem('bundle', 'mainreporoot', | |
74 | default='', |
|
74 | default='', | |
75 | ) |
|
75 | ) | |
76 | # bundle.reorder: experimental config |
|
76 | # bundle.reorder: experimental config | |
77 | coreconfigitem('bundle', 'reorder', |
|
77 | coreconfigitem('bundle', 'reorder', | |
78 | default='auto', |
|
78 | default='auto', | |
79 | ) |
|
79 | ) | |
80 | coreconfigitem('censor', 'policy', |
|
80 | coreconfigitem('censor', 'policy', | |
81 | default='abort', |
|
81 | default='abort', | |
82 | ) |
|
82 | ) | |
83 | coreconfigitem('chgserver', 'idletimeout', |
|
83 | coreconfigitem('chgserver', 'idletimeout', | |
84 | default=3600, |
|
84 | default=3600, | |
85 | ) |
|
85 | ) | |
86 | coreconfigitem('chgserver', 'skiphash', |
|
86 | coreconfigitem('chgserver', 'skiphash', | |
87 | default=False, |
|
87 | default=False, | |
88 | ) |
|
88 | ) | |
89 | coreconfigitem('cmdserver', 'log', |
|
89 | coreconfigitem('cmdserver', 'log', | |
90 | default=None, |
|
90 | default=None, | |
91 | ) |
|
91 | ) | |
92 | coreconfigitem('color', 'mode', |
|
92 | coreconfigitem('color', 'mode', | |
93 | default='auto', |
|
93 | default='auto', | |
94 | ) |
|
94 | ) | |
95 | coreconfigitem('color', 'pagermode', |
|
95 | coreconfigitem('color', 'pagermode', | |
96 | default=dynamicdefault, |
|
96 | default=dynamicdefault, | |
97 | ) |
|
97 | ) | |
98 | coreconfigitem('commands', 'status.relative', |
|
98 | coreconfigitem('commands', 'status.relative', | |
99 | default=False, |
|
99 | default=False, | |
100 | ) |
|
100 | ) | |
101 | coreconfigitem('commands', 'status.skipstates', |
|
101 | coreconfigitem('commands', 'status.skipstates', | |
102 | default=[], |
|
102 | default=[], | |
103 | ) |
|
103 | ) | |
104 | coreconfigitem('commands', 'status.verbose', |
|
104 | coreconfigitem('commands', 'status.verbose', | |
105 | default=False, |
|
105 | default=False, | |
106 | ) |
|
106 | ) | |
107 | coreconfigitem('commands', 'update.requiredest', |
|
107 | coreconfigitem('commands', 'update.requiredest', | |
108 | default=False, |
|
108 | default=False, | |
109 | ) |
|
109 | ) | |
110 | coreconfigitem('devel', 'all-warnings', |
|
110 | coreconfigitem('devel', 'all-warnings', | |
111 | default=False, |
|
111 | default=False, | |
112 | ) |
|
112 | ) | |
113 | coreconfigitem('devel', 'bundle2.debug', |
|
113 | coreconfigitem('devel', 'bundle2.debug', | |
114 | default=False, |
|
114 | default=False, | |
115 | ) |
|
115 | ) | |
116 | coreconfigitem('devel', 'check-locks', |
|
116 | coreconfigitem('devel', 'check-locks', | |
117 | default=False, |
|
117 | default=False, | |
118 | ) |
|
118 | ) | |
119 | coreconfigitem('devel', 'check-relroot', |
|
119 | coreconfigitem('devel', 'check-relroot', | |
120 | default=False, |
|
120 | default=False, | |
121 | ) |
|
121 | ) | |
122 | coreconfigitem('devel', 'default-date', |
|
122 | coreconfigitem('devel', 'default-date', | |
123 | default=None, |
|
123 | default=None, | |
124 | ) |
|
124 | ) | |
125 | coreconfigitem('devel', 'deprec-warn', |
|
125 | coreconfigitem('devel', 'deprec-warn', | |
126 | default=False, |
|
126 | default=False, | |
127 | ) |
|
127 | ) | |
128 | coreconfigitem('devel', 'disableloaddefaultcerts', |
|
128 | coreconfigitem('devel', 'disableloaddefaultcerts', | |
129 | default=False, |
|
129 | default=False, | |
130 | ) |
|
130 | ) | |
131 | coreconfigitem('devel', 'legacy.exchange', |
|
131 | coreconfigitem('devel', 'legacy.exchange', | |
132 | default=list, |
|
132 | default=list, | |
133 | ) |
|
133 | ) | |
134 | coreconfigitem('devel', 'servercafile', |
|
134 | coreconfigitem('devel', 'servercafile', | |
135 | default='', |
|
135 | default='', | |
136 | ) |
|
136 | ) | |
137 | coreconfigitem('devel', 'serverexactprotocol', |
|
137 | coreconfigitem('devel', 'serverexactprotocol', | |
138 | default='', |
|
138 | default='', | |
139 | ) |
|
139 | ) | |
140 | coreconfigitem('devel', 'serverrequirecert', |
|
140 | coreconfigitem('devel', 'serverrequirecert', | |
141 | default=False, |
|
141 | default=False, | |
142 | ) |
|
142 | ) | |
143 | coreconfigitem('devel', 'strip-obsmarkers', |
|
143 | coreconfigitem('devel', 'strip-obsmarkers', | |
144 | default=True, |
|
144 | default=True, | |
145 | ) |
|
145 | ) | |
146 | coreconfigitem('email', 'charsets', |
|
146 | coreconfigitem('email', 'charsets', | |
147 | default=list, |
|
147 | default=list, | |
148 | ) |
|
148 | ) | |
149 | coreconfigitem('email', 'method', |
|
149 | coreconfigitem('email', 'method', | |
150 | default='smtp', |
|
150 | default='smtp', | |
151 | ) |
|
151 | ) | |
152 | coreconfigitem('experimental', 'bundle-phases', |
|
152 | coreconfigitem('experimental', 'bundle-phases', | |
153 | default=False, |
|
153 | default=False, | |
154 | ) |
|
154 | ) | |
155 | coreconfigitem('experimental', 'bundle2-advertise', |
|
155 | coreconfigitem('experimental', 'bundle2-advertise', | |
156 | default=True, |
|
156 | default=True, | |
157 | ) |
|
157 | ) | |
158 | coreconfigitem('experimental', 'bundle2-output-capture', |
|
158 | coreconfigitem('experimental', 'bundle2-output-capture', | |
159 | default=False, |
|
159 | default=False, | |
160 | ) |
|
160 | ) | |
161 | coreconfigitem('experimental', 'bundle2.pushback', |
|
161 | coreconfigitem('experimental', 'bundle2.pushback', | |
162 | default=False, |
|
162 | default=False, | |
163 | ) |
|
163 | ) | |
164 | coreconfigitem('experimental', 'bundle2lazylocking', |
|
164 | coreconfigitem('experimental', 'bundle2lazylocking', | |
165 | default=False, |
|
165 | default=False, | |
166 | ) |
|
166 | ) | |
167 | coreconfigitem('experimental', 'bundlecomplevel', |
|
167 | coreconfigitem('experimental', 'bundlecomplevel', | |
168 | default=None, |
|
168 | default=None, | |
169 | ) |
|
169 | ) | |
170 | coreconfigitem('experimental', 'changegroup3', |
|
170 | coreconfigitem('experimental', 'changegroup3', | |
171 | default=False, |
|
171 | default=False, | |
172 | ) |
|
172 | ) | |
173 | coreconfigitem('experimental', 'clientcompressionengines', |
|
173 | coreconfigitem('experimental', 'clientcompressionengines', | |
174 | default=list, |
|
174 | default=list, | |
175 | ) |
|
175 | ) | |
176 | coreconfigitem('experimental', 'copytrace', |
|
176 | coreconfigitem('experimental', 'copytrace', | |
177 | default='on', |
|
177 | default='on', | |
178 | ) |
|
178 | ) | |
179 | coreconfigitem('experimental', 'copytrace.sourcecommitlimit', |
|
179 | coreconfigitem('experimental', 'copytrace.sourcecommitlimit', | |
180 | default=100, |
|
180 | default=100, | |
181 | ) |
|
181 | ) | |
182 | coreconfigitem('experimental', 'crecordtest', |
|
182 | coreconfigitem('experimental', 'crecordtest', | |
183 | default=None, |
|
183 | default=None, | |
184 | ) |
|
184 | ) | |
185 | coreconfigitem('experimental', 'editortmpinhg', |
|
185 | coreconfigitem('experimental', 'editortmpinhg', | |
186 | default=False, |
|
186 | default=False, | |
187 | ) |
|
187 | ) | |
188 | coreconfigitem('experimental', 'stabilization', |
|
188 | coreconfigitem('experimental', 'stabilization', | |
189 | default=list, |
|
189 | default=list, | |
190 | alias=[('experimental', 'evolution')], |
|
190 | alias=[('experimental', 'evolution')], | |
191 | ) |
|
191 | ) | |
192 | coreconfigitem('experimental', 'stabilization.bundle-obsmarker', |
|
192 | coreconfigitem('experimental', 'stabilization.bundle-obsmarker', | |
193 | default=False, |
|
193 | default=False, | |
194 | alias=[('experimental', 'evolution.bundle-obsmarker')], |
|
194 | alias=[('experimental', 'evolution.bundle-obsmarker')], | |
195 | ) |
|
195 | ) | |
196 | coreconfigitem('experimental', 'stabilization.track-operation', |
|
196 | coreconfigitem('experimental', 'stabilization.track-operation', | |
197 | default=True, |
|
197 | default=True, | |
198 | alias=[('experimental', 'evolution.track-operation')] |
|
198 | alias=[('experimental', 'evolution.track-operation')] | |
199 | ) |
|
199 | ) | |
200 | coreconfigitem('experimental', 'exportableenviron', |
|
200 | coreconfigitem('experimental', 'exportableenviron', | |
201 | default=list, |
|
201 | default=list, | |
202 | ) |
|
202 | ) | |
203 | coreconfigitem('experimental', 'extendedheader.index', |
|
203 | coreconfigitem('experimental', 'extendedheader.index', | |
204 | default=None, |
|
204 | default=None, | |
205 | ) |
|
205 | ) | |
206 | coreconfigitem('experimental', 'extendedheader.similarity', |
|
206 | coreconfigitem('experimental', 'extendedheader.similarity', | |
207 | default=False, |
|
207 | default=False, | |
208 | ) |
|
208 | ) | |
209 | coreconfigitem('experimental', 'format.compression', |
|
209 | coreconfigitem('experimental', 'format.compression', | |
210 | default='zlib', |
|
210 | default='zlib', | |
211 | ) |
|
211 | ) | |
212 | coreconfigitem('experimental', 'graphshorten', |
|
212 | coreconfigitem('experimental', 'graphshorten', | |
213 | default=False, |
|
213 | default=False, | |
214 | ) |
|
214 | ) | |
215 | coreconfigitem('experimental', 'hook-track-tags', |
|
215 | coreconfigitem('experimental', 'hook-track-tags', | |
216 | default=False, |
|
216 | default=False, | |
217 | ) |
|
217 | ) | |
218 | coreconfigitem('experimental', 'httppostargs', |
|
218 | coreconfigitem('experimental', 'httppostargs', | |
219 | default=False, |
|
219 | default=False, | |
220 | ) |
|
220 | ) | |
221 | coreconfigitem('experimental', 'manifestv2', |
|
221 | coreconfigitem('experimental', 'manifestv2', | |
222 | default=False, |
|
222 | default=False, | |
223 | ) |
|
223 | ) | |
224 | coreconfigitem('experimental', 'mergedriver', |
|
224 | coreconfigitem('experimental', 'mergedriver', | |
225 | default=None, |
|
225 | default=None, | |
226 | ) |
|
226 | ) | |
227 | coreconfigitem('experimental', 'obsmarkers-exchange-debug', |
|
227 | coreconfigitem('experimental', 'obsmarkers-exchange-debug', | |
228 | default=False, |
|
228 | default=False, | |
229 | ) |
|
229 | ) | |
230 | coreconfigitem('experimental', 'rebase.multidest', |
|
230 | coreconfigitem('experimental', 'rebase.multidest', | |
231 | default=False, |
|
231 | default=False, | |
232 | ) |
|
232 | ) | |
233 | coreconfigitem('experimental', 'revertalternateinteractivemode', |
|
233 | coreconfigitem('experimental', 'revertalternateinteractivemode', | |
234 | default=True, |
|
234 | default=True, | |
235 | ) |
|
235 | ) | |
236 | coreconfigitem('experimental', 'revlogv2', |
|
236 | coreconfigitem('experimental', 'revlogv2', | |
237 | default=None, |
|
237 | default=None, | |
238 | ) |
|
238 | ) | |
239 | coreconfigitem('experimental', 'spacemovesdown', |
|
239 | coreconfigitem('experimental', 'spacemovesdown', | |
240 | default=False, |
|
240 | default=False, | |
241 | ) |
|
241 | ) | |
242 | coreconfigitem('experimental', 'treemanifest', |
|
242 | coreconfigitem('experimental', 'treemanifest', | |
243 | default=False, |
|
243 | default=False, | |
244 | ) |
|
244 | ) | |
245 | coreconfigitem('experimental', 'updatecheck', |
|
245 | coreconfigitem('experimental', 'updatecheck', | |
246 | default=None, |
|
246 | default=None, | |
247 | ) |
|
247 | ) | |
248 | coreconfigitem('format', 'aggressivemergedeltas', |
|
248 | coreconfigitem('format', 'aggressivemergedeltas', | |
249 | default=False, |
|
249 | default=False, | |
250 | ) |
|
250 | ) | |
251 | coreconfigitem('format', 'chunkcachesize', |
|
251 | coreconfigitem('format', 'chunkcachesize', | |
252 | default=None, |
|
252 | default=None, | |
253 | ) |
|
253 | ) | |
254 | coreconfigitem('format', 'dotencode', |
|
254 | coreconfigitem('format', 'dotencode', | |
255 | default=True, |
|
255 | default=True, | |
256 | ) |
|
256 | ) | |
257 | coreconfigitem('format', 'generaldelta', |
|
257 | coreconfigitem('format', 'generaldelta', | |
258 | default=False, |
|
258 | default=False, | |
259 | ) |
|
259 | ) | |
260 | coreconfigitem('format', 'manifestcachesize', |
|
260 | coreconfigitem('format', 'manifestcachesize', | |
261 | default=None, |
|
261 | default=None, | |
262 | ) |
|
262 | ) | |
263 | coreconfigitem('format', 'maxchainlen', |
|
263 | coreconfigitem('format', 'maxchainlen', | |
264 | default=None, |
|
264 | default=None, | |
265 | ) |
|
265 | ) | |
266 | coreconfigitem('format', 'obsstore-version', |
|
266 | coreconfigitem('format', 'obsstore-version', | |
267 | default=None, |
|
267 | default=None, | |
268 | ) |
|
268 | ) | |
269 | coreconfigitem('format', 'usefncache', |
|
269 | coreconfigitem('format', 'usefncache', | |
270 | default=True, |
|
270 | default=True, | |
271 | ) |
|
271 | ) | |
272 | coreconfigitem('format', 'usegeneraldelta', |
|
272 | coreconfigitem('format', 'usegeneraldelta', | |
273 | default=True, |
|
273 | default=True, | |
274 | ) |
|
274 | ) | |
275 | coreconfigitem('format', 'usestore', |
|
275 | coreconfigitem('format', 'usestore', | |
276 | default=True, |
|
276 | default=True, | |
277 | ) |
|
277 | ) | |
278 | coreconfigitem('hostsecurity', 'ciphers', |
|
278 | coreconfigitem('hostsecurity', 'ciphers', | |
279 | default=None, |
|
279 | default=None, | |
280 | ) |
|
280 | ) | |
281 | coreconfigitem('hostsecurity', 'disabletls10warning', |
|
281 | coreconfigitem('hostsecurity', 'disabletls10warning', | |
282 | default=False, |
|
282 | default=False, | |
283 | ) |
|
283 | ) | |
284 | coreconfigitem('http_proxy', 'always', |
|
284 | coreconfigitem('http_proxy', 'always', | |
285 | default=False, |
|
285 | default=False, | |
286 | ) |
|
286 | ) | |
287 | coreconfigitem('http_proxy', 'host', |
|
287 | coreconfigitem('http_proxy', 'host', | |
288 | default=None, |
|
288 | default=None, | |
289 | ) |
|
289 | ) | |
290 | coreconfigitem('http_proxy', 'no', |
|
290 | coreconfigitem('http_proxy', 'no', | |
291 | default=list, |
|
291 | default=list, | |
292 | ) |
|
292 | ) | |
293 | coreconfigitem('http_proxy', 'passwd', |
|
293 | coreconfigitem('http_proxy', 'passwd', | |
294 | default=None, |
|
294 | default=None, | |
295 | ) |
|
295 | ) | |
296 | coreconfigitem('http_proxy', 'user', |
|
296 | coreconfigitem('http_proxy', 'user', | |
297 | default=None, |
|
297 | default=None, | |
298 | ) |
|
298 | ) | |
299 | coreconfigitem('merge', 'followcopies', |
|
299 | coreconfigitem('merge', 'followcopies', | |
300 | default=True, |
|
300 | default=True, | |
301 | ) |
|
301 | ) | |
302 | coreconfigitem('pager', 'ignore', |
|
302 | coreconfigitem('pager', 'ignore', | |
303 | default=list, |
|
303 | default=list, | |
304 | ) |
|
304 | ) | |
305 | coreconfigitem('patch', 'eol', |
|
305 | coreconfigitem('patch', 'eol', | |
306 | default='strict', |
|
306 | default='strict', | |
307 | ) |
|
307 | ) | |
308 | coreconfigitem('patch', 'fuzz', |
|
308 | coreconfigitem('patch', 'fuzz', | |
309 | default=2, |
|
309 | default=2, | |
310 | ) |
|
310 | ) | |
311 | coreconfigitem('paths', 'default', |
|
311 | coreconfigitem('paths', 'default', | |
312 | default=None, |
|
312 | default=None, | |
313 | ) |
|
313 | ) | |
314 | coreconfigitem('paths', 'default-push', |
|
314 | coreconfigitem('paths', 'default-push', | |
315 | default=None, |
|
315 | default=None, | |
316 | ) |
|
316 | ) | |
317 | coreconfigitem('phases', 'checksubrepos', |
|
317 | coreconfigitem('phases', 'checksubrepos', | |
318 | default='follow', |
|
318 | default='follow', | |
319 | ) |
|
319 | ) | |
320 | coreconfigitem('phases', 'publish', |
|
320 | coreconfigitem('phases', 'publish', | |
321 | default=True, |
|
321 | default=True, | |
322 | ) |
|
322 | ) | |
323 | coreconfigitem('profiling', 'enabled', |
|
323 | coreconfigitem('profiling', 'enabled', | |
324 | default=False, |
|
324 | default=False, | |
325 | ) |
|
325 | ) | |
326 | coreconfigitem('profiling', 'format', |
|
326 | coreconfigitem('profiling', 'format', | |
327 | default='text', |
|
327 | default='text', | |
328 | ) |
|
328 | ) | |
329 | coreconfigitem('profiling', 'freq', |
|
329 | coreconfigitem('profiling', 'freq', | |
330 | default=1000, |
|
330 | default=1000, | |
331 | ) |
|
331 | ) | |
332 | coreconfigitem('profiling', 'limit', |
|
332 | coreconfigitem('profiling', 'limit', | |
333 | default=30, |
|
333 | default=30, | |
334 | ) |
|
334 | ) | |
335 | coreconfigitem('profiling', 'nested', |
|
335 | coreconfigitem('profiling', 'nested', | |
336 | default=0, |
|
336 | default=0, | |
337 | ) |
|
337 | ) | |
338 | coreconfigitem('profiling', 'sort', |
|
338 | coreconfigitem('profiling', 'sort', | |
339 | default='inlinetime', |
|
339 | default='inlinetime', | |
340 | ) |
|
340 | ) | |
341 | coreconfigitem('profiling', 'statformat', |
|
341 | coreconfigitem('profiling', 'statformat', | |
342 | default='hotpath', |
|
342 | default='hotpath', | |
343 | ) |
|
343 | ) | |
344 | coreconfigitem('progress', 'assume-tty', |
|
344 | coreconfigitem('progress', 'assume-tty', | |
345 | default=False, |
|
345 | default=False, | |
346 | ) |
|
346 | ) | |
347 | coreconfigitem('progress', 'changedelay', |
|
347 | coreconfigitem('progress', 'changedelay', | |
348 | default=1, |
|
348 | default=1, | |
349 | ) |
|
349 | ) | |
350 | coreconfigitem('progress', 'clear-complete', |
|
350 | coreconfigitem('progress', 'clear-complete', | |
351 | default=True, |
|
351 | default=True, | |
352 | ) |
|
352 | ) | |
353 | coreconfigitem('progress', 'debug', |
|
353 | coreconfigitem('progress', 'debug', | |
354 | default=False, |
|
354 | default=False, | |
355 | ) |
|
355 | ) | |
356 | coreconfigitem('progress', 'delay', |
|
356 | coreconfigitem('progress', 'delay', | |
357 | default=3, |
|
357 | default=3, | |
358 | ) |
|
358 | ) | |
359 | coreconfigitem('progress', 'disable', |
|
359 | coreconfigitem('progress', 'disable', | |
360 | default=False, |
|
360 | default=False, | |
361 | ) |
|
361 | ) | |
362 | coreconfigitem('progress', 'estimate', |
|
|||
363 | default=2, |
|
|||
364 | ) |
|
|||
365 | coreconfigitem('progress', 'refresh', |
|
362 | coreconfigitem('progress', 'refresh', | |
366 | default=0.1, |
|
363 | default=0.1, | |
367 | ) |
|
364 | ) | |
368 | coreconfigitem('progress', 'width', |
|
365 | coreconfigitem('progress', 'width', | |
369 | default=dynamicdefault, |
|
366 | default=dynamicdefault, | |
370 | ) |
|
367 | ) | |
371 | coreconfigitem('push', 'pushvars.server', |
|
368 | coreconfigitem('push', 'pushvars.server', | |
372 | default=False, |
|
369 | default=False, | |
373 | ) |
|
370 | ) | |
374 | coreconfigitem('server', 'bundle1', |
|
371 | coreconfigitem('server', 'bundle1', | |
375 | default=True, |
|
372 | default=True, | |
376 | ) |
|
373 | ) | |
377 | coreconfigitem('server', 'bundle1gd', |
|
374 | coreconfigitem('server', 'bundle1gd', | |
378 | default=None, |
|
375 | default=None, | |
379 | ) |
|
376 | ) | |
380 | coreconfigitem('server', 'compressionengines', |
|
377 | coreconfigitem('server', 'compressionengines', | |
381 | default=list, |
|
378 | default=list, | |
382 | ) |
|
379 | ) | |
383 | coreconfigitem('server', 'concurrent-push-mode', |
|
380 | coreconfigitem('server', 'concurrent-push-mode', | |
384 | default='strict', |
|
381 | default='strict', | |
385 | ) |
|
382 | ) | |
386 | coreconfigitem('server', 'disablefullbundle', |
|
383 | coreconfigitem('server', 'disablefullbundle', | |
387 | default=False, |
|
384 | default=False, | |
388 | ) |
|
385 | ) | |
389 | coreconfigitem('server', 'maxhttpheaderlen', |
|
386 | coreconfigitem('server', 'maxhttpheaderlen', | |
390 | default=1024, |
|
387 | default=1024, | |
391 | ) |
|
388 | ) | |
392 | coreconfigitem('server', 'preferuncompressed', |
|
389 | coreconfigitem('server', 'preferuncompressed', | |
393 | default=False, |
|
390 | default=False, | |
394 | ) |
|
391 | ) | |
395 | coreconfigitem('server', 'uncompressed', |
|
392 | coreconfigitem('server', 'uncompressed', | |
396 | default=True, |
|
393 | default=True, | |
397 | ) |
|
394 | ) | |
398 | coreconfigitem('server', 'uncompressedallowsecret', |
|
395 | coreconfigitem('server', 'uncompressedallowsecret', | |
399 | default=False, |
|
396 | default=False, | |
400 | ) |
|
397 | ) | |
401 | coreconfigitem('server', 'validate', |
|
398 | coreconfigitem('server', 'validate', | |
402 | default=False, |
|
399 | default=False, | |
403 | ) |
|
400 | ) | |
404 | coreconfigitem('server', 'zliblevel', |
|
401 | coreconfigitem('server', 'zliblevel', | |
405 | default=-1, |
|
402 | default=-1, | |
406 | ) |
|
403 | ) | |
407 | coreconfigitem('smtp', 'host', |
|
404 | coreconfigitem('smtp', 'host', | |
408 | default=None, |
|
405 | default=None, | |
409 | ) |
|
406 | ) | |
410 | coreconfigitem('smtp', 'local_hostname', |
|
407 | coreconfigitem('smtp', 'local_hostname', | |
411 | default=None, |
|
408 | default=None, | |
412 | ) |
|
409 | ) | |
413 | coreconfigitem('smtp', 'password', |
|
410 | coreconfigitem('smtp', 'password', | |
414 | default=None, |
|
411 | default=None, | |
415 | ) |
|
412 | ) | |
416 | coreconfigitem('smtp', 'tls', |
|
413 | coreconfigitem('smtp', 'tls', | |
417 | default='none', |
|
414 | default='none', | |
418 | ) |
|
415 | ) | |
419 | coreconfigitem('smtp', 'username', |
|
416 | coreconfigitem('smtp', 'username', | |
420 | default=None, |
|
417 | default=None, | |
421 | ) |
|
418 | ) | |
422 | coreconfigitem('sparse', 'missingwarning', |
|
419 | coreconfigitem('sparse', 'missingwarning', | |
423 | default=True, |
|
420 | default=True, | |
424 | ) |
|
421 | ) | |
425 | coreconfigitem('trusted', 'groups', |
|
422 | coreconfigitem('trusted', 'groups', | |
426 | default=list, |
|
423 | default=list, | |
427 | ) |
|
424 | ) | |
428 | coreconfigitem('trusted', 'users', |
|
425 | coreconfigitem('trusted', 'users', | |
429 | default=list, |
|
426 | default=list, | |
430 | ) |
|
427 | ) | |
431 | coreconfigitem('ui', '_usedassubrepo', |
|
428 | coreconfigitem('ui', '_usedassubrepo', | |
432 | default=False, |
|
429 | default=False, | |
433 | ) |
|
430 | ) | |
434 | coreconfigitem('ui', 'allowemptycommit', |
|
431 | coreconfigitem('ui', 'allowemptycommit', | |
435 | default=False, |
|
432 | default=False, | |
436 | ) |
|
433 | ) | |
437 | coreconfigitem('ui', 'archivemeta', |
|
434 | coreconfigitem('ui', 'archivemeta', | |
438 | default=True, |
|
435 | default=True, | |
439 | ) |
|
436 | ) | |
440 | coreconfigitem('ui', 'askusername', |
|
437 | coreconfigitem('ui', 'askusername', | |
441 | default=False, |
|
438 | default=False, | |
442 | ) |
|
439 | ) | |
443 | coreconfigitem('ui', 'clonebundlefallback', |
|
440 | coreconfigitem('ui', 'clonebundlefallback', | |
444 | default=False, |
|
441 | default=False, | |
445 | ) |
|
442 | ) | |
446 | coreconfigitem('ui', 'clonebundleprefers', |
|
443 | coreconfigitem('ui', 'clonebundleprefers', | |
447 | default=list, |
|
444 | default=list, | |
448 | ) |
|
445 | ) | |
449 | coreconfigitem('ui', 'clonebundles', |
|
446 | coreconfigitem('ui', 'clonebundles', | |
450 | default=True, |
|
447 | default=True, | |
451 | ) |
|
448 | ) | |
452 | coreconfigitem('ui', 'color', |
|
449 | coreconfigitem('ui', 'color', | |
453 | default='auto', |
|
450 | default='auto', | |
454 | ) |
|
451 | ) | |
455 | coreconfigitem('ui', 'commitsubrepos', |
|
452 | coreconfigitem('ui', 'commitsubrepos', | |
456 | default=False, |
|
453 | default=False, | |
457 | ) |
|
454 | ) | |
458 | coreconfigitem('ui', 'debug', |
|
455 | coreconfigitem('ui', 'debug', | |
459 | default=False, |
|
456 | default=False, | |
460 | ) |
|
457 | ) | |
461 | coreconfigitem('ui', 'debugger', |
|
458 | coreconfigitem('ui', 'debugger', | |
462 | default=None, |
|
459 | default=None, | |
463 | ) |
|
460 | ) | |
464 | coreconfigitem('ui', 'fallbackencoding', |
|
461 | coreconfigitem('ui', 'fallbackencoding', | |
465 | default=None, |
|
462 | default=None, | |
466 | ) |
|
463 | ) | |
467 | coreconfigitem('ui', 'forcecwd', |
|
464 | coreconfigitem('ui', 'forcecwd', | |
468 | default=None, |
|
465 | default=None, | |
469 | ) |
|
466 | ) | |
470 | coreconfigitem('ui', 'forcemerge', |
|
467 | coreconfigitem('ui', 'forcemerge', | |
471 | default=None, |
|
468 | default=None, | |
472 | ) |
|
469 | ) | |
473 | coreconfigitem('ui', 'formatdebug', |
|
470 | coreconfigitem('ui', 'formatdebug', | |
474 | default=False, |
|
471 | default=False, | |
475 | ) |
|
472 | ) | |
476 | coreconfigitem('ui', 'formatjson', |
|
473 | coreconfigitem('ui', 'formatjson', | |
477 | default=False, |
|
474 | default=False, | |
478 | ) |
|
475 | ) | |
479 | coreconfigitem('ui', 'formatted', |
|
476 | coreconfigitem('ui', 'formatted', | |
480 | default=None, |
|
477 | default=None, | |
481 | ) |
|
478 | ) | |
482 | coreconfigitem('ui', 'graphnodetemplate', |
|
479 | coreconfigitem('ui', 'graphnodetemplate', | |
483 | default=None, |
|
480 | default=None, | |
484 | ) |
|
481 | ) | |
485 | coreconfigitem('ui', 'http2debuglevel', |
|
482 | coreconfigitem('ui', 'http2debuglevel', | |
486 | default=None, |
|
483 | default=None, | |
487 | ) |
|
484 | ) | |
488 | coreconfigitem('ui', 'interactive', |
|
485 | coreconfigitem('ui', 'interactive', | |
489 | default=None, |
|
486 | default=None, | |
490 | ) |
|
487 | ) | |
491 | coreconfigitem('ui', 'interface', |
|
488 | coreconfigitem('ui', 'interface', | |
492 | default=None, |
|
489 | default=None, | |
493 | ) |
|
490 | ) | |
494 | coreconfigitem('ui', 'logblockedtimes', |
|
491 | coreconfigitem('ui', 'logblockedtimes', | |
495 | default=False, |
|
492 | default=False, | |
496 | ) |
|
493 | ) | |
497 | coreconfigitem('ui', 'logtemplate', |
|
494 | coreconfigitem('ui', 'logtemplate', | |
498 | default=None, |
|
495 | default=None, | |
499 | ) |
|
496 | ) | |
500 | coreconfigitem('ui', 'merge', |
|
497 | coreconfigitem('ui', 'merge', | |
501 | default=None, |
|
498 | default=None, | |
502 | ) |
|
499 | ) | |
503 | coreconfigitem('ui', 'mergemarkers', |
|
500 | coreconfigitem('ui', 'mergemarkers', | |
504 | default='basic', |
|
501 | default='basic', | |
505 | ) |
|
502 | ) | |
506 | coreconfigitem('ui', 'mergemarkertemplate', |
|
503 | coreconfigitem('ui', 'mergemarkertemplate', | |
507 | default=('{node|short} ' |
|
504 | default=('{node|short} ' | |
508 | '{ifeq(tags, "tip", "", ' |
|
505 | '{ifeq(tags, "tip", "", ' | |
509 | 'ifeq(tags, "", "", "{tags} "))}' |
|
506 | 'ifeq(tags, "", "", "{tags} "))}' | |
510 | '{if(bookmarks, "{bookmarks} ")}' |
|
507 | '{if(bookmarks, "{bookmarks} ")}' | |
511 | '{ifeq(branch, "default", "", "{branch} ")}' |
|
508 | '{ifeq(branch, "default", "", "{branch} ")}' | |
512 | '- {author|user}: {desc|firstline}') |
|
509 | '- {author|user}: {desc|firstline}') | |
513 | ) |
|
510 | ) | |
514 | coreconfigitem('ui', 'nontty', |
|
511 | coreconfigitem('ui', 'nontty', | |
515 | default=False, |
|
512 | default=False, | |
516 | ) |
|
513 | ) | |
517 | coreconfigitem('ui', 'origbackuppath', |
|
514 | coreconfigitem('ui', 'origbackuppath', | |
518 | default=None, |
|
515 | default=None, | |
519 | ) |
|
516 | ) | |
520 | coreconfigitem('ui', 'paginate', |
|
517 | coreconfigitem('ui', 'paginate', | |
521 | default=True, |
|
518 | default=True, | |
522 | ) |
|
519 | ) | |
523 | coreconfigitem('ui', 'patch', |
|
520 | coreconfigitem('ui', 'patch', | |
524 | default=None, |
|
521 | default=None, | |
525 | ) |
|
522 | ) | |
526 | coreconfigitem('ui', 'portablefilenames', |
|
523 | coreconfigitem('ui', 'portablefilenames', | |
527 | default='warn', |
|
524 | default='warn', | |
528 | ) |
|
525 | ) | |
529 | coreconfigitem('ui', 'promptecho', |
|
526 | coreconfigitem('ui', 'promptecho', | |
530 | default=False, |
|
527 | default=False, | |
531 | ) |
|
528 | ) | |
532 | coreconfigitem('ui', 'quiet', |
|
529 | coreconfigitem('ui', 'quiet', | |
533 | default=False, |
|
530 | default=False, | |
534 | ) |
|
531 | ) | |
535 | coreconfigitem('ui', 'quietbookmarkmove', |
|
532 | coreconfigitem('ui', 'quietbookmarkmove', | |
536 | default=False, |
|
533 | default=False, | |
537 | ) |
|
534 | ) | |
538 | coreconfigitem('ui', 'remotecmd', |
|
535 | coreconfigitem('ui', 'remotecmd', | |
539 | default='hg', |
|
536 | default='hg', | |
540 | ) |
|
537 | ) | |
541 | coreconfigitem('ui', 'report_untrusted', |
|
538 | coreconfigitem('ui', 'report_untrusted', | |
542 | default=True, |
|
539 | default=True, | |
543 | ) |
|
540 | ) | |
544 | coreconfigitem('ui', 'rollback', |
|
541 | coreconfigitem('ui', 'rollback', | |
545 | default=True, |
|
542 | default=True, | |
546 | ) |
|
543 | ) | |
547 | coreconfigitem('ui', 'slash', |
|
544 | coreconfigitem('ui', 'slash', | |
548 | default=False, |
|
545 | default=False, | |
549 | ) |
|
546 | ) | |
550 | coreconfigitem('ui', 'ssh', |
|
547 | coreconfigitem('ui', 'ssh', | |
551 | default='ssh', |
|
548 | default='ssh', | |
552 | ) |
|
549 | ) | |
553 | coreconfigitem('ui', 'statuscopies', |
|
550 | coreconfigitem('ui', 'statuscopies', | |
554 | default=False, |
|
551 | default=False, | |
555 | ) |
|
552 | ) | |
556 | coreconfigitem('ui', 'strict', |
|
553 | coreconfigitem('ui', 'strict', | |
557 | default=False, |
|
554 | default=False, | |
558 | ) |
|
555 | ) | |
559 | coreconfigitem('ui', 'style', |
|
556 | coreconfigitem('ui', 'style', | |
560 | default='', |
|
557 | default='', | |
561 | ) |
|
558 | ) | |
562 | coreconfigitem('ui', 'supportcontact', |
|
559 | coreconfigitem('ui', 'supportcontact', | |
563 | default=None, |
|
560 | default=None, | |
564 | ) |
|
561 | ) | |
565 | coreconfigitem('ui', 'textwidth', |
|
562 | coreconfigitem('ui', 'textwidth', | |
566 | default=78, |
|
563 | default=78, | |
567 | ) |
|
564 | ) | |
568 | coreconfigitem('ui', 'timeout', |
|
565 | coreconfigitem('ui', 'timeout', | |
569 | default='600', |
|
566 | default='600', | |
570 | ) |
|
567 | ) | |
571 | coreconfigitem('ui', 'traceback', |
|
568 | coreconfigitem('ui', 'traceback', | |
572 | default=False, |
|
569 | default=False, | |
573 | ) |
|
570 | ) | |
574 | coreconfigitem('ui', 'tweakdefaults', |
|
571 | coreconfigitem('ui', 'tweakdefaults', | |
575 | default=False, |
|
572 | default=False, | |
576 | ) |
|
573 | ) | |
577 | coreconfigitem('ui', 'usehttp2', |
|
574 | coreconfigitem('ui', 'usehttp2', | |
578 | default=False, |
|
575 | default=False, | |
579 | ) |
|
576 | ) | |
580 | coreconfigitem('ui', 'username', |
|
577 | coreconfigitem('ui', 'username', | |
581 | alias=[('ui', 'user')] |
|
578 | alias=[('ui', 'user')] | |
582 | ) |
|
579 | ) | |
583 | coreconfigitem('ui', 'verbose', |
|
580 | coreconfigitem('ui', 'verbose', | |
584 | default=False, |
|
581 | default=False, | |
585 | ) |
|
582 | ) | |
586 | coreconfigitem('verify', 'skipflags', |
|
583 | coreconfigitem('verify', 'skipflags', | |
587 | default=None, |
|
584 | default=None, | |
588 | ) |
|
585 | ) | |
589 | coreconfigitem('web', 'accesslog', |
|
586 | coreconfigitem('web', 'accesslog', | |
590 | default='-', |
|
587 | default='-', | |
591 | ) |
|
588 | ) | |
592 | coreconfigitem('web', 'address', |
|
589 | coreconfigitem('web', 'address', | |
593 | default='', |
|
590 | default='', | |
594 | ) |
|
591 | ) | |
595 | coreconfigitem('web', 'allow_archive', |
|
592 | coreconfigitem('web', 'allow_archive', | |
596 | default=list, |
|
593 | default=list, | |
597 | ) |
|
594 | ) | |
598 | coreconfigitem('web', 'allow_read', |
|
595 | coreconfigitem('web', 'allow_read', | |
599 | default=list, |
|
596 | default=list, | |
600 | ) |
|
597 | ) | |
601 | coreconfigitem('web', 'baseurl', |
|
598 | coreconfigitem('web', 'baseurl', | |
602 | default=None, |
|
599 | default=None, | |
603 | ) |
|
600 | ) | |
604 | coreconfigitem('web', 'cacerts', |
|
601 | coreconfigitem('web', 'cacerts', | |
605 | default=None, |
|
602 | default=None, | |
606 | ) |
|
603 | ) | |
607 | coreconfigitem('web', 'certificate', |
|
604 | coreconfigitem('web', 'certificate', | |
608 | default=None, |
|
605 | default=None, | |
609 | ) |
|
606 | ) | |
610 | coreconfigitem('web', 'collapse', |
|
607 | coreconfigitem('web', 'collapse', | |
611 | default=False, |
|
608 | default=False, | |
612 | ) |
|
609 | ) | |
613 | coreconfigitem('web', 'csp', |
|
610 | coreconfigitem('web', 'csp', | |
614 | default=None, |
|
611 | default=None, | |
615 | ) |
|
612 | ) | |
616 | coreconfigitem('web', 'deny_read', |
|
613 | coreconfigitem('web', 'deny_read', | |
617 | default=list, |
|
614 | default=list, | |
618 | ) |
|
615 | ) | |
619 | coreconfigitem('web', 'descend', |
|
616 | coreconfigitem('web', 'descend', | |
620 | default=True, |
|
617 | default=True, | |
621 | ) |
|
618 | ) | |
622 | coreconfigitem('web', 'description', |
|
619 | coreconfigitem('web', 'description', | |
623 | default="", |
|
620 | default="", | |
624 | ) |
|
621 | ) | |
625 | coreconfigitem('web', 'encoding', |
|
622 | coreconfigitem('web', 'encoding', | |
626 | default=lambda: encoding.encoding, |
|
623 | default=lambda: encoding.encoding, | |
627 | ) |
|
624 | ) | |
628 | coreconfigitem('web', 'errorlog', |
|
625 | coreconfigitem('web', 'errorlog', | |
629 | default='-', |
|
626 | default='-', | |
630 | ) |
|
627 | ) | |
631 | coreconfigitem('web', 'ipv6', |
|
628 | coreconfigitem('web', 'ipv6', | |
632 | default=False, |
|
629 | default=False, | |
633 | ) |
|
630 | ) | |
634 | coreconfigitem('web', 'port', |
|
631 | coreconfigitem('web', 'port', | |
635 | default=8000, |
|
632 | default=8000, | |
636 | ) |
|
633 | ) | |
637 | coreconfigitem('web', 'prefix', |
|
634 | coreconfigitem('web', 'prefix', | |
638 | default='', |
|
635 | default='', | |
639 | ) |
|
636 | ) | |
640 | coreconfigitem('web', 'refreshinterval', |
|
637 | coreconfigitem('web', 'refreshinterval', | |
641 | default=20, |
|
638 | default=20, | |
642 | ) |
|
639 | ) | |
643 | coreconfigitem('web', 'stripes', |
|
640 | coreconfigitem('web', 'stripes', | |
644 | default=1, |
|
641 | default=1, | |
645 | ) |
|
642 | ) | |
646 | coreconfigitem('web', 'style', |
|
643 | coreconfigitem('web', 'style', | |
647 | default='paper', |
|
644 | default='paper', | |
648 | ) |
|
645 | ) | |
649 | coreconfigitem('web', 'templates', |
|
646 | coreconfigitem('web', 'templates', | |
650 | default=None, |
|
647 | default=None, | |
651 | ) |
|
648 | ) | |
652 | coreconfigitem('worker', 'backgroundclose', |
|
649 | coreconfigitem('worker', 'backgroundclose', | |
653 | default=dynamicdefault, |
|
650 | default=dynamicdefault, | |
654 | ) |
|
651 | ) | |
655 | # Windows defaults to a limit of 512 open files. A buffer of 128 |
|
652 | # Windows defaults to a limit of 512 open files. A buffer of 128 | |
656 | # should give us enough headway. |
|
653 | # should give us enough headway. | |
657 | coreconfigitem('worker', 'backgroundclosemaxqueue', |
|
654 | coreconfigitem('worker', 'backgroundclosemaxqueue', | |
658 | default=384, |
|
655 | default=384, | |
659 | ) |
|
656 | ) | |
660 | coreconfigitem('worker', 'backgroundcloseminfilecount', |
|
657 | coreconfigitem('worker', 'backgroundcloseminfilecount', | |
661 | default=2048, |
|
658 | default=2048, | |
662 | ) |
|
659 | ) | |
663 | coreconfigitem('worker', 'backgroundclosethreadcount', |
|
660 | coreconfigitem('worker', 'backgroundclosethreadcount', | |
664 | default=4, |
|
661 | default=4, | |
665 | ) |
|
662 | ) | |
666 | coreconfigitem('worker', 'numcpus', |
|
663 | coreconfigitem('worker', 'numcpus', | |
667 | default=None, |
|
664 | default=None, | |
668 | ) |
|
665 | ) |
@@ -1,280 +1,276 | |||||
1 | # progress.py progress bars related code |
|
1 | # progress.py progress bars related code | |
2 | # |
|
2 | # | |
3 | # Copyright (C) 2010 Augie Fackler <durin42@gmail.com> |
|
3 | # Copyright (C) 2010 Augie Fackler <durin42@gmail.com> | |
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 errno |
|
10 | import errno | |
11 | import threading |
|
11 | import threading | |
12 | import time |
|
12 | import time | |
13 |
|
13 | |||
14 | from .i18n import _ |
|
14 | from .i18n import _ | |
15 | from . import encoding |
|
15 | from . import encoding | |
16 |
|
16 | |||
17 | def spacejoin(*args): |
|
17 | def spacejoin(*args): | |
18 | return ' '.join(s for s in args if s) |
|
18 | return ' '.join(s for s in args if s) | |
19 |
|
19 | |||
20 | def shouldprint(ui): |
|
20 | def shouldprint(ui): | |
21 | return not (ui.quiet or ui.plain('progress')) and ( |
|
21 | return not (ui.quiet or ui.plain('progress')) and ( | |
22 | ui._isatty(ui.ferr) or ui.configbool('progress', 'assume-tty')) |
|
22 | ui._isatty(ui.ferr) or ui.configbool('progress', 'assume-tty')) | |
23 |
|
23 | |||
24 | def fmtremaining(seconds): |
|
24 | def fmtremaining(seconds): | |
25 | """format a number of remaining seconds in human readable way |
|
25 | """format a number of remaining seconds in human readable way | |
26 |
|
26 | |||
27 | This will properly display seconds, minutes, hours, days if needed""" |
|
27 | This will properly display seconds, minutes, hours, days if needed""" | |
28 | if seconds < 60: |
|
28 | if seconds < 60: | |
29 | # i18n: format XX seconds as "XXs" |
|
29 | # i18n: format XX seconds as "XXs" | |
30 | return _("%02ds") % (seconds) |
|
30 | return _("%02ds") % (seconds) | |
31 | minutes = seconds // 60 |
|
31 | minutes = seconds // 60 | |
32 | if minutes < 60: |
|
32 | if minutes < 60: | |
33 | seconds -= minutes * 60 |
|
33 | seconds -= minutes * 60 | |
34 | # i18n: format X minutes and YY seconds as "XmYYs" |
|
34 | # i18n: format X minutes and YY seconds as "XmYYs" | |
35 | return _("%dm%02ds") % (minutes, seconds) |
|
35 | return _("%dm%02ds") % (minutes, seconds) | |
36 | # we're going to ignore seconds in this case |
|
36 | # we're going to ignore seconds in this case | |
37 | minutes += 1 |
|
37 | minutes += 1 | |
38 | hours = minutes // 60 |
|
38 | hours = minutes // 60 | |
39 | minutes -= hours * 60 |
|
39 | minutes -= hours * 60 | |
40 | if hours < 30: |
|
40 | if hours < 30: | |
41 | # i18n: format X hours and YY minutes as "XhYYm" |
|
41 | # i18n: format X hours and YY minutes as "XhYYm" | |
42 | return _("%dh%02dm") % (hours, minutes) |
|
42 | return _("%dh%02dm") % (hours, minutes) | |
43 | # we're going to ignore minutes in this case |
|
43 | # we're going to ignore minutes in this case | |
44 | hours += 1 |
|
44 | hours += 1 | |
45 | days = hours // 24 |
|
45 | days = hours // 24 | |
46 | hours -= days * 24 |
|
46 | hours -= days * 24 | |
47 | if days < 15: |
|
47 | if days < 15: | |
48 | # i18n: format X days and YY hours as "XdYYh" |
|
48 | # i18n: format X days and YY hours as "XdYYh" | |
49 | return _("%dd%02dh") % (days, hours) |
|
49 | return _("%dd%02dh") % (days, hours) | |
50 | # we're going to ignore hours in this case |
|
50 | # we're going to ignore hours in this case | |
51 | days += 1 |
|
51 | days += 1 | |
52 | weeks = days // 7 |
|
52 | weeks = days // 7 | |
53 | days -= weeks * 7 |
|
53 | days -= weeks * 7 | |
54 | if weeks < 55: |
|
54 | if weeks < 55: | |
55 | # i18n: format X weeks and YY days as "XwYYd" |
|
55 | # i18n: format X weeks and YY days as "XwYYd" | |
56 | return _("%dw%02dd") % (weeks, days) |
|
56 | return _("%dw%02dd") % (weeks, days) | |
57 | # we're going to ignore days and treat a year as 52 weeks |
|
57 | # we're going to ignore days and treat a year as 52 weeks | |
58 | weeks += 1 |
|
58 | weeks += 1 | |
59 | years = weeks // 52 |
|
59 | years = weeks // 52 | |
60 | weeks -= years * 52 |
|
60 | weeks -= years * 52 | |
61 | # i18n: format X years and YY weeks as "XyYYw" |
|
61 | # i18n: format X years and YY weeks as "XyYYw" | |
62 | return _("%dy%02dw") % (years, weeks) |
|
62 | return _("%dy%02dw") % (years, weeks) | |
63 |
|
63 | |||
64 | # file_write() and file_flush() of Python 2 do not restart on EINTR if |
|
64 | # file_write() and file_flush() of Python 2 do not restart on EINTR if | |
65 | # the file is attached to a "slow" device (e.g. a terminal) and raise |
|
65 | # the file is attached to a "slow" device (e.g. a terminal) and raise | |
66 | # IOError. We cannot know how many bytes would be written by file_write(), |
|
66 | # IOError. We cannot know how many bytes would be written by file_write(), | |
67 | # but a progress text is known to be short enough to be written by a |
|
67 | # but a progress text is known to be short enough to be written by a | |
68 | # single write() syscall, so we can just retry file_write() with the whole |
|
68 | # single write() syscall, so we can just retry file_write() with the whole | |
69 | # text. (issue5532) |
|
69 | # text. (issue5532) | |
70 | # |
|
70 | # | |
71 | # This should be a short-term workaround. We'll need to fix every occurrence |
|
71 | # This should be a short-term workaround. We'll need to fix every occurrence | |
72 | # of write() to a terminal or pipe. |
|
72 | # of write() to a terminal or pipe. | |
73 | def _eintrretry(func, *args): |
|
73 | def _eintrretry(func, *args): | |
74 | while True: |
|
74 | while True: | |
75 | try: |
|
75 | try: | |
76 | return func(*args) |
|
76 | return func(*args) | |
77 | except IOError as err: |
|
77 | except IOError as err: | |
78 | if err.errno == errno.EINTR: |
|
78 | if err.errno == errno.EINTR: | |
79 | continue |
|
79 | continue | |
80 | raise |
|
80 | raise | |
81 |
|
81 | |||
82 | class progbar(object): |
|
82 | class progbar(object): | |
83 | def __init__(self, ui): |
|
83 | def __init__(self, ui): | |
84 | self.ui = ui |
|
84 | self.ui = ui | |
85 | self._refreshlock = threading.Lock() |
|
85 | self._refreshlock = threading.Lock() | |
86 | self.resetstate() |
|
86 | self.resetstate() | |
87 |
|
87 | |||
88 | def resetstate(self): |
|
88 | def resetstate(self): | |
89 | self.topics = [] |
|
89 | self.topics = [] | |
90 | self.topicstates = {} |
|
90 | self.topicstates = {} | |
91 | self.starttimes = {} |
|
91 | self.starttimes = {} | |
92 | self.startvals = {} |
|
92 | self.startvals = {} | |
93 | self.printed = False |
|
93 | self.printed = False | |
94 | self.lastprint = time.time() + float(self.ui.config( |
|
94 | self.lastprint = time.time() + float(self.ui.config( | |
95 | 'progress', 'delay')) |
|
95 | 'progress', 'delay')) | |
96 | self.curtopic = None |
|
96 | self.curtopic = None | |
97 | self.lasttopic = None |
|
97 | self.lasttopic = None | |
98 | self.indetcount = 0 |
|
98 | self.indetcount = 0 | |
99 | self.refresh = float(self.ui.config( |
|
99 | self.refresh = float(self.ui.config( | |
100 | 'progress', 'refresh')) |
|
100 | 'progress', 'refresh')) | |
101 | self.changedelay = max(3 * self.refresh, |
|
101 | self.changedelay = max(3 * self.refresh, | |
102 | float(self.ui.config( |
|
102 | float(self.ui.config( | |
103 | 'progress', 'changedelay'))) |
|
103 | 'progress', 'changedelay'))) | |
104 | self.order = self.ui.configlist( |
|
104 | self.order = self.ui.configlist( | |
105 | 'progress', 'format', |
|
105 | 'progress', 'format', | |
106 | default=['topic', 'bar', 'number', 'estimate']) |
|
106 | default=['topic', 'bar', 'number', 'estimate']) | |
107 |
|
107 | |||
108 | def show(self, now, topic, pos, item, unit, total): |
|
108 | def show(self, now, topic, pos, item, unit, total): | |
109 | if not shouldprint(self.ui): |
|
109 | if not shouldprint(self.ui): | |
110 | return |
|
110 | return | |
111 | termwidth = self.width() |
|
111 | termwidth = self.width() | |
112 | self.printed = True |
|
112 | self.printed = True | |
113 | head = '' |
|
113 | head = '' | |
114 | needprogress = False |
|
114 | needprogress = False | |
115 | tail = '' |
|
115 | tail = '' | |
116 | for indicator in self.order: |
|
116 | for indicator in self.order: | |
117 | add = '' |
|
117 | add = '' | |
118 | if indicator == 'topic': |
|
118 | if indicator == 'topic': | |
119 | add = topic |
|
119 | add = topic | |
120 | elif indicator == 'number': |
|
120 | elif indicator == 'number': | |
121 | if total: |
|
121 | if total: | |
122 | add = ('% ' + str(len(str(total))) + |
|
122 | add = ('% ' + str(len(str(total))) + | |
123 | 's/%s') % (pos, total) |
|
123 | 's/%s') % (pos, total) | |
124 | else: |
|
124 | else: | |
125 | add = str(pos) |
|
125 | add = str(pos) | |
126 | elif indicator.startswith('item') and item: |
|
126 | elif indicator.startswith('item') and item: | |
127 | slice = 'end' |
|
127 | slice = 'end' | |
128 | if '-' in indicator: |
|
128 | if '-' in indicator: | |
129 | wid = int(indicator.split('-')[1]) |
|
129 | wid = int(indicator.split('-')[1]) | |
130 | elif '+' in indicator: |
|
130 | elif '+' in indicator: | |
131 | slice = 'beginning' |
|
131 | slice = 'beginning' | |
132 | wid = int(indicator.split('+')[1]) |
|
132 | wid = int(indicator.split('+')[1]) | |
133 | else: |
|
133 | else: | |
134 | wid = 20 |
|
134 | wid = 20 | |
135 | if slice == 'end': |
|
135 | if slice == 'end': | |
136 | add = encoding.trim(item, wid, leftside=True) |
|
136 | add = encoding.trim(item, wid, leftside=True) | |
137 | else: |
|
137 | else: | |
138 | add = encoding.trim(item, wid) |
|
138 | add = encoding.trim(item, wid) | |
139 | add += (wid - encoding.colwidth(add)) * ' ' |
|
139 | add += (wid - encoding.colwidth(add)) * ' ' | |
140 | elif indicator == 'bar': |
|
140 | elif indicator == 'bar': | |
141 | add = '' |
|
141 | add = '' | |
142 | needprogress = True |
|
142 | needprogress = True | |
143 | elif indicator == 'unit' and unit: |
|
143 | elif indicator == 'unit' and unit: | |
144 | add = unit |
|
144 | add = unit | |
145 | elif indicator == 'estimate': |
|
145 | elif indicator == 'estimate': | |
146 | add = self.estimate(topic, pos, total, now) |
|
146 | add = self.estimate(topic, pos, total, now) | |
147 | elif indicator == 'speed': |
|
147 | elif indicator == 'speed': | |
148 | add = self.speed(topic, pos, unit, now) |
|
148 | add = self.speed(topic, pos, unit, now) | |
149 | if not needprogress: |
|
149 | if not needprogress: | |
150 | head = spacejoin(head, add) |
|
150 | head = spacejoin(head, add) | |
151 | else: |
|
151 | else: | |
152 | tail = spacejoin(tail, add) |
|
152 | tail = spacejoin(tail, add) | |
153 | if needprogress: |
|
153 | if needprogress: | |
154 | used = 0 |
|
154 | used = 0 | |
155 | if head: |
|
155 | if head: | |
156 | used += encoding.colwidth(head) + 1 |
|
156 | used += encoding.colwidth(head) + 1 | |
157 | if tail: |
|
157 | if tail: | |
158 | used += encoding.colwidth(tail) + 1 |
|
158 | used += encoding.colwidth(tail) + 1 | |
159 | progwidth = termwidth - used - 3 |
|
159 | progwidth = termwidth - used - 3 | |
160 | if total and pos <= total: |
|
160 | if total and pos <= total: | |
161 | amt = pos * progwidth // total |
|
161 | amt = pos * progwidth // total | |
162 | bar = '=' * (amt - 1) |
|
162 | bar = '=' * (amt - 1) | |
163 | if amt > 0: |
|
163 | if amt > 0: | |
164 | bar += '>' |
|
164 | bar += '>' | |
165 | bar += ' ' * (progwidth - amt) |
|
165 | bar += ' ' * (progwidth - amt) | |
166 | else: |
|
166 | else: | |
167 | progwidth -= 3 |
|
167 | progwidth -= 3 | |
168 | self.indetcount += 1 |
|
168 | self.indetcount += 1 | |
169 | # mod the count by twice the width so we can make the |
|
169 | # mod the count by twice the width so we can make the | |
170 | # cursor bounce between the right and left sides |
|
170 | # cursor bounce between the right and left sides | |
171 | amt = self.indetcount % (2 * progwidth) |
|
171 | amt = self.indetcount % (2 * progwidth) | |
172 | amt -= progwidth |
|
172 | amt -= progwidth | |
173 | bar = (' ' * int(progwidth - abs(amt)) + '<=>' + |
|
173 | bar = (' ' * int(progwidth - abs(amt)) + '<=>' + | |
174 | ' ' * int(abs(amt))) |
|
174 | ' ' * int(abs(amt))) | |
175 | prog = ''.join(('[', bar , ']')) |
|
175 | prog = ''.join(('[', bar , ']')) | |
176 | out = spacejoin(head, prog, tail) |
|
176 | out = spacejoin(head, prog, tail) | |
177 | else: |
|
177 | else: | |
178 | out = spacejoin(head, tail) |
|
178 | out = spacejoin(head, tail) | |
179 | self._writeerr('\r' + encoding.trim(out, termwidth)) |
|
179 | self._writeerr('\r' + encoding.trim(out, termwidth)) | |
180 | self.lasttopic = topic |
|
180 | self.lasttopic = topic | |
181 | self._flusherr() |
|
181 | self._flusherr() | |
182 |
|
182 | |||
183 | def clear(self): |
|
183 | def clear(self): | |
184 | if not self.printed or not self.lastprint or not shouldprint(self.ui): |
|
184 | if not self.printed or not self.lastprint or not shouldprint(self.ui): | |
185 | return |
|
185 | return | |
186 | self._writeerr('\r%s\r' % (' ' * self.width())) |
|
186 | self._writeerr('\r%s\r' % (' ' * self.width())) | |
187 | if self.printed: |
|
187 | if self.printed: | |
188 | # force immediate re-paint of progress bar |
|
188 | # force immediate re-paint of progress bar | |
189 | self.lastprint = 0 |
|
189 | self.lastprint = 0 | |
190 |
|
190 | |||
191 | def complete(self): |
|
191 | def complete(self): | |
192 | if not shouldprint(self.ui): |
|
192 | if not shouldprint(self.ui): | |
193 | return |
|
193 | return | |
194 | if self.ui.configbool('progress', 'clear-complete'): |
|
194 | if self.ui.configbool('progress', 'clear-complete'): | |
195 | self.clear() |
|
195 | self.clear() | |
196 | else: |
|
196 | else: | |
197 | self._writeerr('\n') |
|
197 | self._writeerr('\n') | |
198 | self._flusherr() |
|
198 | self._flusherr() | |
199 |
|
199 | |||
200 | def _flusherr(self): |
|
200 | def _flusherr(self): | |
201 | _eintrretry(self.ui.ferr.flush) |
|
201 | _eintrretry(self.ui.ferr.flush) | |
202 |
|
202 | |||
203 | def _writeerr(self, msg): |
|
203 | def _writeerr(self, msg): | |
204 | _eintrretry(self.ui.ferr.write, msg) |
|
204 | _eintrretry(self.ui.ferr.write, msg) | |
205 |
|
205 | |||
206 | def width(self): |
|
206 | def width(self): | |
207 | tw = self.ui.termwidth() |
|
207 | tw = self.ui.termwidth() | |
208 | return min(int(self.ui.config('progress', 'width', default=tw)), tw) |
|
208 | return min(int(self.ui.config('progress', 'width', default=tw)), tw) | |
209 |
|
209 | |||
210 | def estimate(self, topic, pos, total, now): |
|
210 | def estimate(self, topic, pos, total, now): | |
211 | if total is None: |
|
211 | if total is None: | |
212 | return '' |
|
212 | return '' | |
213 | initialpos = self.startvals[topic] |
|
213 | initialpos = self.startvals[topic] | |
214 | target = total - initialpos |
|
214 | target = total - initialpos | |
215 | delta = pos - initialpos |
|
215 | delta = pos - initialpos | |
216 | if delta > 0: |
|
216 | if delta > 0: | |
217 | elapsed = now - self.starttimes[topic] |
|
217 | elapsed = now - self.starttimes[topic] | |
218 | # experimental config: progress.estimate |
|
|||
219 | if elapsed > float( |
|
|||
220 | self.ui.config('progress', 'estimate')): |
|
|||
221 |
|
|
218 | seconds = (elapsed * (target - delta)) // delta + 1 | |
222 |
|
|
219 | return fmtremaining(seconds) | |
223 | return '' |
|
220 | return '' | |
224 |
|
221 | |||
225 | def speed(self, topic, pos, unit, now): |
|
222 | def speed(self, topic, pos, unit, now): | |
226 | initialpos = self.startvals[topic] |
|
223 | initialpos = self.startvals[topic] | |
227 | delta = pos - initialpos |
|
224 | delta = pos - initialpos | |
228 | elapsed = now - self.starttimes[topic] |
|
225 | elapsed = now - self.starttimes[topic] | |
229 |
if elapsed > |
|
226 | if elapsed > 0: | |
230 | self.ui.config('progress', 'estimate')): |
|
|||
231 | return _('%d %s/sec') % (delta / elapsed, unit) |
|
227 | return _('%d %s/sec') % (delta / elapsed, unit) | |
232 | return '' |
|
228 | return '' | |
233 |
|
229 | |||
234 | def _oktoprint(self, now): |
|
230 | def _oktoprint(self, now): | |
235 | '''Check if conditions are met to print - e.g. changedelay elapsed''' |
|
231 | '''Check if conditions are met to print - e.g. changedelay elapsed''' | |
236 | if (self.lasttopic is None # first time we printed |
|
232 | if (self.lasttopic is None # first time we printed | |
237 | # not a topic change |
|
233 | # not a topic change | |
238 | or self.curtopic == self.lasttopic |
|
234 | or self.curtopic == self.lasttopic | |
239 | # it's been long enough we should print anyway |
|
235 | # it's been long enough we should print anyway | |
240 | or now - self.lastprint >= self.changedelay): |
|
236 | or now - self.lastprint >= self.changedelay): | |
241 | return True |
|
237 | return True | |
242 | else: |
|
238 | else: | |
243 | return False |
|
239 | return False | |
244 |
|
240 | |||
245 | def progress(self, topic, pos, item='', unit='', total=None): |
|
241 | def progress(self, topic, pos, item='', unit='', total=None): | |
246 | now = time.time() |
|
242 | now = time.time() | |
247 | self._refreshlock.acquire() |
|
243 | self._refreshlock.acquire() | |
248 | try: |
|
244 | try: | |
249 | if pos is None: |
|
245 | if pos is None: | |
250 | self.starttimes.pop(topic, None) |
|
246 | self.starttimes.pop(topic, None) | |
251 | self.startvals.pop(topic, None) |
|
247 | self.startvals.pop(topic, None) | |
252 | self.topicstates.pop(topic, None) |
|
248 | self.topicstates.pop(topic, None) | |
253 | # reset the progress bar if this is the outermost topic |
|
249 | # reset the progress bar if this is the outermost topic | |
254 | if self.topics and self.topics[0] == topic and self.printed: |
|
250 | if self.topics and self.topics[0] == topic and self.printed: | |
255 | self.complete() |
|
251 | self.complete() | |
256 | self.resetstate() |
|
252 | self.resetstate() | |
257 | # truncate the list of topics assuming all topics within |
|
253 | # truncate the list of topics assuming all topics within | |
258 | # this one are also closed |
|
254 | # this one are also closed | |
259 | if topic in self.topics: |
|
255 | if topic in self.topics: | |
260 | self.topics = self.topics[:self.topics.index(topic)] |
|
256 | self.topics = self.topics[:self.topics.index(topic)] | |
261 | # reset the last topic to the one we just unwound to, |
|
257 | # reset the last topic to the one we just unwound to, | |
262 | # so that higher-level topics will be stickier than |
|
258 | # so that higher-level topics will be stickier than | |
263 | # lower-level topics |
|
259 | # lower-level topics | |
264 | if self.topics: |
|
260 | if self.topics: | |
265 | self.lasttopic = self.topics[-1] |
|
261 | self.lasttopic = self.topics[-1] | |
266 | else: |
|
262 | else: | |
267 | self.lasttopic = None |
|
263 | self.lasttopic = None | |
268 | else: |
|
264 | else: | |
269 | if topic not in self.topics: |
|
265 | if topic not in self.topics: | |
270 | self.starttimes[topic] = now |
|
266 | self.starttimes[topic] = now | |
271 | self.startvals[topic] = pos |
|
267 | self.startvals[topic] = pos | |
272 | self.topics.append(topic) |
|
268 | self.topics.append(topic) | |
273 | self.topicstates[topic] = pos, item, unit, total |
|
269 | self.topicstates[topic] = pos, item, unit, total | |
274 | self.curtopic = topic |
|
270 | self.curtopic = topic | |
275 | if now - self.lastprint >= self.refresh and self.topics: |
|
271 | if now - self.lastprint >= self.refresh and self.topics: | |
276 | if self._oktoprint(now): |
|
272 | if self._oktoprint(now): | |
277 | self.lastprint = now |
|
273 | self.lastprint = now | |
278 | self.show(now, topic, *self.topicstates[topic]) |
|
274 | self.show(now, topic, *self.topicstates[topic]) | |
279 | finally: |
|
275 | finally: | |
280 | self._refreshlock.release() |
|
276 | self._refreshlock.release() |
General Comments 0
You need to be logged in to leave comments.
Login now