##// END OF EJS Templates
extensions: ignore "sub-options" when looking for extensions...
marmoute -
r49181:c6d44457 default
parent child Browse files
Show More
@@ -1,2731 +1,2731 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 import re
11 import re
12
12
13 from . import (
13 from . import (
14 encoding,
14 encoding,
15 error,
15 error,
16 )
16 )
17
17
18
18
19 def loadconfigtable(ui, extname, configtable):
19 def loadconfigtable(ui, extname, configtable):
20 """update config item known to the ui with the extension ones"""
20 """update config item known to the ui with the extension ones"""
21 for section, items in sorted(configtable.items()):
21 for section, items in sorted(configtable.items()):
22 knownitems = ui._knownconfig.setdefault(section, itemregister())
22 knownitems = ui._knownconfig.setdefault(section, itemregister())
23 knownkeys = set(knownitems)
23 knownkeys = set(knownitems)
24 newkeys = set(items)
24 newkeys = set(items)
25 for key in sorted(knownkeys & newkeys):
25 for key in sorted(knownkeys & newkeys):
26 msg = b"extension '%s' overwrite config item '%s.%s'"
26 msg = b"extension '%s' overwrite config item '%s.%s'"
27 msg %= (extname, section, key)
27 msg %= (extname, section, key)
28 ui.develwarn(msg, config=b'warn-config')
28 ui.develwarn(msg, config=b'warn-config')
29
29
30 knownitems.update(items)
30 knownitems.update(items)
31
31
32
32
33 class configitem(object):
33 class configitem(object):
34 """represent a known config item
34 """represent a known config item
35
35
36 :section: the official config section where to find this item,
36 :section: the official config section where to find this item,
37 :name: the official name within the section,
37 :name: the official name within the section,
38 :default: default value for this item,
38 :default: default value for this item,
39 :alias: optional list of tuples as alternatives,
39 :alias: optional list of tuples as alternatives,
40 :generic: this is a generic definition, match name using regular expression.
40 :generic: this is a generic definition, match name using regular expression.
41 """
41 """
42
42
43 def __init__(
43 def __init__(
44 self,
44 self,
45 section,
45 section,
46 name,
46 name,
47 default=None,
47 default=None,
48 alias=(),
48 alias=(),
49 generic=False,
49 generic=False,
50 priority=0,
50 priority=0,
51 experimental=False,
51 experimental=False,
52 ):
52 ):
53 self.section = section
53 self.section = section
54 self.name = name
54 self.name = name
55 self.default = default
55 self.default = default
56 self.alias = list(alias)
56 self.alias = list(alias)
57 self.generic = generic
57 self.generic = generic
58 self.priority = priority
58 self.priority = priority
59 self.experimental = experimental
59 self.experimental = experimental
60 self._re = None
60 self._re = None
61 if generic:
61 if generic:
62 self._re = re.compile(self.name)
62 self._re = re.compile(self.name)
63
63
64
64
65 class itemregister(dict):
65 class itemregister(dict):
66 """A specialized dictionary that can handle wild-card selection"""
66 """A specialized dictionary that can handle wild-card selection"""
67
67
68 def __init__(self):
68 def __init__(self):
69 super(itemregister, self).__init__()
69 super(itemregister, self).__init__()
70 self._generics = set()
70 self._generics = set()
71
71
72 def update(self, other):
72 def update(self, other):
73 super(itemregister, self).update(other)
73 super(itemregister, self).update(other)
74 self._generics.update(other._generics)
74 self._generics.update(other._generics)
75
75
76 def __setitem__(self, key, item):
76 def __setitem__(self, key, item):
77 super(itemregister, self).__setitem__(key, item)
77 super(itemregister, self).__setitem__(key, item)
78 if item.generic:
78 if item.generic:
79 self._generics.add(item)
79 self._generics.add(item)
80
80
81 def get(self, key):
81 def get(self, key):
82 baseitem = super(itemregister, self).get(key)
82 baseitem = super(itemregister, self).get(key)
83 if baseitem is not None and not baseitem.generic:
83 if baseitem is not None and not baseitem.generic:
84 return baseitem
84 return baseitem
85
85
86 # search for a matching generic item
86 # search for a matching generic item
87 generics = sorted(self._generics, key=(lambda x: (x.priority, x.name)))
87 generics = sorted(self._generics, key=(lambda x: (x.priority, x.name)))
88 for item in generics:
88 for item in generics:
89 # we use 'match' instead of 'search' to make the matching simpler
89 # we use 'match' instead of 'search' to make the matching simpler
90 # for people unfamiliar with regular expression. Having the match
90 # for people unfamiliar with regular expression. Having the match
91 # rooted to the start of the string will produce less surprising
91 # rooted to the start of the string will produce less surprising
92 # result for user writing simple regex for sub-attribute.
92 # result for user writing simple regex for sub-attribute.
93 #
93 #
94 # For example using "color\..*" match produces an unsurprising
94 # For example using "color\..*" match produces an unsurprising
95 # result, while using search could suddenly match apparently
95 # result, while using search could suddenly match apparently
96 # unrelated configuration that happens to contains "color."
96 # unrelated configuration that happens to contains "color."
97 # anywhere. This is a tradeoff where we favor requiring ".*" on
97 # anywhere. This is a tradeoff where we favor requiring ".*" on
98 # some match to avoid the need to prefix most pattern with "^".
98 # some match to avoid the need to prefix most pattern with "^".
99 # The "^" seems more error prone.
99 # The "^" seems more error prone.
100 if item._re.match(key):
100 if item._re.match(key):
101 return item
101 return item
102
102
103 return None
103 return None
104
104
105
105
106 coreitems = {}
106 coreitems = {}
107
107
108
108
109 def _register(configtable, *args, **kwargs):
109 def _register(configtable, *args, **kwargs):
110 item = configitem(*args, **kwargs)
110 item = configitem(*args, **kwargs)
111 section = configtable.setdefault(item.section, itemregister())
111 section = configtable.setdefault(item.section, itemregister())
112 if item.name in section:
112 if item.name in section:
113 msg = b"duplicated config item registration for '%s.%s'"
113 msg = b"duplicated config item registration for '%s.%s'"
114 raise error.ProgrammingError(msg % (item.section, item.name))
114 raise error.ProgrammingError(msg % (item.section, item.name))
115 section[item.name] = item
115 section[item.name] = item
116
116
117
117
118 # special value for case where the default is derived from other values
118 # special value for case where the default is derived from other values
119 dynamicdefault = object()
119 dynamicdefault = object()
120
120
121 # Registering actual config items
121 # Registering actual config items
122
122
123
123
124 def getitemregister(configtable):
124 def getitemregister(configtable):
125 f = functools.partial(_register, configtable)
125 f = functools.partial(_register, configtable)
126 # export pseudo enum as configitem.*
126 # export pseudo enum as configitem.*
127 f.dynamicdefault = dynamicdefault
127 f.dynamicdefault = dynamicdefault
128 return f
128 return f
129
129
130
130
131 coreconfigitem = getitemregister(coreitems)
131 coreconfigitem = getitemregister(coreitems)
132
132
133
133
134 def _registerdiffopts(section, configprefix=b''):
134 def _registerdiffopts(section, configprefix=b''):
135 coreconfigitem(
135 coreconfigitem(
136 section,
136 section,
137 configprefix + b'nodates',
137 configprefix + b'nodates',
138 default=False,
138 default=False,
139 )
139 )
140 coreconfigitem(
140 coreconfigitem(
141 section,
141 section,
142 configprefix + b'showfunc',
142 configprefix + b'showfunc',
143 default=False,
143 default=False,
144 )
144 )
145 coreconfigitem(
145 coreconfigitem(
146 section,
146 section,
147 configprefix + b'unified',
147 configprefix + b'unified',
148 default=None,
148 default=None,
149 )
149 )
150 coreconfigitem(
150 coreconfigitem(
151 section,
151 section,
152 configprefix + b'git',
152 configprefix + b'git',
153 default=False,
153 default=False,
154 )
154 )
155 coreconfigitem(
155 coreconfigitem(
156 section,
156 section,
157 configprefix + b'ignorews',
157 configprefix + b'ignorews',
158 default=False,
158 default=False,
159 )
159 )
160 coreconfigitem(
160 coreconfigitem(
161 section,
161 section,
162 configprefix + b'ignorewsamount',
162 configprefix + b'ignorewsamount',
163 default=False,
163 default=False,
164 )
164 )
165 coreconfigitem(
165 coreconfigitem(
166 section,
166 section,
167 configprefix + b'ignoreblanklines',
167 configprefix + b'ignoreblanklines',
168 default=False,
168 default=False,
169 )
169 )
170 coreconfigitem(
170 coreconfigitem(
171 section,
171 section,
172 configprefix + b'ignorewseol',
172 configprefix + b'ignorewseol',
173 default=False,
173 default=False,
174 )
174 )
175 coreconfigitem(
175 coreconfigitem(
176 section,
176 section,
177 configprefix + b'nobinary',
177 configprefix + b'nobinary',
178 default=False,
178 default=False,
179 )
179 )
180 coreconfigitem(
180 coreconfigitem(
181 section,
181 section,
182 configprefix + b'noprefix',
182 configprefix + b'noprefix',
183 default=False,
183 default=False,
184 )
184 )
185 coreconfigitem(
185 coreconfigitem(
186 section,
186 section,
187 configprefix + b'word-diff',
187 configprefix + b'word-diff',
188 default=False,
188 default=False,
189 )
189 )
190
190
191
191
192 coreconfigitem(
192 coreconfigitem(
193 b'alias',
193 b'alias',
194 b'.*',
194 b'.*',
195 default=dynamicdefault,
195 default=dynamicdefault,
196 generic=True,
196 generic=True,
197 )
197 )
198 coreconfigitem(
198 coreconfigitem(
199 b'auth',
199 b'auth',
200 b'cookiefile',
200 b'cookiefile',
201 default=None,
201 default=None,
202 )
202 )
203 _registerdiffopts(section=b'annotate')
203 _registerdiffopts(section=b'annotate')
204 # bookmarks.pushing: internal hack for discovery
204 # bookmarks.pushing: internal hack for discovery
205 coreconfigitem(
205 coreconfigitem(
206 b'bookmarks',
206 b'bookmarks',
207 b'pushing',
207 b'pushing',
208 default=list,
208 default=list,
209 )
209 )
210 # bundle.mainreporoot: internal hack for bundlerepo
210 # bundle.mainreporoot: internal hack for bundlerepo
211 coreconfigitem(
211 coreconfigitem(
212 b'bundle',
212 b'bundle',
213 b'mainreporoot',
213 b'mainreporoot',
214 default=b'',
214 default=b'',
215 )
215 )
216 coreconfigitem(
216 coreconfigitem(
217 b'censor',
217 b'censor',
218 b'policy',
218 b'policy',
219 default=b'abort',
219 default=b'abort',
220 experimental=True,
220 experimental=True,
221 )
221 )
222 coreconfigitem(
222 coreconfigitem(
223 b'chgserver',
223 b'chgserver',
224 b'idletimeout',
224 b'idletimeout',
225 default=3600,
225 default=3600,
226 )
226 )
227 coreconfigitem(
227 coreconfigitem(
228 b'chgserver',
228 b'chgserver',
229 b'skiphash',
229 b'skiphash',
230 default=False,
230 default=False,
231 )
231 )
232 coreconfigitem(
232 coreconfigitem(
233 b'cmdserver',
233 b'cmdserver',
234 b'log',
234 b'log',
235 default=None,
235 default=None,
236 )
236 )
237 coreconfigitem(
237 coreconfigitem(
238 b'cmdserver',
238 b'cmdserver',
239 b'max-log-files',
239 b'max-log-files',
240 default=7,
240 default=7,
241 )
241 )
242 coreconfigitem(
242 coreconfigitem(
243 b'cmdserver',
243 b'cmdserver',
244 b'max-log-size',
244 b'max-log-size',
245 default=b'1 MB',
245 default=b'1 MB',
246 )
246 )
247 coreconfigitem(
247 coreconfigitem(
248 b'cmdserver',
248 b'cmdserver',
249 b'max-repo-cache',
249 b'max-repo-cache',
250 default=0,
250 default=0,
251 experimental=True,
251 experimental=True,
252 )
252 )
253 coreconfigitem(
253 coreconfigitem(
254 b'cmdserver',
254 b'cmdserver',
255 b'message-encodings',
255 b'message-encodings',
256 default=list,
256 default=list,
257 )
257 )
258 coreconfigitem(
258 coreconfigitem(
259 b'cmdserver',
259 b'cmdserver',
260 b'track-log',
260 b'track-log',
261 default=lambda: [b'chgserver', b'cmdserver', b'repocache'],
261 default=lambda: [b'chgserver', b'cmdserver', b'repocache'],
262 )
262 )
263 coreconfigitem(
263 coreconfigitem(
264 b'cmdserver',
264 b'cmdserver',
265 b'shutdown-on-interrupt',
265 b'shutdown-on-interrupt',
266 default=True,
266 default=True,
267 )
267 )
268 coreconfigitem(
268 coreconfigitem(
269 b'color',
269 b'color',
270 b'.*',
270 b'.*',
271 default=None,
271 default=None,
272 generic=True,
272 generic=True,
273 )
273 )
274 coreconfigitem(
274 coreconfigitem(
275 b'color',
275 b'color',
276 b'mode',
276 b'mode',
277 default=b'auto',
277 default=b'auto',
278 )
278 )
279 coreconfigitem(
279 coreconfigitem(
280 b'color',
280 b'color',
281 b'pagermode',
281 b'pagermode',
282 default=dynamicdefault,
282 default=dynamicdefault,
283 )
283 )
284 coreconfigitem(
284 coreconfigitem(
285 b'command-templates',
285 b'command-templates',
286 b'graphnode',
286 b'graphnode',
287 default=None,
287 default=None,
288 alias=[(b'ui', b'graphnodetemplate')],
288 alias=[(b'ui', b'graphnodetemplate')],
289 )
289 )
290 coreconfigitem(
290 coreconfigitem(
291 b'command-templates',
291 b'command-templates',
292 b'log',
292 b'log',
293 default=None,
293 default=None,
294 alias=[(b'ui', b'logtemplate')],
294 alias=[(b'ui', b'logtemplate')],
295 )
295 )
296 coreconfigitem(
296 coreconfigitem(
297 b'command-templates',
297 b'command-templates',
298 b'mergemarker',
298 b'mergemarker',
299 default=(
299 default=(
300 b'{node|short} '
300 b'{node|short} '
301 b'{ifeq(tags, "tip", "", '
301 b'{ifeq(tags, "tip", "", '
302 b'ifeq(tags, "", "", "{tags} "))}'
302 b'ifeq(tags, "", "", "{tags} "))}'
303 b'{if(bookmarks, "{bookmarks} ")}'
303 b'{if(bookmarks, "{bookmarks} ")}'
304 b'{ifeq(branch, "default", "", "{branch} ")}'
304 b'{ifeq(branch, "default", "", "{branch} ")}'
305 b'- {author|user}: {desc|firstline}'
305 b'- {author|user}: {desc|firstline}'
306 ),
306 ),
307 alias=[(b'ui', b'mergemarkertemplate')],
307 alias=[(b'ui', b'mergemarkertemplate')],
308 )
308 )
309 coreconfigitem(
309 coreconfigitem(
310 b'command-templates',
310 b'command-templates',
311 b'pre-merge-tool-output',
311 b'pre-merge-tool-output',
312 default=None,
312 default=None,
313 alias=[(b'ui', b'pre-merge-tool-output-template')],
313 alias=[(b'ui', b'pre-merge-tool-output-template')],
314 )
314 )
315 coreconfigitem(
315 coreconfigitem(
316 b'command-templates',
316 b'command-templates',
317 b'oneline-summary',
317 b'oneline-summary',
318 default=None,
318 default=None,
319 )
319 )
320 coreconfigitem(
320 coreconfigitem(
321 b'command-templates',
321 b'command-templates',
322 b'oneline-summary.*',
322 b'oneline-summary.*',
323 default=dynamicdefault,
323 default=dynamicdefault,
324 generic=True,
324 generic=True,
325 )
325 )
326 _registerdiffopts(section=b'commands', configprefix=b'commit.interactive.')
326 _registerdiffopts(section=b'commands', configprefix=b'commit.interactive.')
327 coreconfigitem(
327 coreconfigitem(
328 b'commands',
328 b'commands',
329 b'commit.post-status',
329 b'commit.post-status',
330 default=False,
330 default=False,
331 )
331 )
332 coreconfigitem(
332 coreconfigitem(
333 b'commands',
333 b'commands',
334 b'grep.all-files',
334 b'grep.all-files',
335 default=False,
335 default=False,
336 experimental=True,
336 experimental=True,
337 )
337 )
338 coreconfigitem(
338 coreconfigitem(
339 b'commands',
339 b'commands',
340 b'merge.require-rev',
340 b'merge.require-rev',
341 default=False,
341 default=False,
342 )
342 )
343 coreconfigitem(
343 coreconfigitem(
344 b'commands',
344 b'commands',
345 b'push.require-revs',
345 b'push.require-revs',
346 default=False,
346 default=False,
347 )
347 )
348 coreconfigitem(
348 coreconfigitem(
349 b'commands',
349 b'commands',
350 b'resolve.confirm',
350 b'resolve.confirm',
351 default=False,
351 default=False,
352 )
352 )
353 coreconfigitem(
353 coreconfigitem(
354 b'commands',
354 b'commands',
355 b'resolve.explicit-re-merge',
355 b'resolve.explicit-re-merge',
356 default=False,
356 default=False,
357 )
357 )
358 coreconfigitem(
358 coreconfigitem(
359 b'commands',
359 b'commands',
360 b'resolve.mark-check',
360 b'resolve.mark-check',
361 default=b'none',
361 default=b'none',
362 )
362 )
363 _registerdiffopts(section=b'commands', configprefix=b'revert.interactive.')
363 _registerdiffopts(section=b'commands', configprefix=b'revert.interactive.')
364 coreconfigitem(
364 coreconfigitem(
365 b'commands',
365 b'commands',
366 b'show.aliasprefix',
366 b'show.aliasprefix',
367 default=list,
367 default=list,
368 )
368 )
369 coreconfigitem(
369 coreconfigitem(
370 b'commands',
370 b'commands',
371 b'status.relative',
371 b'status.relative',
372 default=False,
372 default=False,
373 )
373 )
374 coreconfigitem(
374 coreconfigitem(
375 b'commands',
375 b'commands',
376 b'status.skipstates',
376 b'status.skipstates',
377 default=[],
377 default=[],
378 experimental=True,
378 experimental=True,
379 )
379 )
380 coreconfigitem(
380 coreconfigitem(
381 b'commands',
381 b'commands',
382 b'status.terse',
382 b'status.terse',
383 default=b'',
383 default=b'',
384 )
384 )
385 coreconfigitem(
385 coreconfigitem(
386 b'commands',
386 b'commands',
387 b'status.verbose',
387 b'status.verbose',
388 default=False,
388 default=False,
389 )
389 )
390 coreconfigitem(
390 coreconfigitem(
391 b'commands',
391 b'commands',
392 b'update.check',
392 b'update.check',
393 default=None,
393 default=None,
394 )
394 )
395 coreconfigitem(
395 coreconfigitem(
396 b'commands',
396 b'commands',
397 b'update.requiredest',
397 b'update.requiredest',
398 default=False,
398 default=False,
399 )
399 )
400 coreconfigitem(
400 coreconfigitem(
401 b'committemplate',
401 b'committemplate',
402 b'.*',
402 b'.*',
403 default=None,
403 default=None,
404 generic=True,
404 generic=True,
405 )
405 )
406 coreconfigitem(
406 coreconfigitem(
407 b'convert',
407 b'convert',
408 b'bzr.saverev',
408 b'bzr.saverev',
409 default=True,
409 default=True,
410 )
410 )
411 coreconfigitem(
411 coreconfigitem(
412 b'convert',
412 b'convert',
413 b'cvsps.cache',
413 b'cvsps.cache',
414 default=True,
414 default=True,
415 )
415 )
416 coreconfigitem(
416 coreconfigitem(
417 b'convert',
417 b'convert',
418 b'cvsps.fuzz',
418 b'cvsps.fuzz',
419 default=60,
419 default=60,
420 )
420 )
421 coreconfigitem(
421 coreconfigitem(
422 b'convert',
422 b'convert',
423 b'cvsps.logencoding',
423 b'cvsps.logencoding',
424 default=None,
424 default=None,
425 )
425 )
426 coreconfigitem(
426 coreconfigitem(
427 b'convert',
427 b'convert',
428 b'cvsps.mergefrom',
428 b'cvsps.mergefrom',
429 default=None,
429 default=None,
430 )
430 )
431 coreconfigitem(
431 coreconfigitem(
432 b'convert',
432 b'convert',
433 b'cvsps.mergeto',
433 b'cvsps.mergeto',
434 default=None,
434 default=None,
435 )
435 )
436 coreconfigitem(
436 coreconfigitem(
437 b'convert',
437 b'convert',
438 b'git.committeractions',
438 b'git.committeractions',
439 default=lambda: [b'messagedifferent'],
439 default=lambda: [b'messagedifferent'],
440 )
440 )
441 coreconfigitem(
441 coreconfigitem(
442 b'convert',
442 b'convert',
443 b'git.extrakeys',
443 b'git.extrakeys',
444 default=list,
444 default=list,
445 )
445 )
446 coreconfigitem(
446 coreconfigitem(
447 b'convert',
447 b'convert',
448 b'git.findcopiesharder',
448 b'git.findcopiesharder',
449 default=False,
449 default=False,
450 )
450 )
451 coreconfigitem(
451 coreconfigitem(
452 b'convert',
452 b'convert',
453 b'git.remoteprefix',
453 b'git.remoteprefix',
454 default=b'remote',
454 default=b'remote',
455 )
455 )
456 coreconfigitem(
456 coreconfigitem(
457 b'convert',
457 b'convert',
458 b'git.renamelimit',
458 b'git.renamelimit',
459 default=400,
459 default=400,
460 )
460 )
461 coreconfigitem(
461 coreconfigitem(
462 b'convert',
462 b'convert',
463 b'git.saverev',
463 b'git.saverev',
464 default=True,
464 default=True,
465 )
465 )
466 coreconfigitem(
466 coreconfigitem(
467 b'convert',
467 b'convert',
468 b'git.similarity',
468 b'git.similarity',
469 default=50,
469 default=50,
470 )
470 )
471 coreconfigitem(
471 coreconfigitem(
472 b'convert',
472 b'convert',
473 b'git.skipsubmodules',
473 b'git.skipsubmodules',
474 default=False,
474 default=False,
475 )
475 )
476 coreconfigitem(
476 coreconfigitem(
477 b'convert',
477 b'convert',
478 b'hg.clonebranches',
478 b'hg.clonebranches',
479 default=False,
479 default=False,
480 )
480 )
481 coreconfigitem(
481 coreconfigitem(
482 b'convert',
482 b'convert',
483 b'hg.ignoreerrors',
483 b'hg.ignoreerrors',
484 default=False,
484 default=False,
485 )
485 )
486 coreconfigitem(
486 coreconfigitem(
487 b'convert',
487 b'convert',
488 b'hg.preserve-hash',
488 b'hg.preserve-hash',
489 default=False,
489 default=False,
490 )
490 )
491 coreconfigitem(
491 coreconfigitem(
492 b'convert',
492 b'convert',
493 b'hg.revs',
493 b'hg.revs',
494 default=None,
494 default=None,
495 )
495 )
496 coreconfigitem(
496 coreconfigitem(
497 b'convert',
497 b'convert',
498 b'hg.saverev',
498 b'hg.saverev',
499 default=False,
499 default=False,
500 )
500 )
501 coreconfigitem(
501 coreconfigitem(
502 b'convert',
502 b'convert',
503 b'hg.sourcename',
503 b'hg.sourcename',
504 default=None,
504 default=None,
505 )
505 )
506 coreconfigitem(
506 coreconfigitem(
507 b'convert',
507 b'convert',
508 b'hg.startrev',
508 b'hg.startrev',
509 default=None,
509 default=None,
510 )
510 )
511 coreconfigitem(
511 coreconfigitem(
512 b'convert',
512 b'convert',
513 b'hg.tagsbranch',
513 b'hg.tagsbranch',
514 default=b'default',
514 default=b'default',
515 )
515 )
516 coreconfigitem(
516 coreconfigitem(
517 b'convert',
517 b'convert',
518 b'hg.usebranchnames',
518 b'hg.usebranchnames',
519 default=True,
519 default=True,
520 )
520 )
521 coreconfigitem(
521 coreconfigitem(
522 b'convert',
522 b'convert',
523 b'ignoreancestorcheck',
523 b'ignoreancestorcheck',
524 default=False,
524 default=False,
525 experimental=True,
525 experimental=True,
526 )
526 )
527 coreconfigitem(
527 coreconfigitem(
528 b'convert',
528 b'convert',
529 b'localtimezone',
529 b'localtimezone',
530 default=False,
530 default=False,
531 )
531 )
532 coreconfigitem(
532 coreconfigitem(
533 b'convert',
533 b'convert',
534 b'p4.encoding',
534 b'p4.encoding',
535 default=dynamicdefault,
535 default=dynamicdefault,
536 )
536 )
537 coreconfigitem(
537 coreconfigitem(
538 b'convert',
538 b'convert',
539 b'p4.startrev',
539 b'p4.startrev',
540 default=0,
540 default=0,
541 )
541 )
542 coreconfigitem(
542 coreconfigitem(
543 b'convert',
543 b'convert',
544 b'skiptags',
544 b'skiptags',
545 default=False,
545 default=False,
546 )
546 )
547 coreconfigitem(
547 coreconfigitem(
548 b'convert',
548 b'convert',
549 b'svn.debugsvnlog',
549 b'svn.debugsvnlog',
550 default=True,
550 default=True,
551 )
551 )
552 coreconfigitem(
552 coreconfigitem(
553 b'convert',
553 b'convert',
554 b'svn.trunk',
554 b'svn.trunk',
555 default=None,
555 default=None,
556 )
556 )
557 coreconfigitem(
557 coreconfigitem(
558 b'convert',
558 b'convert',
559 b'svn.tags',
559 b'svn.tags',
560 default=None,
560 default=None,
561 )
561 )
562 coreconfigitem(
562 coreconfigitem(
563 b'convert',
563 b'convert',
564 b'svn.branches',
564 b'svn.branches',
565 default=None,
565 default=None,
566 )
566 )
567 coreconfigitem(
567 coreconfigitem(
568 b'convert',
568 b'convert',
569 b'svn.startrev',
569 b'svn.startrev',
570 default=0,
570 default=0,
571 )
571 )
572 coreconfigitem(
572 coreconfigitem(
573 b'convert',
573 b'convert',
574 b'svn.dangerous-set-commit-dates',
574 b'svn.dangerous-set-commit-dates',
575 default=False,
575 default=False,
576 )
576 )
577 coreconfigitem(
577 coreconfigitem(
578 b'debug',
578 b'debug',
579 b'dirstate.delaywrite',
579 b'dirstate.delaywrite',
580 default=0,
580 default=0,
581 )
581 )
582 coreconfigitem(
582 coreconfigitem(
583 b'debug',
583 b'debug',
584 b'revlog.verifyposition.changelog',
584 b'revlog.verifyposition.changelog',
585 default=b'',
585 default=b'',
586 )
586 )
587 coreconfigitem(
587 coreconfigitem(
588 b'defaults',
588 b'defaults',
589 b'.*',
589 b'.*',
590 default=None,
590 default=None,
591 generic=True,
591 generic=True,
592 )
592 )
593 coreconfigitem(
593 coreconfigitem(
594 b'devel',
594 b'devel',
595 b'all-warnings',
595 b'all-warnings',
596 default=False,
596 default=False,
597 )
597 )
598 coreconfigitem(
598 coreconfigitem(
599 b'devel',
599 b'devel',
600 b'bundle2.debug',
600 b'bundle2.debug',
601 default=False,
601 default=False,
602 )
602 )
603 coreconfigitem(
603 coreconfigitem(
604 b'devel',
604 b'devel',
605 b'bundle.delta',
605 b'bundle.delta',
606 default=b'',
606 default=b'',
607 )
607 )
608 coreconfigitem(
608 coreconfigitem(
609 b'devel',
609 b'devel',
610 b'cache-vfs',
610 b'cache-vfs',
611 default=None,
611 default=None,
612 )
612 )
613 coreconfigitem(
613 coreconfigitem(
614 b'devel',
614 b'devel',
615 b'check-locks',
615 b'check-locks',
616 default=False,
616 default=False,
617 )
617 )
618 coreconfigitem(
618 coreconfigitem(
619 b'devel',
619 b'devel',
620 b'check-relroot',
620 b'check-relroot',
621 default=False,
621 default=False,
622 )
622 )
623 # Track copy information for all file, not just "added" one (very slow)
623 # Track copy information for all file, not just "added" one (very slow)
624 coreconfigitem(
624 coreconfigitem(
625 b'devel',
625 b'devel',
626 b'copy-tracing.trace-all-files',
626 b'copy-tracing.trace-all-files',
627 default=False,
627 default=False,
628 )
628 )
629 coreconfigitem(
629 coreconfigitem(
630 b'devel',
630 b'devel',
631 b'default-date',
631 b'default-date',
632 default=None,
632 default=None,
633 )
633 )
634 coreconfigitem(
634 coreconfigitem(
635 b'devel',
635 b'devel',
636 b'deprec-warn',
636 b'deprec-warn',
637 default=False,
637 default=False,
638 )
638 )
639 coreconfigitem(
639 coreconfigitem(
640 b'devel',
640 b'devel',
641 b'disableloaddefaultcerts',
641 b'disableloaddefaultcerts',
642 default=False,
642 default=False,
643 )
643 )
644 coreconfigitem(
644 coreconfigitem(
645 b'devel',
645 b'devel',
646 b'warn-empty-changegroup',
646 b'warn-empty-changegroup',
647 default=False,
647 default=False,
648 )
648 )
649 coreconfigitem(
649 coreconfigitem(
650 b'devel',
650 b'devel',
651 b'legacy.exchange',
651 b'legacy.exchange',
652 default=list,
652 default=list,
653 )
653 )
654 # When True, revlogs use a special reference version of the nodemap, that is not
654 # When True, revlogs use a special reference version of the nodemap, that is not
655 # performant but is "known" to behave properly.
655 # performant but is "known" to behave properly.
656 coreconfigitem(
656 coreconfigitem(
657 b'devel',
657 b'devel',
658 b'persistent-nodemap',
658 b'persistent-nodemap',
659 default=False,
659 default=False,
660 )
660 )
661 coreconfigitem(
661 coreconfigitem(
662 b'devel',
662 b'devel',
663 b'servercafile',
663 b'servercafile',
664 default=b'',
664 default=b'',
665 )
665 )
666 coreconfigitem(
666 coreconfigitem(
667 b'devel',
667 b'devel',
668 b'serverexactprotocol',
668 b'serverexactprotocol',
669 default=b'',
669 default=b'',
670 )
670 )
671 coreconfigitem(
671 coreconfigitem(
672 b'devel',
672 b'devel',
673 b'serverrequirecert',
673 b'serverrequirecert',
674 default=False,
674 default=False,
675 )
675 )
676 coreconfigitem(
676 coreconfigitem(
677 b'devel',
677 b'devel',
678 b'strip-obsmarkers',
678 b'strip-obsmarkers',
679 default=True,
679 default=True,
680 )
680 )
681 coreconfigitem(
681 coreconfigitem(
682 b'devel',
682 b'devel',
683 b'warn-config',
683 b'warn-config',
684 default=None,
684 default=None,
685 )
685 )
686 coreconfigitem(
686 coreconfigitem(
687 b'devel',
687 b'devel',
688 b'warn-config-default',
688 b'warn-config-default',
689 default=None,
689 default=None,
690 )
690 )
691 coreconfigitem(
691 coreconfigitem(
692 b'devel',
692 b'devel',
693 b'user.obsmarker',
693 b'user.obsmarker',
694 default=None,
694 default=None,
695 )
695 )
696 coreconfigitem(
696 coreconfigitem(
697 b'devel',
697 b'devel',
698 b'warn-config-unknown',
698 b'warn-config-unknown',
699 default=None,
699 default=None,
700 )
700 )
701 coreconfigitem(
701 coreconfigitem(
702 b'devel',
702 b'devel',
703 b'debug.copies',
703 b'debug.copies',
704 default=False,
704 default=False,
705 )
705 )
706 coreconfigitem(
706 coreconfigitem(
707 b'devel',
707 b'devel',
708 b'copy-tracing.multi-thread',
708 b'copy-tracing.multi-thread',
709 default=True,
709 default=True,
710 )
710 )
711 coreconfigitem(
711 coreconfigitem(
712 b'devel',
712 b'devel',
713 b'debug.extensions',
713 b'debug.extensions',
714 default=False,
714 default=False,
715 )
715 )
716 coreconfigitem(
716 coreconfigitem(
717 b'devel',
717 b'devel',
718 b'debug.repo-filters',
718 b'debug.repo-filters',
719 default=False,
719 default=False,
720 )
720 )
721 coreconfigitem(
721 coreconfigitem(
722 b'devel',
722 b'devel',
723 b'debug.peer-request',
723 b'debug.peer-request',
724 default=False,
724 default=False,
725 )
725 )
726 # If discovery.exchange-heads is False, the discovery will not start with
726 # If discovery.exchange-heads is False, the discovery will not start with
727 # remote head fetching and local head querying.
727 # remote head fetching and local head querying.
728 coreconfigitem(
728 coreconfigitem(
729 b'devel',
729 b'devel',
730 b'discovery.exchange-heads',
730 b'discovery.exchange-heads',
731 default=True,
731 default=True,
732 )
732 )
733 # If discovery.grow-sample is False, the sample size used in set discovery will
733 # If discovery.grow-sample is False, the sample size used in set discovery will
734 # not be increased through the process
734 # not be increased through the process
735 coreconfigitem(
735 coreconfigitem(
736 b'devel',
736 b'devel',
737 b'discovery.grow-sample',
737 b'discovery.grow-sample',
738 default=True,
738 default=True,
739 )
739 )
740 # When discovery.grow-sample.dynamic is True, the default, the sample size is
740 # When discovery.grow-sample.dynamic is True, the default, the sample size is
741 # adapted to the shape of the undecided set (it is set to the max of:
741 # adapted to the shape of the undecided set (it is set to the max of:
742 # <target-size>, len(roots(undecided)), len(heads(undecided)
742 # <target-size>, len(roots(undecided)), len(heads(undecided)
743 coreconfigitem(
743 coreconfigitem(
744 b'devel',
744 b'devel',
745 b'discovery.grow-sample.dynamic',
745 b'discovery.grow-sample.dynamic',
746 default=True,
746 default=True,
747 )
747 )
748 # discovery.grow-sample.rate control the rate at which the sample grow
748 # discovery.grow-sample.rate control the rate at which the sample grow
749 coreconfigitem(
749 coreconfigitem(
750 b'devel',
750 b'devel',
751 b'discovery.grow-sample.rate',
751 b'discovery.grow-sample.rate',
752 default=1.05,
752 default=1.05,
753 )
753 )
754 # If discovery.randomize is False, random sampling during discovery are
754 # If discovery.randomize is False, random sampling during discovery are
755 # deterministic. It is meant for integration tests.
755 # deterministic. It is meant for integration tests.
756 coreconfigitem(
756 coreconfigitem(
757 b'devel',
757 b'devel',
758 b'discovery.randomize',
758 b'discovery.randomize',
759 default=True,
759 default=True,
760 )
760 )
761 # Control the initial size of the discovery sample
761 # Control the initial size of the discovery sample
762 coreconfigitem(
762 coreconfigitem(
763 b'devel',
763 b'devel',
764 b'discovery.sample-size',
764 b'discovery.sample-size',
765 default=200,
765 default=200,
766 )
766 )
767 # Control the initial size of the discovery for initial change
767 # Control the initial size of the discovery for initial change
768 coreconfigitem(
768 coreconfigitem(
769 b'devel',
769 b'devel',
770 b'discovery.sample-size.initial',
770 b'discovery.sample-size.initial',
771 default=100,
771 default=100,
772 )
772 )
773 _registerdiffopts(section=b'diff')
773 _registerdiffopts(section=b'diff')
774 coreconfigitem(
774 coreconfigitem(
775 b'diff',
775 b'diff',
776 b'merge',
776 b'merge',
777 default=False,
777 default=False,
778 experimental=True,
778 experimental=True,
779 )
779 )
780 coreconfigitem(
780 coreconfigitem(
781 b'email',
781 b'email',
782 b'bcc',
782 b'bcc',
783 default=None,
783 default=None,
784 )
784 )
785 coreconfigitem(
785 coreconfigitem(
786 b'email',
786 b'email',
787 b'cc',
787 b'cc',
788 default=None,
788 default=None,
789 )
789 )
790 coreconfigitem(
790 coreconfigitem(
791 b'email',
791 b'email',
792 b'charsets',
792 b'charsets',
793 default=list,
793 default=list,
794 )
794 )
795 coreconfigitem(
795 coreconfigitem(
796 b'email',
796 b'email',
797 b'from',
797 b'from',
798 default=None,
798 default=None,
799 )
799 )
800 coreconfigitem(
800 coreconfigitem(
801 b'email',
801 b'email',
802 b'method',
802 b'method',
803 default=b'smtp',
803 default=b'smtp',
804 )
804 )
805 coreconfigitem(
805 coreconfigitem(
806 b'email',
806 b'email',
807 b'reply-to',
807 b'reply-to',
808 default=None,
808 default=None,
809 )
809 )
810 coreconfigitem(
810 coreconfigitem(
811 b'email',
811 b'email',
812 b'to',
812 b'to',
813 default=None,
813 default=None,
814 )
814 )
815 coreconfigitem(
815 coreconfigitem(
816 b'experimental',
816 b'experimental',
817 b'archivemetatemplate',
817 b'archivemetatemplate',
818 default=dynamicdefault,
818 default=dynamicdefault,
819 )
819 )
820 coreconfigitem(
820 coreconfigitem(
821 b'experimental',
821 b'experimental',
822 b'auto-publish',
822 b'auto-publish',
823 default=b'publish',
823 default=b'publish',
824 )
824 )
825 coreconfigitem(
825 coreconfigitem(
826 b'experimental',
826 b'experimental',
827 b'bundle-phases',
827 b'bundle-phases',
828 default=False,
828 default=False,
829 )
829 )
830 coreconfigitem(
830 coreconfigitem(
831 b'experimental',
831 b'experimental',
832 b'bundle2-advertise',
832 b'bundle2-advertise',
833 default=True,
833 default=True,
834 )
834 )
835 coreconfigitem(
835 coreconfigitem(
836 b'experimental',
836 b'experimental',
837 b'bundle2-output-capture',
837 b'bundle2-output-capture',
838 default=False,
838 default=False,
839 )
839 )
840 coreconfigitem(
840 coreconfigitem(
841 b'experimental',
841 b'experimental',
842 b'bundle2.pushback',
842 b'bundle2.pushback',
843 default=False,
843 default=False,
844 )
844 )
845 coreconfigitem(
845 coreconfigitem(
846 b'experimental',
846 b'experimental',
847 b'bundle2lazylocking',
847 b'bundle2lazylocking',
848 default=False,
848 default=False,
849 )
849 )
850 coreconfigitem(
850 coreconfigitem(
851 b'experimental',
851 b'experimental',
852 b'bundlecomplevel',
852 b'bundlecomplevel',
853 default=None,
853 default=None,
854 )
854 )
855 coreconfigitem(
855 coreconfigitem(
856 b'experimental',
856 b'experimental',
857 b'bundlecomplevel.bzip2',
857 b'bundlecomplevel.bzip2',
858 default=None,
858 default=None,
859 )
859 )
860 coreconfigitem(
860 coreconfigitem(
861 b'experimental',
861 b'experimental',
862 b'bundlecomplevel.gzip',
862 b'bundlecomplevel.gzip',
863 default=None,
863 default=None,
864 )
864 )
865 coreconfigitem(
865 coreconfigitem(
866 b'experimental',
866 b'experimental',
867 b'bundlecomplevel.none',
867 b'bundlecomplevel.none',
868 default=None,
868 default=None,
869 )
869 )
870 coreconfigitem(
870 coreconfigitem(
871 b'experimental',
871 b'experimental',
872 b'bundlecomplevel.zstd',
872 b'bundlecomplevel.zstd',
873 default=None,
873 default=None,
874 )
874 )
875 coreconfigitem(
875 coreconfigitem(
876 b'experimental',
876 b'experimental',
877 b'bundlecompthreads',
877 b'bundlecompthreads',
878 default=None,
878 default=None,
879 )
879 )
880 coreconfigitem(
880 coreconfigitem(
881 b'experimental',
881 b'experimental',
882 b'bundlecompthreads.bzip2',
882 b'bundlecompthreads.bzip2',
883 default=None,
883 default=None,
884 )
884 )
885 coreconfigitem(
885 coreconfigitem(
886 b'experimental',
886 b'experimental',
887 b'bundlecompthreads.gzip',
887 b'bundlecompthreads.gzip',
888 default=None,
888 default=None,
889 )
889 )
890 coreconfigitem(
890 coreconfigitem(
891 b'experimental',
891 b'experimental',
892 b'bundlecompthreads.none',
892 b'bundlecompthreads.none',
893 default=None,
893 default=None,
894 )
894 )
895 coreconfigitem(
895 coreconfigitem(
896 b'experimental',
896 b'experimental',
897 b'bundlecompthreads.zstd',
897 b'bundlecompthreads.zstd',
898 default=None,
898 default=None,
899 )
899 )
900 coreconfigitem(
900 coreconfigitem(
901 b'experimental',
901 b'experimental',
902 b'changegroup3',
902 b'changegroup3',
903 default=False,
903 default=False,
904 )
904 )
905 coreconfigitem(
905 coreconfigitem(
906 b'experimental',
906 b'experimental',
907 b'changegroup4',
907 b'changegroup4',
908 default=False,
908 default=False,
909 )
909 )
910 coreconfigitem(
910 coreconfigitem(
911 b'experimental',
911 b'experimental',
912 b'cleanup-as-archived',
912 b'cleanup-as-archived',
913 default=False,
913 default=False,
914 )
914 )
915 coreconfigitem(
915 coreconfigitem(
916 b'experimental',
916 b'experimental',
917 b'clientcompressionengines',
917 b'clientcompressionengines',
918 default=list,
918 default=list,
919 )
919 )
920 coreconfigitem(
920 coreconfigitem(
921 b'experimental',
921 b'experimental',
922 b'copytrace',
922 b'copytrace',
923 default=b'on',
923 default=b'on',
924 )
924 )
925 coreconfigitem(
925 coreconfigitem(
926 b'experimental',
926 b'experimental',
927 b'copytrace.movecandidateslimit',
927 b'copytrace.movecandidateslimit',
928 default=100,
928 default=100,
929 )
929 )
930 coreconfigitem(
930 coreconfigitem(
931 b'experimental',
931 b'experimental',
932 b'copytrace.sourcecommitlimit',
932 b'copytrace.sourcecommitlimit',
933 default=100,
933 default=100,
934 )
934 )
935 coreconfigitem(
935 coreconfigitem(
936 b'experimental',
936 b'experimental',
937 b'copies.read-from',
937 b'copies.read-from',
938 default=b"filelog-only",
938 default=b"filelog-only",
939 )
939 )
940 coreconfigitem(
940 coreconfigitem(
941 b'experimental',
941 b'experimental',
942 b'copies.write-to',
942 b'copies.write-to',
943 default=b'filelog-only',
943 default=b'filelog-only',
944 )
944 )
945 coreconfigitem(
945 coreconfigitem(
946 b'experimental',
946 b'experimental',
947 b'crecordtest',
947 b'crecordtest',
948 default=None,
948 default=None,
949 )
949 )
950 coreconfigitem(
950 coreconfigitem(
951 b'experimental',
951 b'experimental',
952 b'directaccess',
952 b'directaccess',
953 default=False,
953 default=False,
954 )
954 )
955 coreconfigitem(
955 coreconfigitem(
956 b'experimental',
956 b'experimental',
957 b'directaccess.revnums',
957 b'directaccess.revnums',
958 default=False,
958 default=False,
959 )
959 )
960 coreconfigitem(
960 coreconfigitem(
961 b'experimental',
961 b'experimental',
962 b'editortmpinhg',
962 b'editortmpinhg',
963 default=False,
963 default=False,
964 )
964 )
965 coreconfigitem(
965 coreconfigitem(
966 b'experimental',
966 b'experimental',
967 b'evolution',
967 b'evolution',
968 default=list,
968 default=list,
969 )
969 )
970 coreconfigitem(
970 coreconfigitem(
971 b'experimental',
971 b'experimental',
972 b'evolution.allowdivergence',
972 b'evolution.allowdivergence',
973 default=False,
973 default=False,
974 alias=[(b'experimental', b'allowdivergence')],
974 alias=[(b'experimental', b'allowdivergence')],
975 )
975 )
976 coreconfigitem(
976 coreconfigitem(
977 b'experimental',
977 b'experimental',
978 b'evolution.allowunstable',
978 b'evolution.allowunstable',
979 default=None,
979 default=None,
980 )
980 )
981 coreconfigitem(
981 coreconfigitem(
982 b'experimental',
982 b'experimental',
983 b'evolution.createmarkers',
983 b'evolution.createmarkers',
984 default=None,
984 default=None,
985 )
985 )
986 coreconfigitem(
986 coreconfigitem(
987 b'experimental',
987 b'experimental',
988 b'evolution.effect-flags',
988 b'evolution.effect-flags',
989 default=True,
989 default=True,
990 alias=[(b'experimental', b'effect-flags')],
990 alias=[(b'experimental', b'effect-flags')],
991 )
991 )
992 coreconfigitem(
992 coreconfigitem(
993 b'experimental',
993 b'experimental',
994 b'evolution.exchange',
994 b'evolution.exchange',
995 default=None,
995 default=None,
996 )
996 )
997 coreconfigitem(
997 coreconfigitem(
998 b'experimental',
998 b'experimental',
999 b'evolution.bundle-obsmarker',
999 b'evolution.bundle-obsmarker',
1000 default=False,
1000 default=False,
1001 )
1001 )
1002 coreconfigitem(
1002 coreconfigitem(
1003 b'experimental',
1003 b'experimental',
1004 b'evolution.bundle-obsmarker:mandatory',
1004 b'evolution.bundle-obsmarker:mandatory',
1005 default=True,
1005 default=True,
1006 )
1006 )
1007 coreconfigitem(
1007 coreconfigitem(
1008 b'experimental',
1008 b'experimental',
1009 b'log.topo',
1009 b'log.topo',
1010 default=False,
1010 default=False,
1011 )
1011 )
1012 coreconfigitem(
1012 coreconfigitem(
1013 b'experimental',
1013 b'experimental',
1014 b'evolution.report-instabilities',
1014 b'evolution.report-instabilities',
1015 default=True,
1015 default=True,
1016 )
1016 )
1017 coreconfigitem(
1017 coreconfigitem(
1018 b'experimental',
1018 b'experimental',
1019 b'evolution.track-operation',
1019 b'evolution.track-operation',
1020 default=True,
1020 default=True,
1021 )
1021 )
1022 # repo-level config to exclude a revset visibility
1022 # repo-level config to exclude a revset visibility
1023 #
1023 #
1024 # The target use case is to use `share` to expose different subset of the same
1024 # The target use case is to use `share` to expose different subset of the same
1025 # repository, especially server side. See also `server.view`.
1025 # repository, especially server side. See also `server.view`.
1026 coreconfigitem(
1026 coreconfigitem(
1027 b'experimental',
1027 b'experimental',
1028 b'extra-filter-revs',
1028 b'extra-filter-revs',
1029 default=None,
1029 default=None,
1030 )
1030 )
1031 coreconfigitem(
1031 coreconfigitem(
1032 b'experimental',
1032 b'experimental',
1033 b'maxdeltachainspan',
1033 b'maxdeltachainspan',
1034 default=-1,
1034 default=-1,
1035 )
1035 )
1036 # tracks files which were undeleted (merge might delete them but we explicitly
1036 # tracks files which were undeleted (merge might delete them but we explicitly
1037 # kept/undeleted them) and creates new filenodes for them
1037 # kept/undeleted them) and creates new filenodes for them
1038 coreconfigitem(
1038 coreconfigitem(
1039 b'experimental',
1039 b'experimental',
1040 b'merge-track-salvaged',
1040 b'merge-track-salvaged',
1041 default=False,
1041 default=False,
1042 )
1042 )
1043 coreconfigitem(
1043 coreconfigitem(
1044 b'experimental',
1044 b'experimental',
1045 b'mergetempdirprefix',
1045 b'mergetempdirprefix',
1046 default=None,
1046 default=None,
1047 )
1047 )
1048 coreconfigitem(
1048 coreconfigitem(
1049 b'experimental',
1049 b'experimental',
1050 b'mmapindexthreshold',
1050 b'mmapindexthreshold',
1051 default=None,
1051 default=None,
1052 )
1052 )
1053 coreconfigitem(
1053 coreconfigitem(
1054 b'experimental',
1054 b'experimental',
1055 b'narrow',
1055 b'narrow',
1056 default=False,
1056 default=False,
1057 )
1057 )
1058 coreconfigitem(
1058 coreconfigitem(
1059 b'experimental',
1059 b'experimental',
1060 b'nonnormalparanoidcheck',
1060 b'nonnormalparanoidcheck',
1061 default=False,
1061 default=False,
1062 )
1062 )
1063 coreconfigitem(
1063 coreconfigitem(
1064 b'experimental',
1064 b'experimental',
1065 b'exportableenviron',
1065 b'exportableenviron',
1066 default=list,
1066 default=list,
1067 )
1067 )
1068 coreconfigitem(
1068 coreconfigitem(
1069 b'experimental',
1069 b'experimental',
1070 b'extendedheader.index',
1070 b'extendedheader.index',
1071 default=None,
1071 default=None,
1072 )
1072 )
1073 coreconfigitem(
1073 coreconfigitem(
1074 b'experimental',
1074 b'experimental',
1075 b'extendedheader.similarity',
1075 b'extendedheader.similarity',
1076 default=False,
1076 default=False,
1077 )
1077 )
1078 coreconfigitem(
1078 coreconfigitem(
1079 b'experimental',
1079 b'experimental',
1080 b'graphshorten',
1080 b'graphshorten',
1081 default=False,
1081 default=False,
1082 )
1082 )
1083 coreconfigitem(
1083 coreconfigitem(
1084 b'experimental',
1084 b'experimental',
1085 b'graphstyle.parent',
1085 b'graphstyle.parent',
1086 default=dynamicdefault,
1086 default=dynamicdefault,
1087 )
1087 )
1088 coreconfigitem(
1088 coreconfigitem(
1089 b'experimental',
1089 b'experimental',
1090 b'graphstyle.missing',
1090 b'graphstyle.missing',
1091 default=dynamicdefault,
1091 default=dynamicdefault,
1092 )
1092 )
1093 coreconfigitem(
1093 coreconfigitem(
1094 b'experimental',
1094 b'experimental',
1095 b'graphstyle.grandparent',
1095 b'graphstyle.grandparent',
1096 default=dynamicdefault,
1096 default=dynamicdefault,
1097 )
1097 )
1098 coreconfigitem(
1098 coreconfigitem(
1099 b'experimental',
1099 b'experimental',
1100 b'hook-track-tags',
1100 b'hook-track-tags',
1101 default=False,
1101 default=False,
1102 )
1102 )
1103 coreconfigitem(
1103 coreconfigitem(
1104 b'experimental',
1104 b'experimental',
1105 b'httppeer.advertise-v2',
1105 b'httppeer.advertise-v2',
1106 default=False,
1106 default=False,
1107 )
1107 )
1108 coreconfigitem(
1108 coreconfigitem(
1109 b'experimental',
1109 b'experimental',
1110 b'httppeer.v2-encoder-order',
1110 b'httppeer.v2-encoder-order',
1111 default=None,
1111 default=None,
1112 )
1112 )
1113 coreconfigitem(
1113 coreconfigitem(
1114 b'experimental',
1114 b'experimental',
1115 b'httppostargs',
1115 b'httppostargs',
1116 default=False,
1116 default=False,
1117 )
1117 )
1118 coreconfigitem(b'experimental', b'nointerrupt', default=False)
1118 coreconfigitem(b'experimental', b'nointerrupt', default=False)
1119 coreconfigitem(b'experimental', b'nointerrupt-interactiveonly', default=True)
1119 coreconfigitem(b'experimental', b'nointerrupt-interactiveonly', default=True)
1120
1120
1121 coreconfigitem(
1121 coreconfigitem(
1122 b'experimental',
1122 b'experimental',
1123 b'obsmarkers-exchange-debug',
1123 b'obsmarkers-exchange-debug',
1124 default=False,
1124 default=False,
1125 )
1125 )
1126 coreconfigitem(
1126 coreconfigitem(
1127 b'experimental',
1127 b'experimental',
1128 b'remotenames',
1128 b'remotenames',
1129 default=False,
1129 default=False,
1130 )
1130 )
1131 coreconfigitem(
1131 coreconfigitem(
1132 b'experimental',
1132 b'experimental',
1133 b'removeemptydirs',
1133 b'removeemptydirs',
1134 default=True,
1134 default=True,
1135 )
1135 )
1136 coreconfigitem(
1136 coreconfigitem(
1137 b'experimental',
1137 b'experimental',
1138 b'revert.interactive.select-to-keep',
1138 b'revert.interactive.select-to-keep',
1139 default=False,
1139 default=False,
1140 )
1140 )
1141 coreconfigitem(
1141 coreconfigitem(
1142 b'experimental',
1142 b'experimental',
1143 b'revisions.prefixhexnode',
1143 b'revisions.prefixhexnode',
1144 default=False,
1144 default=False,
1145 )
1145 )
1146 # "out of experimental" todo list.
1146 # "out of experimental" todo list.
1147 #
1147 #
1148 # * include management of a persistent nodemap in the main docket
1148 # * include management of a persistent nodemap in the main docket
1149 # * enforce a "no-truncate" policy for mmap safety
1149 # * enforce a "no-truncate" policy for mmap safety
1150 # - for censoring operation
1150 # - for censoring operation
1151 # - for stripping operation
1151 # - for stripping operation
1152 # - for rollback operation
1152 # - for rollback operation
1153 # * proper streaming (race free) of the docket file
1153 # * proper streaming (race free) of the docket file
1154 # * track garbage data to evemtually allow rewriting -existing- sidedata.
1154 # * track garbage data to evemtually allow rewriting -existing- sidedata.
1155 # * Exchange-wise, we will also need to do something more efficient than
1155 # * Exchange-wise, we will also need to do something more efficient than
1156 # keeping references to the affected revlogs, especially memory-wise when
1156 # keeping references to the affected revlogs, especially memory-wise when
1157 # rewriting sidedata.
1157 # rewriting sidedata.
1158 # * introduce a proper solution to reduce the number of filelog related files.
1158 # * introduce a proper solution to reduce the number of filelog related files.
1159 # * use caching for reading sidedata (similar to what we do for data).
1159 # * use caching for reading sidedata (similar to what we do for data).
1160 # * no longer set offset=0 if sidedata_size=0 (simplify cutoff computation).
1160 # * no longer set offset=0 if sidedata_size=0 (simplify cutoff computation).
1161 # * Improvement to consider
1161 # * Improvement to consider
1162 # - avoid compression header in chunk using the default compression?
1162 # - avoid compression header in chunk using the default compression?
1163 # - forbid "inline" compression mode entirely?
1163 # - forbid "inline" compression mode entirely?
1164 # - split the data offset and flag field (the 2 bytes save are mostly trouble)
1164 # - split the data offset and flag field (the 2 bytes save are mostly trouble)
1165 # - keep track of uncompressed -chunk- size (to preallocate memory better)
1165 # - keep track of uncompressed -chunk- size (to preallocate memory better)
1166 # - keep track of chain base or size (probably not that useful anymore)
1166 # - keep track of chain base or size (probably not that useful anymore)
1167 coreconfigitem(
1167 coreconfigitem(
1168 b'experimental',
1168 b'experimental',
1169 b'revlogv2',
1169 b'revlogv2',
1170 default=None,
1170 default=None,
1171 )
1171 )
1172 coreconfigitem(
1172 coreconfigitem(
1173 b'experimental',
1173 b'experimental',
1174 b'revisions.disambiguatewithin',
1174 b'revisions.disambiguatewithin',
1175 default=None,
1175 default=None,
1176 )
1176 )
1177 coreconfigitem(
1177 coreconfigitem(
1178 b'experimental',
1178 b'experimental',
1179 b'rust.index',
1179 b'rust.index',
1180 default=False,
1180 default=False,
1181 )
1181 )
1182 coreconfigitem(
1182 coreconfigitem(
1183 b'experimental',
1183 b'experimental',
1184 b'server.filesdata.recommended-batch-size',
1184 b'server.filesdata.recommended-batch-size',
1185 default=50000,
1185 default=50000,
1186 )
1186 )
1187 coreconfigitem(
1187 coreconfigitem(
1188 b'experimental',
1188 b'experimental',
1189 b'server.manifestdata.recommended-batch-size',
1189 b'server.manifestdata.recommended-batch-size',
1190 default=100000,
1190 default=100000,
1191 )
1191 )
1192 coreconfigitem(
1192 coreconfigitem(
1193 b'experimental',
1193 b'experimental',
1194 b'server.stream-narrow-clones',
1194 b'server.stream-narrow-clones',
1195 default=False,
1195 default=False,
1196 )
1196 )
1197 coreconfigitem(
1197 coreconfigitem(
1198 b'experimental',
1198 b'experimental',
1199 b'single-head-per-branch',
1199 b'single-head-per-branch',
1200 default=False,
1200 default=False,
1201 )
1201 )
1202 coreconfigitem(
1202 coreconfigitem(
1203 b'experimental',
1203 b'experimental',
1204 b'single-head-per-branch:account-closed-heads',
1204 b'single-head-per-branch:account-closed-heads',
1205 default=False,
1205 default=False,
1206 )
1206 )
1207 coreconfigitem(
1207 coreconfigitem(
1208 b'experimental',
1208 b'experimental',
1209 b'single-head-per-branch:public-changes-only',
1209 b'single-head-per-branch:public-changes-only',
1210 default=False,
1210 default=False,
1211 )
1211 )
1212 coreconfigitem(
1212 coreconfigitem(
1213 b'experimental',
1213 b'experimental',
1214 b'sshserver.support-v2',
1214 b'sshserver.support-v2',
1215 default=False,
1215 default=False,
1216 )
1216 )
1217 coreconfigitem(
1217 coreconfigitem(
1218 b'experimental',
1218 b'experimental',
1219 b'sparse-read',
1219 b'sparse-read',
1220 default=False,
1220 default=False,
1221 )
1221 )
1222 coreconfigitem(
1222 coreconfigitem(
1223 b'experimental',
1223 b'experimental',
1224 b'sparse-read.density-threshold',
1224 b'sparse-read.density-threshold',
1225 default=0.50,
1225 default=0.50,
1226 )
1226 )
1227 coreconfigitem(
1227 coreconfigitem(
1228 b'experimental',
1228 b'experimental',
1229 b'sparse-read.min-gap-size',
1229 b'sparse-read.min-gap-size',
1230 default=b'65K',
1230 default=b'65K',
1231 )
1231 )
1232 coreconfigitem(
1232 coreconfigitem(
1233 b'experimental',
1233 b'experimental',
1234 b'treemanifest',
1234 b'treemanifest',
1235 default=False,
1235 default=False,
1236 )
1236 )
1237 coreconfigitem(
1237 coreconfigitem(
1238 b'experimental',
1238 b'experimental',
1239 b'update.atomic-file',
1239 b'update.atomic-file',
1240 default=False,
1240 default=False,
1241 )
1241 )
1242 coreconfigitem(
1242 coreconfigitem(
1243 b'experimental',
1243 b'experimental',
1244 b'sshpeer.advertise-v2',
1244 b'sshpeer.advertise-v2',
1245 default=False,
1245 default=False,
1246 )
1246 )
1247 coreconfigitem(
1247 coreconfigitem(
1248 b'experimental',
1248 b'experimental',
1249 b'web.apiserver',
1249 b'web.apiserver',
1250 default=False,
1250 default=False,
1251 )
1251 )
1252 coreconfigitem(
1252 coreconfigitem(
1253 b'experimental',
1253 b'experimental',
1254 b'web.api.http-v2',
1254 b'web.api.http-v2',
1255 default=False,
1255 default=False,
1256 )
1256 )
1257 coreconfigitem(
1257 coreconfigitem(
1258 b'experimental',
1258 b'experimental',
1259 b'web.api.debugreflect',
1259 b'web.api.debugreflect',
1260 default=False,
1260 default=False,
1261 )
1261 )
1262 coreconfigitem(
1262 coreconfigitem(
1263 b'experimental',
1263 b'experimental',
1264 b'web.full-garbage-collection-rate',
1264 b'web.full-garbage-collection-rate',
1265 default=1, # still forcing a full collection on each request
1265 default=1, # still forcing a full collection on each request
1266 )
1266 )
1267 coreconfigitem(
1267 coreconfigitem(
1268 b'experimental',
1268 b'experimental',
1269 b'worker.wdir-get-thread-safe',
1269 b'worker.wdir-get-thread-safe',
1270 default=False,
1270 default=False,
1271 )
1271 )
1272 coreconfigitem(
1272 coreconfigitem(
1273 b'experimental',
1273 b'experimental',
1274 b'worker.repository-upgrade',
1274 b'worker.repository-upgrade',
1275 default=False,
1275 default=False,
1276 )
1276 )
1277 coreconfigitem(
1277 coreconfigitem(
1278 b'experimental',
1278 b'experimental',
1279 b'xdiff',
1279 b'xdiff',
1280 default=False,
1280 default=False,
1281 )
1281 )
1282 coreconfigitem(
1282 coreconfigitem(
1283 b'extensions',
1283 b'extensions',
1284 b'.*',
1284 b'[^:]*',
1285 default=None,
1285 default=None,
1286 generic=True,
1286 generic=True,
1287 )
1287 )
1288 coreconfigitem(
1288 coreconfigitem(
1289 b'extdata',
1289 b'extdata',
1290 b'.*',
1290 b'.*',
1291 default=None,
1291 default=None,
1292 generic=True,
1292 generic=True,
1293 )
1293 )
1294 coreconfigitem(
1294 coreconfigitem(
1295 b'format',
1295 b'format',
1296 b'bookmarks-in-store',
1296 b'bookmarks-in-store',
1297 default=False,
1297 default=False,
1298 )
1298 )
1299 coreconfigitem(
1299 coreconfigitem(
1300 b'format',
1300 b'format',
1301 b'chunkcachesize',
1301 b'chunkcachesize',
1302 default=None,
1302 default=None,
1303 experimental=True,
1303 experimental=True,
1304 )
1304 )
1305 coreconfigitem(
1305 coreconfigitem(
1306 # Enable this dirstate format *when creating a new repository*.
1306 # Enable this dirstate format *when creating a new repository*.
1307 # Which format to use for existing repos is controlled by .hg/requires
1307 # Which format to use for existing repos is controlled by .hg/requires
1308 b'format',
1308 b'format',
1309 b'exp-rc-dirstate-v2',
1309 b'exp-rc-dirstate-v2',
1310 default=False,
1310 default=False,
1311 experimental=True,
1311 experimental=True,
1312 )
1312 )
1313 coreconfigitem(
1313 coreconfigitem(
1314 b'format',
1314 b'format',
1315 b'dotencode',
1315 b'dotencode',
1316 default=True,
1316 default=True,
1317 )
1317 )
1318 coreconfigitem(
1318 coreconfigitem(
1319 b'format',
1319 b'format',
1320 b'generaldelta',
1320 b'generaldelta',
1321 default=False,
1321 default=False,
1322 experimental=True,
1322 experimental=True,
1323 )
1323 )
1324 coreconfigitem(
1324 coreconfigitem(
1325 b'format',
1325 b'format',
1326 b'manifestcachesize',
1326 b'manifestcachesize',
1327 default=None,
1327 default=None,
1328 experimental=True,
1328 experimental=True,
1329 )
1329 )
1330 coreconfigitem(
1330 coreconfigitem(
1331 b'format',
1331 b'format',
1332 b'maxchainlen',
1332 b'maxchainlen',
1333 default=dynamicdefault,
1333 default=dynamicdefault,
1334 experimental=True,
1334 experimental=True,
1335 )
1335 )
1336 coreconfigitem(
1336 coreconfigitem(
1337 b'format',
1337 b'format',
1338 b'obsstore-version',
1338 b'obsstore-version',
1339 default=None,
1339 default=None,
1340 )
1340 )
1341 coreconfigitem(
1341 coreconfigitem(
1342 b'format',
1342 b'format',
1343 b'sparse-revlog',
1343 b'sparse-revlog',
1344 default=True,
1344 default=True,
1345 )
1345 )
1346 coreconfigitem(
1346 coreconfigitem(
1347 b'format',
1347 b'format',
1348 b'revlog-compression',
1348 b'revlog-compression',
1349 default=lambda: [b'zstd', b'zlib'],
1349 default=lambda: [b'zstd', b'zlib'],
1350 alias=[(b'experimental', b'format.compression')],
1350 alias=[(b'experimental', b'format.compression')],
1351 )
1351 )
1352 # Experimental TODOs:
1352 # Experimental TODOs:
1353 #
1353 #
1354 # * Same as for evlogv2 (but for the reduction of the number of files)
1354 # * Same as for evlogv2 (but for the reduction of the number of files)
1355 # * Improvement to investigate
1355 # * Improvement to investigate
1356 # - storing .hgtags fnode
1356 # - storing .hgtags fnode
1357 # - storing `rank` of changesets
1357 # - storing `rank` of changesets
1358 # - storing branch related identifier
1358 # - storing branch related identifier
1359
1359
1360 coreconfigitem(
1360 coreconfigitem(
1361 b'format',
1361 b'format',
1362 b'exp-use-changelog-v2',
1362 b'exp-use-changelog-v2',
1363 default=None,
1363 default=None,
1364 experimental=True,
1364 experimental=True,
1365 )
1365 )
1366 coreconfigitem(
1366 coreconfigitem(
1367 b'format',
1367 b'format',
1368 b'usefncache',
1368 b'usefncache',
1369 default=True,
1369 default=True,
1370 )
1370 )
1371 coreconfigitem(
1371 coreconfigitem(
1372 b'format',
1372 b'format',
1373 b'usegeneraldelta',
1373 b'usegeneraldelta',
1374 default=True,
1374 default=True,
1375 )
1375 )
1376 coreconfigitem(
1376 coreconfigitem(
1377 b'format',
1377 b'format',
1378 b'usestore',
1378 b'usestore',
1379 default=True,
1379 default=True,
1380 )
1380 )
1381
1381
1382
1382
1383 def _persistent_nodemap_default():
1383 def _persistent_nodemap_default():
1384 """compute `use-persistent-nodemap` default value
1384 """compute `use-persistent-nodemap` default value
1385
1385
1386 The feature is disabled unless a fast implementation is available.
1386 The feature is disabled unless a fast implementation is available.
1387 """
1387 """
1388 from . import policy
1388 from . import policy
1389
1389
1390 return policy.importrust('revlog') is not None
1390 return policy.importrust('revlog') is not None
1391
1391
1392
1392
1393 coreconfigitem(
1393 coreconfigitem(
1394 b'format',
1394 b'format',
1395 b'use-persistent-nodemap',
1395 b'use-persistent-nodemap',
1396 default=_persistent_nodemap_default,
1396 default=_persistent_nodemap_default,
1397 )
1397 )
1398 coreconfigitem(
1398 coreconfigitem(
1399 b'format',
1399 b'format',
1400 b'exp-use-copies-side-data-changeset',
1400 b'exp-use-copies-side-data-changeset',
1401 default=False,
1401 default=False,
1402 experimental=True,
1402 experimental=True,
1403 )
1403 )
1404 coreconfigitem(
1404 coreconfigitem(
1405 b'format',
1405 b'format',
1406 b'use-share-safe',
1406 b'use-share-safe',
1407 default=False,
1407 default=False,
1408 )
1408 )
1409 coreconfigitem(
1409 coreconfigitem(
1410 b'format',
1410 b'format',
1411 b'internal-phase',
1411 b'internal-phase',
1412 default=False,
1412 default=False,
1413 experimental=True,
1413 experimental=True,
1414 )
1414 )
1415 coreconfigitem(
1415 coreconfigitem(
1416 b'fsmonitor',
1416 b'fsmonitor',
1417 b'warn_when_unused',
1417 b'warn_when_unused',
1418 default=True,
1418 default=True,
1419 )
1419 )
1420 coreconfigitem(
1420 coreconfigitem(
1421 b'fsmonitor',
1421 b'fsmonitor',
1422 b'warn_update_file_count',
1422 b'warn_update_file_count',
1423 default=50000,
1423 default=50000,
1424 )
1424 )
1425 coreconfigitem(
1425 coreconfigitem(
1426 b'fsmonitor',
1426 b'fsmonitor',
1427 b'warn_update_file_count_rust',
1427 b'warn_update_file_count_rust',
1428 default=400000,
1428 default=400000,
1429 )
1429 )
1430 coreconfigitem(
1430 coreconfigitem(
1431 b'help',
1431 b'help',
1432 br'hidden-command\..*',
1432 br'hidden-command\..*',
1433 default=False,
1433 default=False,
1434 generic=True,
1434 generic=True,
1435 )
1435 )
1436 coreconfigitem(
1436 coreconfigitem(
1437 b'help',
1437 b'help',
1438 br'hidden-topic\..*',
1438 br'hidden-topic\..*',
1439 default=False,
1439 default=False,
1440 generic=True,
1440 generic=True,
1441 )
1441 )
1442 coreconfigitem(
1442 coreconfigitem(
1443 b'hooks',
1443 b'hooks',
1444 b'[^:]*',
1444 b'[^:]*',
1445 default=dynamicdefault,
1445 default=dynamicdefault,
1446 generic=True,
1446 generic=True,
1447 )
1447 )
1448 coreconfigitem(
1448 coreconfigitem(
1449 b'hooks',
1449 b'hooks',
1450 b'.*:run-with-plain',
1450 b'.*:run-with-plain',
1451 default=True,
1451 default=True,
1452 generic=True,
1452 generic=True,
1453 )
1453 )
1454 coreconfigitem(
1454 coreconfigitem(
1455 b'hgweb-paths',
1455 b'hgweb-paths',
1456 b'.*',
1456 b'.*',
1457 default=list,
1457 default=list,
1458 generic=True,
1458 generic=True,
1459 )
1459 )
1460 coreconfigitem(
1460 coreconfigitem(
1461 b'hostfingerprints',
1461 b'hostfingerprints',
1462 b'.*',
1462 b'.*',
1463 default=list,
1463 default=list,
1464 generic=True,
1464 generic=True,
1465 )
1465 )
1466 coreconfigitem(
1466 coreconfigitem(
1467 b'hostsecurity',
1467 b'hostsecurity',
1468 b'ciphers',
1468 b'ciphers',
1469 default=None,
1469 default=None,
1470 )
1470 )
1471 coreconfigitem(
1471 coreconfigitem(
1472 b'hostsecurity',
1472 b'hostsecurity',
1473 b'minimumprotocol',
1473 b'minimumprotocol',
1474 default=dynamicdefault,
1474 default=dynamicdefault,
1475 )
1475 )
1476 coreconfigitem(
1476 coreconfigitem(
1477 b'hostsecurity',
1477 b'hostsecurity',
1478 b'.*:minimumprotocol$',
1478 b'.*:minimumprotocol$',
1479 default=dynamicdefault,
1479 default=dynamicdefault,
1480 generic=True,
1480 generic=True,
1481 )
1481 )
1482 coreconfigitem(
1482 coreconfigitem(
1483 b'hostsecurity',
1483 b'hostsecurity',
1484 b'.*:ciphers$',
1484 b'.*:ciphers$',
1485 default=dynamicdefault,
1485 default=dynamicdefault,
1486 generic=True,
1486 generic=True,
1487 )
1487 )
1488 coreconfigitem(
1488 coreconfigitem(
1489 b'hostsecurity',
1489 b'hostsecurity',
1490 b'.*:fingerprints$',
1490 b'.*:fingerprints$',
1491 default=list,
1491 default=list,
1492 generic=True,
1492 generic=True,
1493 )
1493 )
1494 coreconfigitem(
1494 coreconfigitem(
1495 b'hostsecurity',
1495 b'hostsecurity',
1496 b'.*:verifycertsfile$',
1496 b'.*:verifycertsfile$',
1497 default=None,
1497 default=None,
1498 generic=True,
1498 generic=True,
1499 )
1499 )
1500
1500
1501 coreconfigitem(
1501 coreconfigitem(
1502 b'http_proxy',
1502 b'http_proxy',
1503 b'always',
1503 b'always',
1504 default=False,
1504 default=False,
1505 )
1505 )
1506 coreconfigitem(
1506 coreconfigitem(
1507 b'http_proxy',
1507 b'http_proxy',
1508 b'host',
1508 b'host',
1509 default=None,
1509 default=None,
1510 )
1510 )
1511 coreconfigitem(
1511 coreconfigitem(
1512 b'http_proxy',
1512 b'http_proxy',
1513 b'no',
1513 b'no',
1514 default=list,
1514 default=list,
1515 )
1515 )
1516 coreconfigitem(
1516 coreconfigitem(
1517 b'http_proxy',
1517 b'http_proxy',
1518 b'passwd',
1518 b'passwd',
1519 default=None,
1519 default=None,
1520 )
1520 )
1521 coreconfigitem(
1521 coreconfigitem(
1522 b'http_proxy',
1522 b'http_proxy',
1523 b'user',
1523 b'user',
1524 default=None,
1524 default=None,
1525 )
1525 )
1526
1526
1527 coreconfigitem(
1527 coreconfigitem(
1528 b'http',
1528 b'http',
1529 b'timeout',
1529 b'timeout',
1530 default=None,
1530 default=None,
1531 )
1531 )
1532
1532
1533 coreconfigitem(
1533 coreconfigitem(
1534 b'logtoprocess',
1534 b'logtoprocess',
1535 b'commandexception',
1535 b'commandexception',
1536 default=None,
1536 default=None,
1537 )
1537 )
1538 coreconfigitem(
1538 coreconfigitem(
1539 b'logtoprocess',
1539 b'logtoprocess',
1540 b'commandfinish',
1540 b'commandfinish',
1541 default=None,
1541 default=None,
1542 )
1542 )
1543 coreconfigitem(
1543 coreconfigitem(
1544 b'logtoprocess',
1544 b'logtoprocess',
1545 b'command',
1545 b'command',
1546 default=None,
1546 default=None,
1547 )
1547 )
1548 coreconfigitem(
1548 coreconfigitem(
1549 b'logtoprocess',
1549 b'logtoprocess',
1550 b'develwarn',
1550 b'develwarn',
1551 default=None,
1551 default=None,
1552 )
1552 )
1553 coreconfigitem(
1553 coreconfigitem(
1554 b'logtoprocess',
1554 b'logtoprocess',
1555 b'uiblocked',
1555 b'uiblocked',
1556 default=None,
1556 default=None,
1557 )
1557 )
1558 coreconfigitem(
1558 coreconfigitem(
1559 b'merge',
1559 b'merge',
1560 b'checkunknown',
1560 b'checkunknown',
1561 default=b'abort',
1561 default=b'abort',
1562 )
1562 )
1563 coreconfigitem(
1563 coreconfigitem(
1564 b'merge',
1564 b'merge',
1565 b'checkignored',
1565 b'checkignored',
1566 default=b'abort',
1566 default=b'abort',
1567 )
1567 )
1568 coreconfigitem(
1568 coreconfigitem(
1569 b'experimental',
1569 b'experimental',
1570 b'merge.checkpathconflicts',
1570 b'merge.checkpathconflicts',
1571 default=False,
1571 default=False,
1572 )
1572 )
1573 coreconfigitem(
1573 coreconfigitem(
1574 b'merge',
1574 b'merge',
1575 b'followcopies',
1575 b'followcopies',
1576 default=True,
1576 default=True,
1577 )
1577 )
1578 coreconfigitem(
1578 coreconfigitem(
1579 b'merge',
1579 b'merge',
1580 b'on-failure',
1580 b'on-failure',
1581 default=b'continue',
1581 default=b'continue',
1582 )
1582 )
1583 coreconfigitem(
1583 coreconfigitem(
1584 b'merge',
1584 b'merge',
1585 b'preferancestor',
1585 b'preferancestor',
1586 default=lambda: [b'*'],
1586 default=lambda: [b'*'],
1587 experimental=True,
1587 experimental=True,
1588 )
1588 )
1589 coreconfigitem(
1589 coreconfigitem(
1590 b'merge',
1590 b'merge',
1591 b'strict-capability-check',
1591 b'strict-capability-check',
1592 default=False,
1592 default=False,
1593 )
1593 )
1594 coreconfigitem(
1594 coreconfigitem(
1595 b'merge-tools',
1595 b'merge-tools',
1596 b'.*',
1596 b'.*',
1597 default=None,
1597 default=None,
1598 generic=True,
1598 generic=True,
1599 )
1599 )
1600 coreconfigitem(
1600 coreconfigitem(
1601 b'merge-tools',
1601 b'merge-tools',
1602 br'.*\.args$',
1602 br'.*\.args$',
1603 default=b"$local $base $other",
1603 default=b"$local $base $other",
1604 generic=True,
1604 generic=True,
1605 priority=-1,
1605 priority=-1,
1606 )
1606 )
1607 coreconfigitem(
1607 coreconfigitem(
1608 b'merge-tools',
1608 b'merge-tools',
1609 br'.*\.binary$',
1609 br'.*\.binary$',
1610 default=False,
1610 default=False,
1611 generic=True,
1611 generic=True,
1612 priority=-1,
1612 priority=-1,
1613 )
1613 )
1614 coreconfigitem(
1614 coreconfigitem(
1615 b'merge-tools',
1615 b'merge-tools',
1616 br'.*\.check$',
1616 br'.*\.check$',
1617 default=list,
1617 default=list,
1618 generic=True,
1618 generic=True,
1619 priority=-1,
1619 priority=-1,
1620 )
1620 )
1621 coreconfigitem(
1621 coreconfigitem(
1622 b'merge-tools',
1622 b'merge-tools',
1623 br'.*\.checkchanged$',
1623 br'.*\.checkchanged$',
1624 default=False,
1624 default=False,
1625 generic=True,
1625 generic=True,
1626 priority=-1,
1626 priority=-1,
1627 )
1627 )
1628 coreconfigitem(
1628 coreconfigitem(
1629 b'merge-tools',
1629 b'merge-tools',
1630 br'.*\.executable$',
1630 br'.*\.executable$',
1631 default=dynamicdefault,
1631 default=dynamicdefault,
1632 generic=True,
1632 generic=True,
1633 priority=-1,
1633 priority=-1,
1634 )
1634 )
1635 coreconfigitem(
1635 coreconfigitem(
1636 b'merge-tools',
1636 b'merge-tools',
1637 br'.*\.fixeol$',
1637 br'.*\.fixeol$',
1638 default=False,
1638 default=False,
1639 generic=True,
1639 generic=True,
1640 priority=-1,
1640 priority=-1,
1641 )
1641 )
1642 coreconfigitem(
1642 coreconfigitem(
1643 b'merge-tools',
1643 b'merge-tools',
1644 br'.*\.gui$',
1644 br'.*\.gui$',
1645 default=False,
1645 default=False,
1646 generic=True,
1646 generic=True,
1647 priority=-1,
1647 priority=-1,
1648 )
1648 )
1649 coreconfigitem(
1649 coreconfigitem(
1650 b'merge-tools',
1650 b'merge-tools',
1651 br'.*\.mergemarkers$',
1651 br'.*\.mergemarkers$',
1652 default=b'basic',
1652 default=b'basic',
1653 generic=True,
1653 generic=True,
1654 priority=-1,
1654 priority=-1,
1655 )
1655 )
1656 coreconfigitem(
1656 coreconfigitem(
1657 b'merge-tools',
1657 b'merge-tools',
1658 br'.*\.mergemarkertemplate$',
1658 br'.*\.mergemarkertemplate$',
1659 default=dynamicdefault, # take from command-templates.mergemarker
1659 default=dynamicdefault, # take from command-templates.mergemarker
1660 generic=True,
1660 generic=True,
1661 priority=-1,
1661 priority=-1,
1662 )
1662 )
1663 coreconfigitem(
1663 coreconfigitem(
1664 b'merge-tools',
1664 b'merge-tools',
1665 br'.*\.priority$',
1665 br'.*\.priority$',
1666 default=0,
1666 default=0,
1667 generic=True,
1667 generic=True,
1668 priority=-1,
1668 priority=-1,
1669 )
1669 )
1670 coreconfigitem(
1670 coreconfigitem(
1671 b'merge-tools',
1671 b'merge-tools',
1672 br'.*\.premerge$',
1672 br'.*\.premerge$',
1673 default=dynamicdefault,
1673 default=dynamicdefault,
1674 generic=True,
1674 generic=True,
1675 priority=-1,
1675 priority=-1,
1676 )
1676 )
1677 coreconfigitem(
1677 coreconfigitem(
1678 b'merge-tools',
1678 b'merge-tools',
1679 br'.*\.symlink$',
1679 br'.*\.symlink$',
1680 default=False,
1680 default=False,
1681 generic=True,
1681 generic=True,
1682 priority=-1,
1682 priority=-1,
1683 )
1683 )
1684 coreconfigitem(
1684 coreconfigitem(
1685 b'pager',
1685 b'pager',
1686 b'attend-.*',
1686 b'attend-.*',
1687 default=dynamicdefault,
1687 default=dynamicdefault,
1688 generic=True,
1688 generic=True,
1689 )
1689 )
1690 coreconfigitem(
1690 coreconfigitem(
1691 b'pager',
1691 b'pager',
1692 b'ignore',
1692 b'ignore',
1693 default=list,
1693 default=list,
1694 )
1694 )
1695 coreconfigitem(
1695 coreconfigitem(
1696 b'pager',
1696 b'pager',
1697 b'pager',
1697 b'pager',
1698 default=dynamicdefault,
1698 default=dynamicdefault,
1699 )
1699 )
1700 coreconfigitem(
1700 coreconfigitem(
1701 b'patch',
1701 b'patch',
1702 b'eol',
1702 b'eol',
1703 default=b'strict',
1703 default=b'strict',
1704 )
1704 )
1705 coreconfigitem(
1705 coreconfigitem(
1706 b'patch',
1706 b'patch',
1707 b'fuzz',
1707 b'fuzz',
1708 default=2,
1708 default=2,
1709 )
1709 )
1710 coreconfigitem(
1710 coreconfigitem(
1711 b'paths',
1711 b'paths',
1712 b'default',
1712 b'default',
1713 default=None,
1713 default=None,
1714 )
1714 )
1715 coreconfigitem(
1715 coreconfigitem(
1716 b'paths',
1716 b'paths',
1717 b'default-push',
1717 b'default-push',
1718 default=None,
1718 default=None,
1719 )
1719 )
1720 coreconfigitem(
1720 coreconfigitem(
1721 b'paths',
1721 b'paths',
1722 b'.*',
1722 b'.*',
1723 default=None,
1723 default=None,
1724 generic=True,
1724 generic=True,
1725 )
1725 )
1726 coreconfigitem(
1726 coreconfigitem(
1727 b'phases',
1727 b'phases',
1728 b'checksubrepos',
1728 b'checksubrepos',
1729 default=b'follow',
1729 default=b'follow',
1730 )
1730 )
1731 coreconfigitem(
1731 coreconfigitem(
1732 b'phases',
1732 b'phases',
1733 b'new-commit',
1733 b'new-commit',
1734 default=b'draft',
1734 default=b'draft',
1735 )
1735 )
1736 coreconfigitem(
1736 coreconfigitem(
1737 b'phases',
1737 b'phases',
1738 b'publish',
1738 b'publish',
1739 default=True,
1739 default=True,
1740 )
1740 )
1741 coreconfigitem(
1741 coreconfigitem(
1742 b'profiling',
1742 b'profiling',
1743 b'enabled',
1743 b'enabled',
1744 default=False,
1744 default=False,
1745 )
1745 )
1746 coreconfigitem(
1746 coreconfigitem(
1747 b'profiling',
1747 b'profiling',
1748 b'format',
1748 b'format',
1749 default=b'text',
1749 default=b'text',
1750 )
1750 )
1751 coreconfigitem(
1751 coreconfigitem(
1752 b'profiling',
1752 b'profiling',
1753 b'freq',
1753 b'freq',
1754 default=1000,
1754 default=1000,
1755 )
1755 )
1756 coreconfigitem(
1756 coreconfigitem(
1757 b'profiling',
1757 b'profiling',
1758 b'limit',
1758 b'limit',
1759 default=30,
1759 default=30,
1760 )
1760 )
1761 coreconfigitem(
1761 coreconfigitem(
1762 b'profiling',
1762 b'profiling',
1763 b'nested',
1763 b'nested',
1764 default=0,
1764 default=0,
1765 )
1765 )
1766 coreconfigitem(
1766 coreconfigitem(
1767 b'profiling',
1767 b'profiling',
1768 b'output',
1768 b'output',
1769 default=None,
1769 default=None,
1770 )
1770 )
1771 coreconfigitem(
1771 coreconfigitem(
1772 b'profiling',
1772 b'profiling',
1773 b'showmax',
1773 b'showmax',
1774 default=0.999,
1774 default=0.999,
1775 )
1775 )
1776 coreconfigitem(
1776 coreconfigitem(
1777 b'profiling',
1777 b'profiling',
1778 b'showmin',
1778 b'showmin',
1779 default=dynamicdefault,
1779 default=dynamicdefault,
1780 )
1780 )
1781 coreconfigitem(
1781 coreconfigitem(
1782 b'profiling',
1782 b'profiling',
1783 b'showtime',
1783 b'showtime',
1784 default=True,
1784 default=True,
1785 )
1785 )
1786 coreconfigitem(
1786 coreconfigitem(
1787 b'profiling',
1787 b'profiling',
1788 b'sort',
1788 b'sort',
1789 default=b'inlinetime',
1789 default=b'inlinetime',
1790 )
1790 )
1791 coreconfigitem(
1791 coreconfigitem(
1792 b'profiling',
1792 b'profiling',
1793 b'statformat',
1793 b'statformat',
1794 default=b'hotpath',
1794 default=b'hotpath',
1795 )
1795 )
1796 coreconfigitem(
1796 coreconfigitem(
1797 b'profiling',
1797 b'profiling',
1798 b'time-track',
1798 b'time-track',
1799 default=dynamicdefault,
1799 default=dynamicdefault,
1800 )
1800 )
1801 coreconfigitem(
1801 coreconfigitem(
1802 b'profiling',
1802 b'profiling',
1803 b'type',
1803 b'type',
1804 default=b'stat',
1804 default=b'stat',
1805 )
1805 )
1806 coreconfigitem(
1806 coreconfigitem(
1807 b'progress',
1807 b'progress',
1808 b'assume-tty',
1808 b'assume-tty',
1809 default=False,
1809 default=False,
1810 )
1810 )
1811 coreconfigitem(
1811 coreconfigitem(
1812 b'progress',
1812 b'progress',
1813 b'changedelay',
1813 b'changedelay',
1814 default=1,
1814 default=1,
1815 )
1815 )
1816 coreconfigitem(
1816 coreconfigitem(
1817 b'progress',
1817 b'progress',
1818 b'clear-complete',
1818 b'clear-complete',
1819 default=True,
1819 default=True,
1820 )
1820 )
1821 coreconfigitem(
1821 coreconfigitem(
1822 b'progress',
1822 b'progress',
1823 b'debug',
1823 b'debug',
1824 default=False,
1824 default=False,
1825 )
1825 )
1826 coreconfigitem(
1826 coreconfigitem(
1827 b'progress',
1827 b'progress',
1828 b'delay',
1828 b'delay',
1829 default=3,
1829 default=3,
1830 )
1830 )
1831 coreconfigitem(
1831 coreconfigitem(
1832 b'progress',
1832 b'progress',
1833 b'disable',
1833 b'disable',
1834 default=False,
1834 default=False,
1835 )
1835 )
1836 coreconfigitem(
1836 coreconfigitem(
1837 b'progress',
1837 b'progress',
1838 b'estimateinterval',
1838 b'estimateinterval',
1839 default=60.0,
1839 default=60.0,
1840 )
1840 )
1841 coreconfigitem(
1841 coreconfigitem(
1842 b'progress',
1842 b'progress',
1843 b'format',
1843 b'format',
1844 default=lambda: [b'topic', b'bar', b'number', b'estimate'],
1844 default=lambda: [b'topic', b'bar', b'number', b'estimate'],
1845 )
1845 )
1846 coreconfigitem(
1846 coreconfigitem(
1847 b'progress',
1847 b'progress',
1848 b'refresh',
1848 b'refresh',
1849 default=0.1,
1849 default=0.1,
1850 )
1850 )
1851 coreconfigitem(
1851 coreconfigitem(
1852 b'progress',
1852 b'progress',
1853 b'width',
1853 b'width',
1854 default=dynamicdefault,
1854 default=dynamicdefault,
1855 )
1855 )
1856 coreconfigitem(
1856 coreconfigitem(
1857 b'pull',
1857 b'pull',
1858 b'confirm',
1858 b'confirm',
1859 default=False,
1859 default=False,
1860 )
1860 )
1861 coreconfigitem(
1861 coreconfigitem(
1862 b'push',
1862 b'push',
1863 b'pushvars.server',
1863 b'pushvars.server',
1864 default=False,
1864 default=False,
1865 )
1865 )
1866 coreconfigitem(
1866 coreconfigitem(
1867 b'rewrite',
1867 b'rewrite',
1868 b'backup-bundle',
1868 b'backup-bundle',
1869 default=True,
1869 default=True,
1870 alias=[(b'ui', b'history-editing-backup')],
1870 alias=[(b'ui', b'history-editing-backup')],
1871 )
1871 )
1872 coreconfigitem(
1872 coreconfigitem(
1873 b'rewrite',
1873 b'rewrite',
1874 b'update-timestamp',
1874 b'update-timestamp',
1875 default=False,
1875 default=False,
1876 )
1876 )
1877 coreconfigitem(
1877 coreconfigitem(
1878 b'rewrite',
1878 b'rewrite',
1879 b'empty-successor',
1879 b'empty-successor',
1880 default=b'skip',
1880 default=b'skip',
1881 experimental=True,
1881 experimental=True,
1882 )
1882 )
1883 # experimental as long as format.exp-rc-dirstate-v2 is.
1883 # experimental as long as format.exp-rc-dirstate-v2 is.
1884 coreconfigitem(
1884 coreconfigitem(
1885 b'storage',
1885 b'storage',
1886 b'dirstate-v2.slow-path',
1886 b'dirstate-v2.slow-path',
1887 default=b"abort",
1887 default=b"abort",
1888 experimental=True,
1888 experimental=True,
1889 )
1889 )
1890 coreconfigitem(
1890 coreconfigitem(
1891 b'storage',
1891 b'storage',
1892 b'new-repo-backend',
1892 b'new-repo-backend',
1893 default=b'revlogv1',
1893 default=b'revlogv1',
1894 experimental=True,
1894 experimental=True,
1895 )
1895 )
1896 coreconfigitem(
1896 coreconfigitem(
1897 b'storage',
1897 b'storage',
1898 b'revlog.optimize-delta-parent-choice',
1898 b'revlog.optimize-delta-parent-choice',
1899 default=True,
1899 default=True,
1900 alias=[(b'format', b'aggressivemergedeltas')],
1900 alias=[(b'format', b'aggressivemergedeltas')],
1901 )
1901 )
1902 coreconfigitem(
1902 coreconfigitem(
1903 b'storage',
1903 b'storage',
1904 b'revlog.issue6528.fix-incoming',
1904 b'revlog.issue6528.fix-incoming',
1905 default=True,
1905 default=True,
1906 )
1906 )
1907 # experimental as long as rust is experimental (or a C version is implemented)
1907 # experimental as long as rust is experimental (or a C version is implemented)
1908 coreconfigitem(
1908 coreconfigitem(
1909 b'storage',
1909 b'storage',
1910 b'revlog.persistent-nodemap.mmap',
1910 b'revlog.persistent-nodemap.mmap',
1911 default=True,
1911 default=True,
1912 )
1912 )
1913 # experimental as long as format.use-persistent-nodemap is.
1913 # experimental as long as format.use-persistent-nodemap is.
1914 coreconfigitem(
1914 coreconfigitem(
1915 b'storage',
1915 b'storage',
1916 b'revlog.persistent-nodemap.slow-path',
1916 b'revlog.persistent-nodemap.slow-path',
1917 default=b"abort",
1917 default=b"abort",
1918 )
1918 )
1919
1919
1920 coreconfigitem(
1920 coreconfigitem(
1921 b'storage',
1921 b'storage',
1922 b'revlog.reuse-external-delta',
1922 b'revlog.reuse-external-delta',
1923 default=True,
1923 default=True,
1924 )
1924 )
1925 coreconfigitem(
1925 coreconfigitem(
1926 b'storage',
1926 b'storage',
1927 b'revlog.reuse-external-delta-parent',
1927 b'revlog.reuse-external-delta-parent',
1928 default=None,
1928 default=None,
1929 )
1929 )
1930 coreconfigitem(
1930 coreconfigitem(
1931 b'storage',
1931 b'storage',
1932 b'revlog.zlib.level',
1932 b'revlog.zlib.level',
1933 default=None,
1933 default=None,
1934 )
1934 )
1935 coreconfigitem(
1935 coreconfigitem(
1936 b'storage',
1936 b'storage',
1937 b'revlog.zstd.level',
1937 b'revlog.zstd.level',
1938 default=None,
1938 default=None,
1939 )
1939 )
1940 coreconfigitem(
1940 coreconfigitem(
1941 b'server',
1941 b'server',
1942 b'bookmarks-pushkey-compat',
1942 b'bookmarks-pushkey-compat',
1943 default=True,
1943 default=True,
1944 )
1944 )
1945 coreconfigitem(
1945 coreconfigitem(
1946 b'server',
1946 b'server',
1947 b'bundle1',
1947 b'bundle1',
1948 default=True,
1948 default=True,
1949 )
1949 )
1950 coreconfigitem(
1950 coreconfigitem(
1951 b'server',
1951 b'server',
1952 b'bundle1gd',
1952 b'bundle1gd',
1953 default=None,
1953 default=None,
1954 )
1954 )
1955 coreconfigitem(
1955 coreconfigitem(
1956 b'server',
1956 b'server',
1957 b'bundle1.pull',
1957 b'bundle1.pull',
1958 default=None,
1958 default=None,
1959 )
1959 )
1960 coreconfigitem(
1960 coreconfigitem(
1961 b'server',
1961 b'server',
1962 b'bundle1gd.pull',
1962 b'bundle1gd.pull',
1963 default=None,
1963 default=None,
1964 )
1964 )
1965 coreconfigitem(
1965 coreconfigitem(
1966 b'server',
1966 b'server',
1967 b'bundle1.push',
1967 b'bundle1.push',
1968 default=None,
1968 default=None,
1969 )
1969 )
1970 coreconfigitem(
1970 coreconfigitem(
1971 b'server',
1971 b'server',
1972 b'bundle1gd.push',
1972 b'bundle1gd.push',
1973 default=None,
1973 default=None,
1974 )
1974 )
1975 coreconfigitem(
1975 coreconfigitem(
1976 b'server',
1976 b'server',
1977 b'bundle2.stream',
1977 b'bundle2.stream',
1978 default=True,
1978 default=True,
1979 alias=[(b'experimental', b'bundle2.stream')],
1979 alias=[(b'experimental', b'bundle2.stream')],
1980 )
1980 )
1981 coreconfigitem(
1981 coreconfigitem(
1982 b'server',
1982 b'server',
1983 b'compressionengines',
1983 b'compressionengines',
1984 default=list,
1984 default=list,
1985 )
1985 )
1986 coreconfigitem(
1986 coreconfigitem(
1987 b'server',
1987 b'server',
1988 b'concurrent-push-mode',
1988 b'concurrent-push-mode',
1989 default=b'check-related',
1989 default=b'check-related',
1990 )
1990 )
1991 coreconfigitem(
1991 coreconfigitem(
1992 b'server',
1992 b'server',
1993 b'disablefullbundle',
1993 b'disablefullbundle',
1994 default=False,
1994 default=False,
1995 )
1995 )
1996 coreconfigitem(
1996 coreconfigitem(
1997 b'server',
1997 b'server',
1998 b'maxhttpheaderlen',
1998 b'maxhttpheaderlen',
1999 default=1024,
1999 default=1024,
2000 )
2000 )
2001 coreconfigitem(
2001 coreconfigitem(
2002 b'server',
2002 b'server',
2003 b'pullbundle',
2003 b'pullbundle',
2004 default=False,
2004 default=False,
2005 )
2005 )
2006 coreconfigitem(
2006 coreconfigitem(
2007 b'server',
2007 b'server',
2008 b'preferuncompressed',
2008 b'preferuncompressed',
2009 default=False,
2009 default=False,
2010 )
2010 )
2011 coreconfigitem(
2011 coreconfigitem(
2012 b'server',
2012 b'server',
2013 b'streamunbundle',
2013 b'streamunbundle',
2014 default=False,
2014 default=False,
2015 )
2015 )
2016 coreconfigitem(
2016 coreconfigitem(
2017 b'server',
2017 b'server',
2018 b'uncompressed',
2018 b'uncompressed',
2019 default=True,
2019 default=True,
2020 )
2020 )
2021 coreconfigitem(
2021 coreconfigitem(
2022 b'server',
2022 b'server',
2023 b'uncompressedallowsecret',
2023 b'uncompressedallowsecret',
2024 default=False,
2024 default=False,
2025 )
2025 )
2026 coreconfigitem(
2026 coreconfigitem(
2027 b'server',
2027 b'server',
2028 b'view',
2028 b'view',
2029 default=b'served',
2029 default=b'served',
2030 )
2030 )
2031 coreconfigitem(
2031 coreconfigitem(
2032 b'server',
2032 b'server',
2033 b'validate',
2033 b'validate',
2034 default=False,
2034 default=False,
2035 )
2035 )
2036 coreconfigitem(
2036 coreconfigitem(
2037 b'server',
2037 b'server',
2038 b'zliblevel',
2038 b'zliblevel',
2039 default=-1,
2039 default=-1,
2040 )
2040 )
2041 coreconfigitem(
2041 coreconfigitem(
2042 b'server',
2042 b'server',
2043 b'zstdlevel',
2043 b'zstdlevel',
2044 default=3,
2044 default=3,
2045 )
2045 )
2046 coreconfigitem(
2046 coreconfigitem(
2047 b'share',
2047 b'share',
2048 b'pool',
2048 b'pool',
2049 default=None,
2049 default=None,
2050 )
2050 )
2051 coreconfigitem(
2051 coreconfigitem(
2052 b'share',
2052 b'share',
2053 b'poolnaming',
2053 b'poolnaming',
2054 default=b'identity',
2054 default=b'identity',
2055 )
2055 )
2056 coreconfigitem(
2056 coreconfigitem(
2057 b'share',
2057 b'share',
2058 b'safe-mismatch.source-not-safe',
2058 b'safe-mismatch.source-not-safe',
2059 default=b'abort',
2059 default=b'abort',
2060 )
2060 )
2061 coreconfigitem(
2061 coreconfigitem(
2062 b'share',
2062 b'share',
2063 b'safe-mismatch.source-safe',
2063 b'safe-mismatch.source-safe',
2064 default=b'abort',
2064 default=b'abort',
2065 )
2065 )
2066 coreconfigitem(
2066 coreconfigitem(
2067 b'share',
2067 b'share',
2068 b'safe-mismatch.source-not-safe.warn',
2068 b'safe-mismatch.source-not-safe.warn',
2069 default=True,
2069 default=True,
2070 )
2070 )
2071 coreconfigitem(
2071 coreconfigitem(
2072 b'share',
2072 b'share',
2073 b'safe-mismatch.source-safe.warn',
2073 b'safe-mismatch.source-safe.warn',
2074 default=True,
2074 default=True,
2075 )
2075 )
2076 coreconfigitem(
2076 coreconfigitem(
2077 b'shelve',
2077 b'shelve',
2078 b'maxbackups',
2078 b'maxbackups',
2079 default=10,
2079 default=10,
2080 )
2080 )
2081 coreconfigitem(
2081 coreconfigitem(
2082 b'smtp',
2082 b'smtp',
2083 b'host',
2083 b'host',
2084 default=None,
2084 default=None,
2085 )
2085 )
2086 coreconfigitem(
2086 coreconfigitem(
2087 b'smtp',
2087 b'smtp',
2088 b'local_hostname',
2088 b'local_hostname',
2089 default=None,
2089 default=None,
2090 )
2090 )
2091 coreconfigitem(
2091 coreconfigitem(
2092 b'smtp',
2092 b'smtp',
2093 b'password',
2093 b'password',
2094 default=None,
2094 default=None,
2095 )
2095 )
2096 coreconfigitem(
2096 coreconfigitem(
2097 b'smtp',
2097 b'smtp',
2098 b'port',
2098 b'port',
2099 default=dynamicdefault,
2099 default=dynamicdefault,
2100 )
2100 )
2101 coreconfigitem(
2101 coreconfigitem(
2102 b'smtp',
2102 b'smtp',
2103 b'tls',
2103 b'tls',
2104 default=b'none',
2104 default=b'none',
2105 )
2105 )
2106 coreconfigitem(
2106 coreconfigitem(
2107 b'smtp',
2107 b'smtp',
2108 b'username',
2108 b'username',
2109 default=None,
2109 default=None,
2110 )
2110 )
2111 coreconfigitem(
2111 coreconfigitem(
2112 b'sparse',
2112 b'sparse',
2113 b'missingwarning',
2113 b'missingwarning',
2114 default=True,
2114 default=True,
2115 experimental=True,
2115 experimental=True,
2116 )
2116 )
2117 coreconfigitem(
2117 coreconfigitem(
2118 b'subrepos',
2118 b'subrepos',
2119 b'allowed',
2119 b'allowed',
2120 default=dynamicdefault, # to make backporting simpler
2120 default=dynamicdefault, # to make backporting simpler
2121 )
2121 )
2122 coreconfigitem(
2122 coreconfigitem(
2123 b'subrepos',
2123 b'subrepos',
2124 b'hg:allowed',
2124 b'hg:allowed',
2125 default=dynamicdefault,
2125 default=dynamicdefault,
2126 )
2126 )
2127 coreconfigitem(
2127 coreconfigitem(
2128 b'subrepos',
2128 b'subrepos',
2129 b'git:allowed',
2129 b'git:allowed',
2130 default=dynamicdefault,
2130 default=dynamicdefault,
2131 )
2131 )
2132 coreconfigitem(
2132 coreconfigitem(
2133 b'subrepos',
2133 b'subrepos',
2134 b'svn:allowed',
2134 b'svn:allowed',
2135 default=dynamicdefault,
2135 default=dynamicdefault,
2136 )
2136 )
2137 coreconfigitem(
2137 coreconfigitem(
2138 b'templates',
2138 b'templates',
2139 b'.*',
2139 b'.*',
2140 default=None,
2140 default=None,
2141 generic=True,
2141 generic=True,
2142 )
2142 )
2143 coreconfigitem(
2143 coreconfigitem(
2144 b'templateconfig',
2144 b'templateconfig',
2145 b'.*',
2145 b'.*',
2146 default=dynamicdefault,
2146 default=dynamicdefault,
2147 generic=True,
2147 generic=True,
2148 )
2148 )
2149 coreconfigitem(
2149 coreconfigitem(
2150 b'trusted',
2150 b'trusted',
2151 b'groups',
2151 b'groups',
2152 default=list,
2152 default=list,
2153 )
2153 )
2154 coreconfigitem(
2154 coreconfigitem(
2155 b'trusted',
2155 b'trusted',
2156 b'users',
2156 b'users',
2157 default=list,
2157 default=list,
2158 )
2158 )
2159 coreconfigitem(
2159 coreconfigitem(
2160 b'ui',
2160 b'ui',
2161 b'_usedassubrepo',
2161 b'_usedassubrepo',
2162 default=False,
2162 default=False,
2163 )
2163 )
2164 coreconfigitem(
2164 coreconfigitem(
2165 b'ui',
2165 b'ui',
2166 b'allowemptycommit',
2166 b'allowemptycommit',
2167 default=False,
2167 default=False,
2168 )
2168 )
2169 coreconfigitem(
2169 coreconfigitem(
2170 b'ui',
2170 b'ui',
2171 b'archivemeta',
2171 b'archivemeta',
2172 default=True,
2172 default=True,
2173 )
2173 )
2174 coreconfigitem(
2174 coreconfigitem(
2175 b'ui',
2175 b'ui',
2176 b'askusername',
2176 b'askusername',
2177 default=False,
2177 default=False,
2178 )
2178 )
2179 coreconfigitem(
2179 coreconfigitem(
2180 b'ui',
2180 b'ui',
2181 b'available-memory',
2181 b'available-memory',
2182 default=None,
2182 default=None,
2183 )
2183 )
2184
2184
2185 coreconfigitem(
2185 coreconfigitem(
2186 b'ui',
2186 b'ui',
2187 b'clonebundlefallback',
2187 b'clonebundlefallback',
2188 default=False,
2188 default=False,
2189 )
2189 )
2190 coreconfigitem(
2190 coreconfigitem(
2191 b'ui',
2191 b'ui',
2192 b'clonebundleprefers',
2192 b'clonebundleprefers',
2193 default=list,
2193 default=list,
2194 )
2194 )
2195 coreconfigitem(
2195 coreconfigitem(
2196 b'ui',
2196 b'ui',
2197 b'clonebundles',
2197 b'clonebundles',
2198 default=True,
2198 default=True,
2199 )
2199 )
2200 coreconfigitem(
2200 coreconfigitem(
2201 b'ui',
2201 b'ui',
2202 b'color',
2202 b'color',
2203 default=b'auto',
2203 default=b'auto',
2204 )
2204 )
2205 coreconfigitem(
2205 coreconfigitem(
2206 b'ui',
2206 b'ui',
2207 b'commitsubrepos',
2207 b'commitsubrepos',
2208 default=False,
2208 default=False,
2209 )
2209 )
2210 coreconfigitem(
2210 coreconfigitem(
2211 b'ui',
2211 b'ui',
2212 b'debug',
2212 b'debug',
2213 default=False,
2213 default=False,
2214 )
2214 )
2215 coreconfigitem(
2215 coreconfigitem(
2216 b'ui',
2216 b'ui',
2217 b'debugger',
2217 b'debugger',
2218 default=None,
2218 default=None,
2219 )
2219 )
2220 coreconfigitem(
2220 coreconfigitem(
2221 b'ui',
2221 b'ui',
2222 b'editor',
2222 b'editor',
2223 default=dynamicdefault,
2223 default=dynamicdefault,
2224 )
2224 )
2225 coreconfigitem(
2225 coreconfigitem(
2226 b'ui',
2226 b'ui',
2227 b'detailed-exit-code',
2227 b'detailed-exit-code',
2228 default=False,
2228 default=False,
2229 experimental=True,
2229 experimental=True,
2230 )
2230 )
2231 coreconfigitem(
2231 coreconfigitem(
2232 b'ui',
2232 b'ui',
2233 b'fallbackencoding',
2233 b'fallbackencoding',
2234 default=None,
2234 default=None,
2235 )
2235 )
2236 coreconfigitem(
2236 coreconfigitem(
2237 b'ui',
2237 b'ui',
2238 b'forcecwd',
2238 b'forcecwd',
2239 default=None,
2239 default=None,
2240 )
2240 )
2241 coreconfigitem(
2241 coreconfigitem(
2242 b'ui',
2242 b'ui',
2243 b'forcemerge',
2243 b'forcemerge',
2244 default=None,
2244 default=None,
2245 )
2245 )
2246 coreconfigitem(
2246 coreconfigitem(
2247 b'ui',
2247 b'ui',
2248 b'formatdebug',
2248 b'formatdebug',
2249 default=False,
2249 default=False,
2250 )
2250 )
2251 coreconfigitem(
2251 coreconfigitem(
2252 b'ui',
2252 b'ui',
2253 b'formatjson',
2253 b'formatjson',
2254 default=False,
2254 default=False,
2255 )
2255 )
2256 coreconfigitem(
2256 coreconfigitem(
2257 b'ui',
2257 b'ui',
2258 b'formatted',
2258 b'formatted',
2259 default=None,
2259 default=None,
2260 )
2260 )
2261 coreconfigitem(
2261 coreconfigitem(
2262 b'ui',
2262 b'ui',
2263 b'interactive',
2263 b'interactive',
2264 default=None,
2264 default=None,
2265 )
2265 )
2266 coreconfigitem(
2266 coreconfigitem(
2267 b'ui',
2267 b'ui',
2268 b'interface',
2268 b'interface',
2269 default=None,
2269 default=None,
2270 )
2270 )
2271 coreconfigitem(
2271 coreconfigitem(
2272 b'ui',
2272 b'ui',
2273 b'interface.chunkselector',
2273 b'interface.chunkselector',
2274 default=None,
2274 default=None,
2275 )
2275 )
2276 coreconfigitem(
2276 coreconfigitem(
2277 b'ui',
2277 b'ui',
2278 b'large-file-limit',
2278 b'large-file-limit',
2279 default=10000000,
2279 default=10000000,
2280 )
2280 )
2281 coreconfigitem(
2281 coreconfigitem(
2282 b'ui',
2282 b'ui',
2283 b'logblockedtimes',
2283 b'logblockedtimes',
2284 default=False,
2284 default=False,
2285 )
2285 )
2286 coreconfigitem(
2286 coreconfigitem(
2287 b'ui',
2287 b'ui',
2288 b'merge',
2288 b'merge',
2289 default=None,
2289 default=None,
2290 )
2290 )
2291 coreconfigitem(
2291 coreconfigitem(
2292 b'ui',
2292 b'ui',
2293 b'mergemarkers',
2293 b'mergemarkers',
2294 default=b'basic',
2294 default=b'basic',
2295 )
2295 )
2296 coreconfigitem(
2296 coreconfigitem(
2297 b'ui',
2297 b'ui',
2298 b'message-output',
2298 b'message-output',
2299 default=b'stdio',
2299 default=b'stdio',
2300 )
2300 )
2301 coreconfigitem(
2301 coreconfigitem(
2302 b'ui',
2302 b'ui',
2303 b'nontty',
2303 b'nontty',
2304 default=False,
2304 default=False,
2305 )
2305 )
2306 coreconfigitem(
2306 coreconfigitem(
2307 b'ui',
2307 b'ui',
2308 b'origbackuppath',
2308 b'origbackuppath',
2309 default=None,
2309 default=None,
2310 )
2310 )
2311 coreconfigitem(
2311 coreconfigitem(
2312 b'ui',
2312 b'ui',
2313 b'paginate',
2313 b'paginate',
2314 default=True,
2314 default=True,
2315 )
2315 )
2316 coreconfigitem(
2316 coreconfigitem(
2317 b'ui',
2317 b'ui',
2318 b'patch',
2318 b'patch',
2319 default=None,
2319 default=None,
2320 )
2320 )
2321 coreconfigitem(
2321 coreconfigitem(
2322 b'ui',
2322 b'ui',
2323 b'portablefilenames',
2323 b'portablefilenames',
2324 default=b'warn',
2324 default=b'warn',
2325 )
2325 )
2326 coreconfigitem(
2326 coreconfigitem(
2327 b'ui',
2327 b'ui',
2328 b'promptecho',
2328 b'promptecho',
2329 default=False,
2329 default=False,
2330 )
2330 )
2331 coreconfigitem(
2331 coreconfigitem(
2332 b'ui',
2332 b'ui',
2333 b'quiet',
2333 b'quiet',
2334 default=False,
2334 default=False,
2335 )
2335 )
2336 coreconfigitem(
2336 coreconfigitem(
2337 b'ui',
2337 b'ui',
2338 b'quietbookmarkmove',
2338 b'quietbookmarkmove',
2339 default=False,
2339 default=False,
2340 )
2340 )
2341 coreconfigitem(
2341 coreconfigitem(
2342 b'ui',
2342 b'ui',
2343 b'relative-paths',
2343 b'relative-paths',
2344 default=b'legacy',
2344 default=b'legacy',
2345 )
2345 )
2346 coreconfigitem(
2346 coreconfigitem(
2347 b'ui',
2347 b'ui',
2348 b'remotecmd',
2348 b'remotecmd',
2349 default=b'hg',
2349 default=b'hg',
2350 )
2350 )
2351 coreconfigitem(
2351 coreconfigitem(
2352 b'ui',
2352 b'ui',
2353 b'report_untrusted',
2353 b'report_untrusted',
2354 default=True,
2354 default=True,
2355 )
2355 )
2356 coreconfigitem(
2356 coreconfigitem(
2357 b'ui',
2357 b'ui',
2358 b'rollback',
2358 b'rollback',
2359 default=True,
2359 default=True,
2360 )
2360 )
2361 coreconfigitem(
2361 coreconfigitem(
2362 b'ui',
2362 b'ui',
2363 b'signal-safe-lock',
2363 b'signal-safe-lock',
2364 default=True,
2364 default=True,
2365 )
2365 )
2366 coreconfigitem(
2366 coreconfigitem(
2367 b'ui',
2367 b'ui',
2368 b'slash',
2368 b'slash',
2369 default=False,
2369 default=False,
2370 )
2370 )
2371 coreconfigitem(
2371 coreconfigitem(
2372 b'ui',
2372 b'ui',
2373 b'ssh',
2373 b'ssh',
2374 default=b'ssh',
2374 default=b'ssh',
2375 )
2375 )
2376 coreconfigitem(
2376 coreconfigitem(
2377 b'ui',
2377 b'ui',
2378 b'ssherrorhint',
2378 b'ssherrorhint',
2379 default=None,
2379 default=None,
2380 )
2380 )
2381 coreconfigitem(
2381 coreconfigitem(
2382 b'ui',
2382 b'ui',
2383 b'statuscopies',
2383 b'statuscopies',
2384 default=False,
2384 default=False,
2385 )
2385 )
2386 coreconfigitem(
2386 coreconfigitem(
2387 b'ui',
2387 b'ui',
2388 b'strict',
2388 b'strict',
2389 default=False,
2389 default=False,
2390 )
2390 )
2391 coreconfigitem(
2391 coreconfigitem(
2392 b'ui',
2392 b'ui',
2393 b'style',
2393 b'style',
2394 default=b'',
2394 default=b'',
2395 )
2395 )
2396 coreconfigitem(
2396 coreconfigitem(
2397 b'ui',
2397 b'ui',
2398 b'supportcontact',
2398 b'supportcontact',
2399 default=None,
2399 default=None,
2400 )
2400 )
2401 coreconfigitem(
2401 coreconfigitem(
2402 b'ui',
2402 b'ui',
2403 b'textwidth',
2403 b'textwidth',
2404 default=78,
2404 default=78,
2405 )
2405 )
2406 coreconfigitem(
2406 coreconfigitem(
2407 b'ui',
2407 b'ui',
2408 b'timeout',
2408 b'timeout',
2409 default=b'600',
2409 default=b'600',
2410 )
2410 )
2411 coreconfigitem(
2411 coreconfigitem(
2412 b'ui',
2412 b'ui',
2413 b'timeout.warn',
2413 b'timeout.warn',
2414 default=0,
2414 default=0,
2415 )
2415 )
2416 coreconfigitem(
2416 coreconfigitem(
2417 b'ui',
2417 b'ui',
2418 b'timestamp-output',
2418 b'timestamp-output',
2419 default=False,
2419 default=False,
2420 )
2420 )
2421 coreconfigitem(
2421 coreconfigitem(
2422 b'ui',
2422 b'ui',
2423 b'traceback',
2423 b'traceback',
2424 default=False,
2424 default=False,
2425 )
2425 )
2426 coreconfigitem(
2426 coreconfigitem(
2427 b'ui',
2427 b'ui',
2428 b'tweakdefaults',
2428 b'tweakdefaults',
2429 default=False,
2429 default=False,
2430 )
2430 )
2431 coreconfigitem(b'ui', b'username', alias=[(b'ui', b'user')])
2431 coreconfigitem(b'ui', b'username', alias=[(b'ui', b'user')])
2432 coreconfigitem(
2432 coreconfigitem(
2433 b'ui',
2433 b'ui',
2434 b'verbose',
2434 b'verbose',
2435 default=False,
2435 default=False,
2436 )
2436 )
2437 coreconfigitem(
2437 coreconfigitem(
2438 b'verify',
2438 b'verify',
2439 b'skipflags',
2439 b'skipflags',
2440 default=None,
2440 default=None,
2441 )
2441 )
2442 coreconfigitem(
2442 coreconfigitem(
2443 b'web',
2443 b'web',
2444 b'allowbz2',
2444 b'allowbz2',
2445 default=False,
2445 default=False,
2446 )
2446 )
2447 coreconfigitem(
2447 coreconfigitem(
2448 b'web',
2448 b'web',
2449 b'allowgz',
2449 b'allowgz',
2450 default=False,
2450 default=False,
2451 )
2451 )
2452 coreconfigitem(
2452 coreconfigitem(
2453 b'web',
2453 b'web',
2454 b'allow-pull',
2454 b'allow-pull',
2455 alias=[(b'web', b'allowpull')],
2455 alias=[(b'web', b'allowpull')],
2456 default=True,
2456 default=True,
2457 )
2457 )
2458 coreconfigitem(
2458 coreconfigitem(
2459 b'web',
2459 b'web',
2460 b'allow-push',
2460 b'allow-push',
2461 alias=[(b'web', b'allow_push')],
2461 alias=[(b'web', b'allow_push')],
2462 default=list,
2462 default=list,
2463 )
2463 )
2464 coreconfigitem(
2464 coreconfigitem(
2465 b'web',
2465 b'web',
2466 b'allowzip',
2466 b'allowzip',
2467 default=False,
2467 default=False,
2468 )
2468 )
2469 coreconfigitem(
2469 coreconfigitem(
2470 b'web',
2470 b'web',
2471 b'archivesubrepos',
2471 b'archivesubrepos',
2472 default=False,
2472 default=False,
2473 )
2473 )
2474 coreconfigitem(
2474 coreconfigitem(
2475 b'web',
2475 b'web',
2476 b'cache',
2476 b'cache',
2477 default=True,
2477 default=True,
2478 )
2478 )
2479 coreconfigitem(
2479 coreconfigitem(
2480 b'web',
2480 b'web',
2481 b'comparisoncontext',
2481 b'comparisoncontext',
2482 default=5,
2482 default=5,
2483 )
2483 )
2484 coreconfigitem(
2484 coreconfigitem(
2485 b'web',
2485 b'web',
2486 b'contact',
2486 b'contact',
2487 default=None,
2487 default=None,
2488 )
2488 )
2489 coreconfigitem(
2489 coreconfigitem(
2490 b'web',
2490 b'web',
2491 b'deny_push',
2491 b'deny_push',
2492 default=list,
2492 default=list,
2493 )
2493 )
2494 coreconfigitem(
2494 coreconfigitem(
2495 b'web',
2495 b'web',
2496 b'guessmime',
2496 b'guessmime',
2497 default=False,
2497 default=False,
2498 )
2498 )
2499 coreconfigitem(
2499 coreconfigitem(
2500 b'web',
2500 b'web',
2501 b'hidden',
2501 b'hidden',
2502 default=False,
2502 default=False,
2503 )
2503 )
2504 coreconfigitem(
2504 coreconfigitem(
2505 b'web',
2505 b'web',
2506 b'labels',
2506 b'labels',
2507 default=list,
2507 default=list,
2508 )
2508 )
2509 coreconfigitem(
2509 coreconfigitem(
2510 b'web',
2510 b'web',
2511 b'logoimg',
2511 b'logoimg',
2512 default=b'hglogo.png',
2512 default=b'hglogo.png',
2513 )
2513 )
2514 coreconfigitem(
2514 coreconfigitem(
2515 b'web',
2515 b'web',
2516 b'logourl',
2516 b'logourl',
2517 default=b'https://mercurial-scm.org/',
2517 default=b'https://mercurial-scm.org/',
2518 )
2518 )
2519 coreconfigitem(
2519 coreconfigitem(
2520 b'web',
2520 b'web',
2521 b'accesslog',
2521 b'accesslog',
2522 default=b'-',
2522 default=b'-',
2523 )
2523 )
2524 coreconfigitem(
2524 coreconfigitem(
2525 b'web',
2525 b'web',
2526 b'address',
2526 b'address',
2527 default=b'',
2527 default=b'',
2528 )
2528 )
2529 coreconfigitem(
2529 coreconfigitem(
2530 b'web',
2530 b'web',
2531 b'allow-archive',
2531 b'allow-archive',
2532 alias=[(b'web', b'allow_archive')],
2532 alias=[(b'web', b'allow_archive')],
2533 default=list,
2533 default=list,
2534 )
2534 )
2535 coreconfigitem(
2535 coreconfigitem(
2536 b'web',
2536 b'web',
2537 b'allow_read',
2537 b'allow_read',
2538 default=list,
2538 default=list,
2539 )
2539 )
2540 coreconfigitem(
2540 coreconfigitem(
2541 b'web',
2541 b'web',
2542 b'baseurl',
2542 b'baseurl',
2543 default=None,
2543 default=None,
2544 )
2544 )
2545 coreconfigitem(
2545 coreconfigitem(
2546 b'web',
2546 b'web',
2547 b'cacerts',
2547 b'cacerts',
2548 default=None,
2548 default=None,
2549 )
2549 )
2550 coreconfigitem(
2550 coreconfigitem(
2551 b'web',
2551 b'web',
2552 b'certificate',
2552 b'certificate',
2553 default=None,
2553 default=None,
2554 )
2554 )
2555 coreconfigitem(
2555 coreconfigitem(
2556 b'web',
2556 b'web',
2557 b'collapse',
2557 b'collapse',
2558 default=False,
2558 default=False,
2559 )
2559 )
2560 coreconfigitem(
2560 coreconfigitem(
2561 b'web',
2561 b'web',
2562 b'csp',
2562 b'csp',
2563 default=None,
2563 default=None,
2564 )
2564 )
2565 coreconfigitem(
2565 coreconfigitem(
2566 b'web',
2566 b'web',
2567 b'deny_read',
2567 b'deny_read',
2568 default=list,
2568 default=list,
2569 )
2569 )
2570 coreconfigitem(
2570 coreconfigitem(
2571 b'web',
2571 b'web',
2572 b'descend',
2572 b'descend',
2573 default=True,
2573 default=True,
2574 )
2574 )
2575 coreconfigitem(
2575 coreconfigitem(
2576 b'web',
2576 b'web',
2577 b'description',
2577 b'description',
2578 default=b"",
2578 default=b"",
2579 )
2579 )
2580 coreconfigitem(
2580 coreconfigitem(
2581 b'web',
2581 b'web',
2582 b'encoding',
2582 b'encoding',
2583 default=lambda: encoding.encoding,
2583 default=lambda: encoding.encoding,
2584 )
2584 )
2585 coreconfigitem(
2585 coreconfigitem(
2586 b'web',
2586 b'web',
2587 b'errorlog',
2587 b'errorlog',
2588 default=b'-',
2588 default=b'-',
2589 )
2589 )
2590 coreconfigitem(
2590 coreconfigitem(
2591 b'web',
2591 b'web',
2592 b'ipv6',
2592 b'ipv6',
2593 default=False,
2593 default=False,
2594 )
2594 )
2595 coreconfigitem(
2595 coreconfigitem(
2596 b'web',
2596 b'web',
2597 b'maxchanges',
2597 b'maxchanges',
2598 default=10,
2598 default=10,
2599 )
2599 )
2600 coreconfigitem(
2600 coreconfigitem(
2601 b'web',
2601 b'web',
2602 b'maxfiles',
2602 b'maxfiles',
2603 default=10,
2603 default=10,
2604 )
2604 )
2605 coreconfigitem(
2605 coreconfigitem(
2606 b'web',
2606 b'web',
2607 b'maxshortchanges',
2607 b'maxshortchanges',
2608 default=60,
2608 default=60,
2609 )
2609 )
2610 coreconfigitem(
2610 coreconfigitem(
2611 b'web',
2611 b'web',
2612 b'motd',
2612 b'motd',
2613 default=b'',
2613 default=b'',
2614 )
2614 )
2615 coreconfigitem(
2615 coreconfigitem(
2616 b'web',
2616 b'web',
2617 b'name',
2617 b'name',
2618 default=dynamicdefault,
2618 default=dynamicdefault,
2619 )
2619 )
2620 coreconfigitem(
2620 coreconfigitem(
2621 b'web',
2621 b'web',
2622 b'port',
2622 b'port',
2623 default=8000,
2623 default=8000,
2624 )
2624 )
2625 coreconfigitem(
2625 coreconfigitem(
2626 b'web',
2626 b'web',
2627 b'prefix',
2627 b'prefix',
2628 default=b'',
2628 default=b'',
2629 )
2629 )
2630 coreconfigitem(
2630 coreconfigitem(
2631 b'web',
2631 b'web',
2632 b'push_ssl',
2632 b'push_ssl',
2633 default=True,
2633 default=True,
2634 )
2634 )
2635 coreconfigitem(
2635 coreconfigitem(
2636 b'web',
2636 b'web',
2637 b'refreshinterval',
2637 b'refreshinterval',
2638 default=20,
2638 default=20,
2639 )
2639 )
2640 coreconfigitem(
2640 coreconfigitem(
2641 b'web',
2641 b'web',
2642 b'server-header',
2642 b'server-header',
2643 default=None,
2643 default=None,
2644 )
2644 )
2645 coreconfigitem(
2645 coreconfigitem(
2646 b'web',
2646 b'web',
2647 b'static',
2647 b'static',
2648 default=None,
2648 default=None,
2649 )
2649 )
2650 coreconfigitem(
2650 coreconfigitem(
2651 b'web',
2651 b'web',
2652 b'staticurl',
2652 b'staticurl',
2653 default=None,
2653 default=None,
2654 )
2654 )
2655 coreconfigitem(
2655 coreconfigitem(
2656 b'web',
2656 b'web',
2657 b'stripes',
2657 b'stripes',
2658 default=1,
2658 default=1,
2659 )
2659 )
2660 coreconfigitem(
2660 coreconfigitem(
2661 b'web',
2661 b'web',
2662 b'style',
2662 b'style',
2663 default=b'paper',
2663 default=b'paper',
2664 )
2664 )
2665 coreconfigitem(
2665 coreconfigitem(
2666 b'web',
2666 b'web',
2667 b'templates',
2667 b'templates',
2668 default=None,
2668 default=None,
2669 )
2669 )
2670 coreconfigitem(
2670 coreconfigitem(
2671 b'web',
2671 b'web',
2672 b'view',
2672 b'view',
2673 default=b'served',
2673 default=b'served',
2674 experimental=True,
2674 experimental=True,
2675 )
2675 )
2676 coreconfigitem(
2676 coreconfigitem(
2677 b'worker',
2677 b'worker',
2678 b'backgroundclose',
2678 b'backgroundclose',
2679 default=dynamicdefault,
2679 default=dynamicdefault,
2680 )
2680 )
2681 # Windows defaults to a limit of 512 open files. A buffer of 128
2681 # Windows defaults to a limit of 512 open files. A buffer of 128
2682 # should give us enough headway.
2682 # should give us enough headway.
2683 coreconfigitem(
2683 coreconfigitem(
2684 b'worker',
2684 b'worker',
2685 b'backgroundclosemaxqueue',
2685 b'backgroundclosemaxqueue',
2686 default=384,
2686 default=384,
2687 )
2687 )
2688 coreconfigitem(
2688 coreconfigitem(
2689 b'worker',
2689 b'worker',
2690 b'backgroundcloseminfilecount',
2690 b'backgroundcloseminfilecount',
2691 default=2048,
2691 default=2048,
2692 )
2692 )
2693 coreconfigitem(
2693 coreconfigitem(
2694 b'worker',
2694 b'worker',
2695 b'backgroundclosethreadcount',
2695 b'backgroundclosethreadcount',
2696 default=4,
2696 default=4,
2697 )
2697 )
2698 coreconfigitem(
2698 coreconfigitem(
2699 b'worker',
2699 b'worker',
2700 b'enabled',
2700 b'enabled',
2701 default=True,
2701 default=True,
2702 )
2702 )
2703 coreconfigitem(
2703 coreconfigitem(
2704 b'worker',
2704 b'worker',
2705 b'numcpus',
2705 b'numcpus',
2706 default=None,
2706 default=None,
2707 )
2707 )
2708
2708
2709 # Rebase related configuration moved to core because other extension are doing
2709 # Rebase related configuration moved to core because other extension are doing
2710 # strange things. For example, shelve import the extensions to reuse some bit
2710 # strange things. For example, shelve import the extensions to reuse some bit
2711 # without formally loading it.
2711 # without formally loading it.
2712 coreconfigitem(
2712 coreconfigitem(
2713 b'commands',
2713 b'commands',
2714 b'rebase.requiredest',
2714 b'rebase.requiredest',
2715 default=False,
2715 default=False,
2716 )
2716 )
2717 coreconfigitem(
2717 coreconfigitem(
2718 b'experimental',
2718 b'experimental',
2719 b'rebaseskipobsolete',
2719 b'rebaseskipobsolete',
2720 default=True,
2720 default=True,
2721 )
2721 )
2722 coreconfigitem(
2722 coreconfigitem(
2723 b'rebase',
2723 b'rebase',
2724 b'singletransaction',
2724 b'singletransaction',
2725 default=False,
2725 default=False,
2726 )
2726 )
2727 coreconfigitem(
2727 coreconfigitem(
2728 b'rebase',
2728 b'rebase',
2729 b'experimental.inmemory',
2729 b'experimental.inmemory',
2730 default=False,
2730 default=False,
2731 )
2731 )
@@ -1,957 +1,958 b''
1 # extensions.py - extension handling for mercurial
1 # extensions.py - extension handling for mercurial
2 #
2 #
3 # Copyright 2005-2007 Olivia Mackall <olivia@selenic.com>
3 # Copyright 2005-2007 Olivia Mackall <olivia@selenic.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 ast
10 import ast
11 import collections
11 import collections
12 import functools
12 import functools
13 import imp
13 import imp
14 import inspect
14 import inspect
15 import os
15 import os
16
16
17 from .i18n import (
17 from .i18n import (
18 _,
18 _,
19 gettext,
19 gettext,
20 )
20 )
21 from .pycompat import (
21 from .pycompat import (
22 getattr,
22 getattr,
23 open,
23 open,
24 setattr,
24 setattr,
25 )
25 )
26
26
27 from . import (
27 from . import (
28 cmdutil,
28 cmdutil,
29 configitems,
29 configitems,
30 error,
30 error,
31 pycompat,
31 pycompat,
32 util,
32 util,
33 )
33 )
34
34
35 from .utils import stringutil
35 from .utils import stringutil
36
36
37 _extensions = {}
37 _extensions = {}
38 _disabledextensions = {}
38 _disabledextensions = {}
39 _aftercallbacks = {}
39 _aftercallbacks = {}
40 _order = []
40 _order = []
41 _builtin = {
41 _builtin = {
42 b'hbisect',
42 b'hbisect',
43 b'bookmarks',
43 b'bookmarks',
44 b'color',
44 b'color',
45 b'parentrevspec',
45 b'parentrevspec',
46 b'progress',
46 b'progress',
47 b'interhg',
47 b'interhg',
48 b'inotify',
48 b'inotify',
49 b'hgcia',
49 b'hgcia',
50 b'shelve',
50 b'shelve',
51 }
51 }
52
52
53
53
54 def extensions(ui=None):
54 def extensions(ui=None):
55 if ui:
55 if ui:
56
56
57 def enabled(name):
57 def enabled(name):
58 for format in [b'%s', b'hgext.%s']:
58 for format in [b'%s', b'hgext.%s']:
59 conf = ui.config(b'extensions', format % name)
59 conf = ui.config(b'extensions', format % name)
60 if conf is not None and not conf.startswith(b'!'):
60 if conf is not None and not conf.startswith(b'!'):
61 return True
61 return True
62
62
63 else:
63 else:
64 enabled = lambda name: True
64 enabled = lambda name: True
65 for name in _order:
65 for name in _order:
66 module = _extensions[name]
66 module = _extensions[name]
67 if module and enabled(name):
67 if module and enabled(name):
68 yield name, module
68 yield name, module
69
69
70
70
71 def find(name):
71 def find(name):
72 '''return module with given extension name'''
72 '''return module with given extension name'''
73 mod = None
73 mod = None
74 try:
74 try:
75 mod = _extensions[name]
75 mod = _extensions[name]
76 except KeyError:
76 except KeyError:
77 for k, v in pycompat.iteritems(_extensions):
77 for k, v in pycompat.iteritems(_extensions):
78 if k.endswith(b'.' + name) or k.endswith(b'/' + name):
78 if k.endswith(b'.' + name) or k.endswith(b'/' + name):
79 mod = v
79 mod = v
80 break
80 break
81 if not mod:
81 if not mod:
82 raise KeyError(name)
82 raise KeyError(name)
83 return mod
83 return mod
84
84
85
85
86 def loadpath(path, module_name):
86 def loadpath(path, module_name):
87 module_name = module_name.replace(b'.', b'_')
87 module_name = module_name.replace(b'.', b'_')
88 path = util.normpath(util.expandpath(path))
88 path = util.normpath(util.expandpath(path))
89 module_name = pycompat.fsdecode(module_name)
89 module_name = pycompat.fsdecode(module_name)
90 path = pycompat.fsdecode(path)
90 path = pycompat.fsdecode(path)
91 if os.path.isdir(path):
91 if os.path.isdir(path):
92 # module/__init__.py style
92 # module/__init__.py style
93 d, f = os.path.split(path)
93 d, f = os.path.split(path)
94 fd, fpath, desc = imp.find_module(f, [d])
94 fd, fpath, desc = imp.find_module(f, [d])
95 # When https://github.com/python/typeshed/issues/3466 is fixed
95 # When https://github.com/python/typeshed/issues/3466 is fixed
96 # and in a pytype release we can drop this disable.
96 # and in a pytype release we can drop this disable.
97 return imp.load_module(
97 return imp.load_module(
98 module_name, fd, fpath, desc # pytype: disable=wrong-arg-types
98 module_name, fd, fpath, desc # pytype: disable=wrong-arg-types
99 )
99 )
100 else:
100 else:
101 try:
101 try:
102 return imp.load_source(module_name, path)
102 return imp.load_source(module_name, path)
103 except IOError as exc:
103 except IOError as exc:
104 if not exc.filename:
104 if not exc.filename:
105 exc.filename = path # python does not fill this
105 exc.filename = path # python does not fill this
106 raise
106 raise
107
107
108
108
109 def _importh(name):
109 def _importh(name):
110 """import and return the <name> module"""
110 """import and return the <name> module"""
111 mod = __import__(pycompat.sysstr(name))
111 mod = __import__(pycompat.sysstr(name))
112 components = name.split(b'.')
112 components = name.split(b'.')
113 for comp in components[1:]:
113 for comp in components[1:]:
114 mod = getattr(mod, comp)
114 mod = getattr(mod, comp)
115 return mod
115 return mod
116
116
117
117
118 def _importext(name, path=None, reportfunc=None):
118 def _importext(name, path=None, reportfunc=None):
119 if path:
119 if path:
120 # the module will be loaded in sys.modules
120 # the module will be loaded in sys.modules
121 # choose an unique name so that it doesn't
121 # choose an unique name so that it doesn't
122 # conflicts with other modules
122 # conflicts with other modules
123 mod = loadpath(path, b'hgext.%s' % name)
123 mod = loadpath(path, b'hgext.%s' % name)
124 else:
124 else:
125 try:
125 try:
126 mod = _importh(b"hgext.%s" % name)
126 mod = _importh(b"hgext.%s" % name)
127 except ImportError as err:
127 except ImportError as err:
128 if reportfunc:
128 if reportfunc:
129 reportfunc(err, b"hgext.%s" % name, b"hgext3rd.%s" % name)
129 reportfunc(err, b"hgext.%s" % name, b"hgext3rd.%s" % name)
130 try:
130 try:
131 mod = _importh(b"hgext3rd.%s" % name)
131 mod = _importh(b"hgext3rd.%s" % name)
132 except ImportError as err:
132 except ImportError as err:
133 if reportfunc:
133 if reportfunc:
134 reportfunc(err, b"hgext3rd.%s" % name, name)
134 reportfunc(err, b"hgext3rd.%s" % name, name)
135 mod = _importh(name)
135 mod = _importh(name)
136 return mod
136 return mod
137
137
138
138
139 def _reportimporterror(ui, err, failed, next):
139 def _reportimporterror(ui, err, failed, next):
140 # note: this ui.log happens before --debug is processed,
140 # note: this ui.log happens before --debug is processed,
141 # Use --config ui.debug=1 to see them.
141 # Use --config ui.debug=1 to see them.
142 ui.log(
142 ui.log(
143 b'extension',
143 b'extension',
144 b' - could not import %s (%s): trying %s\n',
144 b' - could not import %s (%s): trying %s\n',
145 failed,
145 failed,
146 stringutil.forcebytestr(err),
146 stringutil.forcebytestr(err),
147 next,
147 next,
148 )
148 )
149 if ui.debugflag and ui.configbool(b'devel', b'debug.extensions'):
149 if ui.debugflag and ui.configbool(b'devel', b'debug.extensions'):
150 ui.traceback()
150 ui.traceback()
151
151
152
152
153 def _rejectunicode(name, xs):
153 def _rejectunicode(name, xs):
154 if isinstance(xs, (list, set, tuple)):
154 if isinstance(xs, (list, set, tuple)):
155 for x in xs:
155 for x in xs:
156 _rejectunicode(name, x)
156 _rejectunicode(name, x)
157 elif isinstance(xs, dict):
157 elif isinstance(xs, dict):
158 for k, v in xs.items():
158 for k, v in xs.items():
159 _rejectunicode(name, k)
159 _rejectunicode(name, k)
160 _rejectunicode(b'%s.%s' % (name, stringutil.forcebytestr(k)), v)
160 _rejectunicode(b'%s.%s' % (name, stringutil.forcebytestr(k)), v)
161 elif isinstance(xs, type(u'')):
161 elif isinstance(xs, type(u'')):
162 raise error.ProgrammingError(
162 raise error.ProgrammingError(
163 b"unicode %r found in %s" % (xs, name),
163 b"unicode %r found in %s" % (xs, name),
164 hint=b"use b'' to make it byte string",
164 hint=b"use b'' to make it byte string",
165 )
165 )
166
166
167
167
168 # attributes set by registrar.command
168 # attributes set by registrar.command
169 _cmdfuncattrs = (b'norepo', b'optionalrepo', b'inferrepo')
169 _cmdfuncattrs = (b'norepo', b'optionalrepo', b'inferrepo')
170
170
171
171
172 def _validatecmdtable(ui, cmdtable):
172 def _validatecmdtable(ui, cmdtable):
173 """Check if extension commands have required attributes"""
173 """Check if extension commands have required attributes"""
174 for c, e in pycompat.iteritems(cmdtable):
174 for c, e in pycompat.iteritems(cmdtable):
175 f = e[0]
175 f = e[0]
176 missing = [a for a in _cmdfuncattrs if not util.safehasattr(f, a)]
176 missing = [a for a in _cmdfuncattrs if not util.safehasattr(f, a)]
177 if not missing:
177 if not missing:
178 continue
178 continue
179 raise error.ProgrammingError(
179 raise error.ProgrammingError(
180 b'missing attributes: %s' % b', '.join(missing),
180 b'missing attributes: %s' % b', '.join(missing),
181 hint=b"use @command decorator to register '%s'" % c,
181 hint=b"use @command decorator to register '%s'" % c,
182 )
182 )
183
183
184
184
185 def _validatetables(ui, mod):
185 def _validatetables(ui, mod):
186 """Sanity check for loadable tables provided by extension module"""
186 """Sanity check for loadable tables provided by extension module"""
187 for t in [b'cmdtable', b'colortable', b'configtable']:
187 for t in [b'cmdtable', b'colortable', b'configtable']:
188 _rejectunicode(t, getattr(mod, t, {}))
188 _rejectunicode(t, getattr(mod, t, {}))
189 for t in [
189 for t in [
190 b'filesetpredicate',
190 b'filesetpredicate',
191 b'internalmerge',
191 b'internalmerge',
192 b'revsetpredicate',
192 b'revsetpredicate',
193 b'templatefilter',
193 b'templatefilter',
194 b'templatefunc',
194 b'templatefunc',
195 b'templatekeyword',
195 b'templatekeyword',
196 ]:
196 ]:
197 o = getattr(mod, t, None)
197 o = getattr(mod, t, None)
198 if o:
198 if o:
199 _rejectunicode(t, o._table)
199 _rejectunicode(t, o._table)
200 _validatecmdtable(ui, getattr(mod, 'cmdtable', {}))
200 _validatecmdtable(ui, getattr(mod, 'cmdtable', {}))
201
201
202
202
203 def load(ui, name, path, loadingtime=None):
203 def load(ui, name, path, loadingtime=None):
204 if name.startswith(b'hgext.') or name.startswith(b'hgext/'):
204 if name.startswith(b'hgext.') or name.startswith(b'hgext/'):
205 shortname = name[6:]
205 shortname = name[6:]
206 else:
206 else:
207 shortname = name
207 shortname = name
208 if shortname in _builtin:
208 if shortname in _builtin:
209 return None
209 return None
210 if shortname in _extensions:
210 if shortname in _extensions:
211 return _extensions[shortname]
211 return _extensions[shortname]
212 ui.log(b'extension', b' - loading extension: %s\n', shortname)
212 ui.log(b'extension', b' - loading extension: %s\n', shortname)
213 _extensions[shortname] = None
213 _extensions[shortname] = None
214 with util.timedcm('load extension %s', shortname) as stats:
214 with util.timedcm('load extension %s', shortname) as stats:
215 mod = _importext(name, path, bind(_reportimporterror, ui))
215 mod = _importext(name, path, bind(_reportimporterror, ui))
216 ui.log(b'extension', b' > %s extension loaded in %s\n', shortname, stats)
216 ui.log(b'extension', b' > %s extension loaded in %s\n', shortname, stats)
217 if loadingtime is not None:
217 if loadingtime is not None:
218 loadingtime[shortname] += stats.elapsed
218 loadingtime[shortname] += stats.elapsed
219
219
220 # Before we do anything with the extension, check against minimum stated
220 # Before we do anything with the extension, check against minimum stated
221 # compatibility. This gives extension authors a mechanism to have their
221 # compatibility. This gives extension authors a mechanism to have their
222 # extensions short circuit when loaded with a known incompatible version
222 # extensions short circuit when loaded with a known incompatible version
223 # of Mercurial.
223 # of Mercurial.
224 minver = getattr(mod, 'minimumhgversion', None)
224 minver = getattr(mod, 'minimumhgversion', None)
225 if minver:
225 if minver:
226 curver = util.versiontuple(n=2)
226 curver = util.versiontuple(n=2)
227 extmin = util.versiontuple(stringutil.forcebytestr(minver), 2)
227 extmin = util.versiontuple(stringutil.forcebytestr(minver), 2)
228
228
229 if None in extmin:
229 if None in extmin:
230 extmin = (extmin[0] or 0, extmin[1] or 0)
230 extmin = (extmin[0] or 0, extmin[1] or 0)
231
231
232 if None in curver or extmin > curver:
232 if None in curver or extmin > curver:
233 msg = _(
233 msg = _(
234 b'(third party extension %s requires version %s or newer '
234 b'(third party extension %s requires version %s or newer '
235 b'of Mercurial (current: %s); disabling)\n'
235 b'of Mercurial (current: %s); disabling)\n'
236 )
236 )
237 ui.warn(msg % (shortname, minver, util.version()))
237 ui.warn(msg % (shortname, minver, util.version()))
238 return
238 return
239 ui.log(b'extension', b' - validating extension tables: %s\n', shortname)
239 ui.log(b'extension', b' - validating extension tables: %s\n', shortname)
240 _validatetables(ui, mod)
240 _validatetables(ui, mod)
241
241
242 _extensions[shortname] = mod
242 _extensions[shortname] = mod
243 _order.append(shortname)
243 _order.append(shortname)
244 ui.log(
244 ui.log(
245 b'extension', b' - invoking registered callbacks: %s\n', shortname
245 b'extension', b' - invoking registered callbacks: %s\n', shortname
246 )
246 )
247 with util.timedcm('callbacks extension %s', shortname) as stats:
247 with util.timedcm('callbacks extension %s', shortname) as stats:
248 for fn in _aftercallbacks.get(shortname, []):
248 for fn in _aftercallbacks.get(shortname, []):
249 fn(loaded=True)
249 fn(loaded=True)
250 ui.log(b'extension', b' > callbacks completed in %s\n', stats)
250 ui.log(b'extension', b' > callbacks completed in %s\n', stats)
251 return mod
251 return mod
252
252
253
253
254 def _runuisetup(name, ui):
254 def _runuisetup(name, ui):
255 uisetup = getattr(_extensions[name], 'uisetup', None)
255 uisetup = getattr(_extensions[name], 'uisetup', None)
256 if uisetup:
256 if uisetup:
257 try:
257 try:
258 uisetup(ui)
258 uisetup(ui)
259 except Exception as inst:
259 except Exception as inst:
260 ui.traceback(force=True)
260 ui.traceback(force=True)
261 msg = stringutil.forcebytestr(inst)
261 msg = stringutil.forcebytestr(inst)
262 ui.warn(_(b"*** failed to set up extension %s: %s\n") % (name, msg))
262 ui.warn(_(b"*** failed to set up extension %s: %s\n") % (name, msg))
263 return False
263 return False
264 return True
264 return True
265
265
266
266
267 def _runextsetup(name, ui):
267 def _runextsetup(name, ui):
268 extsetup = getattr(_extensions[name], 'extsetup', None)
268 extsetup = getattr(_extensions[name], 'extsetup', None)
269 if extsetup:
269 if extsetup:
270 try:
270 try:
271 extsetup(ui)
271 extsetup(ui)
272 except Exception as inst:
272 except Exception as inst:
273 ui.traceback(force=True)
273 ui.traceback(force=True)
274 msg = stringutil.forcebytestr(inst)
274 msg = stringutil.forcebytestr(inst)
275 ui.warn(_(b"*** failed to set up extension %s: %s\n") % (name, msg))
275 ui.warn(_(b"*** failed to set up extension %s: %s\n") % (name, msg))
276 return False
276 return False
277 return True
277 return True
278
278
279
279
280 def loadall(ui, whitelist=None):
280 def loadall(ui, whitelist=None):
281 loadingtime = collections.defaultdict(int)
281 loadingtime = collections.defaultdict(int)
282 result = ui.configitems(b"extensions")
282 result = ui.configitems(b"extensions")
283 if whitelist is not None:
283 if whitelist is not None:
284 result = [(k, v) for (k, v) in result if k in whitelist]
284 result = [(k, v) for (k, v) in result if k in whitelist]
285 result = [(k, v) for (k, v) in result if b':' not in k]
285 newindex = len(_order)
286 newindex = len(_order)
286 ui.log(
287 ui.log(
287 b'extension',
288 b'extension',
288 b'loading %sextensions\n',
289 b'loading %sextensions\n',
289 b'additional ' if newindex else b'',
290 b'additional ' if newindex else b'',
290 )
291 )
291 ui.log(b'extension', b'- processing %d entries\n', len(result))
292 ui.log(b'extension', b'- processing %d entries\n', len(result))
292 with util.timedcm('load all extensions') as stats:
293 with util.timedcm('load all extensions') as stats:
293 for (name, path) in result:
294 for (name, path) in result:
294 if path:
295 if path:
295 if path[0:1] == b'!':
296 if path[0:1] == b'!':
296 if name not in _disabledextensions:
297 if name not in _disabledextensions:
297 ui.log(
298 ui.log(
298 b'extension',
299 b'extension',
299 b' - skipping disabled extension: %s\n',
300 b' - skipping disabled extension: %s\n',
300 name,
301 name,
301 )
302 )
302 _disabledextensions[name] = path[1:]
303 _disabledextensions[name] = path[1:]
303 continue
304 continue
304 try:
305 try:
305 load(ui, name, path, loadingtime)
306 load(ui, name, path, loadingtime)
306 except Exception as inst:
307 except Exception as inst:
307 msg = stringutil.forcebytestr(inst)
308 msg = stringutil.forcebytestr(inst)
308 if path:
309 if path:
309 ui.warn(
310 ui.warn(
310 _(b"*** failed to import extension %s from %s: %s\n")
311 _(b"*** failed to import extension %s from %s: %s\n")
311 % (name, path, msg)
312 % (name, path, msg)
312 )
313 )
313 else:
314 else:
314 ui.warn(
315 ui.warn(
315 _(b"*** failed to import extension %s: %s\n")
316 _(b"*** failed to import extension %s: %s\n")
316 % (name, msg)
317 % (name, msg)
317 )
318 )
318 if isinstance(inst, error.Hint) and inst.hint:
319 if isinstance(inst, error.Hint) and inst.hint:
319 ui.warn(_(b"*** (%s)\n") % inst.hint)
320 ui.warn(_(b"*** (%s)\n") % inst.hint)
320 ui.traceback()
321 ui.traceback()
321
322
322 ui.log(
323 ui.log(
323 b'extension',
324 b'extension',
324 b'> loaded %d extensions, total time %s\n',
325 b'> loaded %d extensions, total time %s\n',
325 len(_order) - newindex,
326 len(_order) - newindex,
326 stats,
327 stats,
327 )
328 )
328 # list of (objname, loadermod, loadername) tuple:
329 # list of (objname, loadermod, loadername) tuple:
329 # - objname is the name of an object in extension module,
330 # - objname is the name of an object in extension module,
330 # from which extra information is loaded
331 # from which extra information is loaded
331 # - loadermod is the module where loader is placed
332 # - loadermod is the module where loader is placed
332 # - loadername is the name of the function,
333 # - loadername is the name of the function,
333 # which takes (ui, extensionname, extraobj) arguments
334 # which takes (ui, extensionname, extraobj) arguments
334 #
335 #
335 # This one is for the list of item that must be run before running any setup
336 # This one is for the list of item that must be run before running any setup
336 earlyextraloaders = [
337 earlyextraloaders = [
337 (b'configtable', configitems, b'loadconfigtable'),
338 (b'configtable', configitems, b'loadconfigtable'),
338 ]
339 ]
339
340
340 ui.log(b'extension', b'- loading configtable attributes\n')
341 ui.log(b'extension', b'- loading configtable attributes\n')
341 _loadextra(ui, newindex, earlyextraloaders)
342 _loadextra(ui, newindex, earlyextraloaders)
342
343
343 broken = set()
344 broken = set()
344 ui.log(b'extension', b'- executing uisetup hooks\n')
345 ui.log(b'extension', b'- executing uisetup hooks\n')
345 with util.timedcm('all uisetup') as alluisetupstats:
346 with util.timedcm('all uisetup') as alluisetupstats:
346 for name in _order[newindex:]:
347 for name in _order[newindex:]:
347 ui.log(b'extension', b' - running uisetup for %s\n', name)
348 ui.log(b'extension', b' - running uisetup for %s\n', name)
348 with util.timedcm('uisetup %s', name) as stats:
349 with util.timedcm('uisetup %s', name) as stats:
349 if not _runuisetup(name, ui):
350 if not _runuisetup(name, ui):
350 ui.log(
351 ui.log(
351 b'extension',
352 b'extension',
352 b' - the %s extension uisetup failed\n',
353 b' - the %s extension uisetup failed\n',
353 name,
354 name,
354 )
355 )
355 broken.add(name)
356 broken.add(name)
356 ui.log(b'extension', b' > uisetup for %s took %s\n', name, stats)
357 ui.log(b'extension', b' > uisetup for %s took %s\n', name, stats)
357 loadingtime[name] += stats.elapsed
358 loadingtime[name] += stats.elapsed
358 ui.log(b'extension', b'> all uisetup took %s\n', alluisetupstats)
359 ui.log(b'extension', b'> all uisetup took %s\n', alluisetupstats)
359
360
360 ui.log(b'extension', b'- executing extsetup hooks\n')
361 ui.log(b'extension', b'- executing extsetup hooks\n')
361 with util.timedcm('all extsetup') as allextetupstats:
362 with util.timedcm('all extsetup') as allextetupstats:
362 for name in _order[newindex:]:
363 for name in _order[newindex:]:
363 if name in broken:
364 if name in broken:
364 continue
365 continue
365 ui.log(b'extension', b' - running extsetup for %s\n', name)
366 ui.log(b'extension', b' - running extsetup for %s\n', name)
366 with util.timedcm('extsetup %s', name) as stats:
367 with util.timedcm('extsetup %s', name) as stats:
367 if not _runextsetup(name, ui):
368 if not _runextsetup(name, ui):
368 ui.log(
369 ui.log(
369 b'extension',
370 b'extension',
370 b' - the %s extension extsetup failed\n',
371 b' - the %s extension extsetup failed\n',
371 name,
372 name,
372 )
373 )
373 broken.add(name)
374 broken.add(name)
374 ui.log(b'extension', b' > extsetup for %s took %s\n', name, stats)
375 ui.log(b'extension', b' > extsetup for %s took %s\n', name, stats)
375 loadingtime[name] += stats.elapsed
376 loadingtime[name] += stats.elapsed
376 ui.log(b'extension', b'> all extsetup took %s\n', allextetupstats)
377 ui.log(b'extension', b'> all extsetup took %s\n', allextetupstats)
377
378
378 for name in broken:
379 for name in broken:
379 ui.log(b'extension', b' - disabling broken %s extension\n', name)
380 ui.log(b'extension', b' - disabling broken %s extension\n', name)
380 _extensions[name] = None
381 _extensions[name] = None
381
382
382 # Call aftercallbacks that were never met.
383 # Call aftercallbacks that were never met.
383 ui.log(b'extension', b'- executing remaining aftercallbacks\n')
384 ui.log(b'extension', b'- executing remaining aftercallbacks\n')
384 with util.timedcm('aftercallbacks') as stats:
385 with util.timedcm('aftercallbacks') as stats:
385 for shortname in _aftercallbacks:
386 for shortname in _aftercallbacks:
386 if shortname in _extensions:
387 if shortname in _extensions:
387 continue
388 continue
388
389
389 for fn in _aftercallbacks[shortname]:
390 for fn in _aftercallbacks[shortname]:
390 ui.log(
391 ui.log(
391 b'extension',
392 b'extension',
392 b' - extension %s not loaded, notify callbacks\n',
393 b' - extension %s not loaded, notify callbacks\n',
393 shortname,
394 shortname,
394 )
395 )
395 fn(loaded=False)
396 fn(loaded=False)
396 ui.log(b'extension', b'> remaining aftercallbacks completed in %s\n', stats)
397 ui.log(b'extension', b'> remaining aftercallbacks completed in %s\n', stats)
397
398
398 # loadall() is called multiple times and lingering _aftercallbacks
399 # loadall() is called multiple times and lingering _aftercallbacks
399 # entries could result in double execution. See issue4646.
400 # entries could result in double execution. See issue4646.
400 _aftercallbacks.clear()
401 _aftercallbacks.clear()
401
402
402 # delay importing avoids cyclic dependency (especially commands)
403 # delay importing avoids cyclic dependency (especially commands)
403 from . import (
404 from . import (
404 color,
405 color,
405 commands,
406 commands,
406 filemerge,
407 filemerge,
407 fileset,
408 fileset,
408 revset,
409 revset,
409 templatefilters,
410 templatefilters,
410 templatefuncs,
411 templatefuncs,
411 templatekw,
412 templatekw,
412 )
413 )
413
414
414 # list of (objname, loadermod, loadername) tuple:
415 # list of (objname, loadermod, loadername) tuple:
415 # - objname is the name of an object in extension module,
416 # - objname is the name of an object in extension module,
416 # from which extra information is loaded
417 # from which extra information is loaded
417 # - loadermod is the module where loader is placed
418 # - loadermod is the module where loader is placed
418 # - loadername is the name of the function,
419 # - loadername is the name of the function,
419 # which takes (ui, extensionname, extraobj) arguments
420 # which takes (ui, extensionname, extraobj) arguments
420 ui.log(b'extension', b'- loading extension registration objects\n')
421 ui.log(b'extension', b'- loading extension registration objects\n')
421 extraloaders = [
422 extraloaders = [
422 (b'cmdtable', commands, b'loadcmdtable'),
423 (b'cmdtable', commands, b'loadcmdtable'),
423 (b'colortable', color, b'loadcolortable'),
424 (b'colortable', color, b'loadcolortable'),
424 (b'filesetpredicate', fileset, b'loadpredicate'),
425 (b'filesetpredicate', fileset, b'loadpredicate'),
425 (b'internalmerge', filemerge, b'loadinternalmerge'),
426 (b'internalmerge', filemerge, b'loadinternalmerge'),
426 (b'revsetpredicate', revset, b'loadpredicate'),
427 (b'revsetpredicate', revset, b'loadpredicate'),
427 (b'templatefilter', templatefilters, b'loadfilter'),
428 (b'templatefilter', templatefilters, b'loadfilter'),
428 (b'templatefunc', templatefuncs, b'loadfunction'),
429 (b'templatefunc', templatefuncs, b'loadfunction'),
429 (b'templatekeyword', templatekw, b'loadkeyword'),
430 (b'templatekeyword', templatekw, b'loadkeyword'),
430 ]
431 ]
431 with util.timedcm('load registration objects') as stats:
432 with util.timedcm('load registration objects') as stats:
432 _loadextra(ui, newindex, extraloaders)
433 _loadextra(ui, newindex, extraloaders)
433 ui.log(
434 ui.log(
434 b'extension',
435 b'extension',
435 b'> extension registration object loading took %s\n',
436 b'> extension registration object loading took %s\n',
436 stats,
437 stats,
437 )
438 )
438
439
439 # Report per extension loading time (except reposetup)
440 # Report per extension loading time (except reposetup)
440 for name in sorted(loadingtime):
441 for name in sorted(loadingtime):
441 ui.log(
442 ui.log(
442 b'extension',
443 b'extension',
443 b'> extension %s take a total of %s to load\n',
444 b'> extension %s take a total of %s to load\n',
444 name,
445 name,
445 util.timecount(loadingtime[name]),
446 util.timecount(loadingtime[name]),
446 )
447 )
447
448
448 ui.log(b'extension', b'extension loading complete\n')
449 ui.log(b'extension', b'extension loading complete\n')
449
450
450
451
451 def _loadextra(ui, newindex, extraloaders):
452 def _loadextra(ui, newindex, extraloaders):
452 for name in _order[newindex:]:
453 for name in _order[newindex:]:
453 module = _extensions[name]
454 module = _extensions[name]
454 if not module:
455 if not module:
455 continue # loading this module failed
456 continue # loading this module failed
456
457
457 for objname, loadermod, loadername in extraloaders:
458 for objname, loadermod, loadername in extraloaders:
458 extraobj = getattr(module, objname, None)
459 extraobj = getattr(module, objname, None)
459 if extraobj is not None:
460 if extraobj is not None:
460 getattr(loadermod, loadername)(ui, name, extraobj)
461 getattr(loadermod, loadername)(ui, name, extraobj)
461
462
462
463
463 def afterloaded(extension, callback):
464 def afterloaded(extension, callback):
464 """Run the specified function after a named extension is loaded.
465 """Run the specified function after a named extension is loaded.
465
466
466 If the named extension is already loaded, the callback will be called
467 If the named extension is already loaded, the callback will be called
467 immediately.
468 immediately.
468
469
469 If the named extension never loads, the callback will be called after
470 If the named extension never loads, the callback will be called after
470 all extensions have been loaded.
471 all extensions have been loaded.
471
472
472 The callback receives the named argument ``loaded``, which is a boolean
473 The callback receives the named argument ``loaded``, which is a boolean
473 indicating whether the dependent extension actually loaded.
474 indicating whether the dependent extension actually loaded.
474 """
475 """
475
476
476 if extension in _extensions:
477 if extension in _extensions:
477 # Report loaded as False if the extension is disabled
478 # Report loaded as False if the extension is disabled
478 loaded = _extensions[extension] is not None
479 loaded = _extensions[extension] is not None
479 callback(loaded=loaded)
480 callback(loaded=loaded)
480 else:
481 else:
481 _aftercallbacks.setdefault(extension, []).append(callback)
482 _aftercallbacks.setdefault(extension, []).append(callback)
482
483
483
484
484 def populateui(ui):
485 def populateui(ui):
485 """Run extension hooks on the given ui to populate additional members,
486 """Run extension hooks on the given ui to populate additional members,
486 extend the class dynamically, etc.
487 extend the class dynamically, etc.
487
488
488 This will be called after the configuration is loaded, and/or extensions
489 This will be called after the configuration is loaded, and/or extensions
489 are loaded. In general, it's once per ui instance, but in command-server
490 are loaded. In general, it's once per ui instance, but in command-server
490 and hgweb, this may be called more than once with the same ui.
491 and hgweb, this may be called more than once with the same ui.
491 """
492 """
492 for name, mod in extensions(ui):
493 for name, mod in extensions(ui):
493 hook = getattr(mod, 'uipopulate', None)
494 hook = getattr(mod, 'uipopulate', None)
494 if not hook:
495 if not hook:
495 continue
496 continue
496 try:
497 try:
497 hook(ui)
498 hook(ui)
498 except Exception as inst:
499 except Exception as inst:
499 ui.traceback(force=True)
500 ui.traceback(force=True)
500 ui.warn(
501 ui.warn(
501 _(b'*** failed to populate ui by extension %s: %s\n')
502 _(b'*** failed to populate ui by extension %s: %s\n')
502 % (name, stringutil.forcebytestr(inst))
503 % (name, stringutil.forcebytestr(inst))
503 )
504 )
504
505
505
506
506 def bind(func, *args):
507 def bind(func, *args):
507 """Partial function application
508 """Partial function application
508
509
509 Returns a new function that is the partial application of args and kwargs
510 Returns a new function that is the partial application of args and kwargs
510 to func. For example,
511 to func. For example,
511
512
512 f(1, 2, bar=3) === bind(f, 1)(2, bar=3)"""
513 f(1, 2, bar=3) === bind(f, 1)(2, bar=3)"""
513 assert callable(func)
514 assert callable(func)
514
515
515 def closure(*a, **kw):
516 def closure(*a, **kw):
516 return func(*(args + a), **kw)
517 return func(*(args + a), **kw)
517
518
518 return closure
519 return closure
519
520
520
521
521 def _updatewrapper(wrap, origfn, unboundwrapper):
522 def _updatewrapper(wrap, origfn, unboundwrapper):
522 '''Copy and add some useful attributes to wrapper'''
523 '''Copy and add some useful attributes to wrapper'''
523 try:
524 try:
524 wrap.__name__ = origfn.__name__
525 wrap.__name__ = origfn.__name__
525 except AttributeError:
526 except AttributeError:
526 pass
527 pass
527 wrap.__module__ = getattr(origfn, '__module__')
528 wrap.__module__ = getattr(origfn, '__module__')
528 wrap.__doc__ = getattr(origfn, '__doc__')
529 wrap.__doc__ = getattr(origfn, '__doc__')
529 wrap.__dict__.update(getattr(origfn, '__dict__', {}))
530 wrap.__dict__.update(getattr(origfn, '__dict__', {}))
530 wrap._origfunc = origfn
531 wrap._origfunc = origfn
531 wrap._unboundwrapper = unboundwrapper
532 wrap._unboundwrapper = unboundwrapper
532
533
533
534
534 def wrapcommand(table, command, wrapper, synopsis=None, docstring=None):
535 def wrapcommand(table, command, wrapper, synopsis=None, docstring=None):
535 '''Wrap the command named `command' in table
536 '''Wrap the command named `command' in table
536
537
537 Replace command in the command table with wrapper. The wrapped command will
538 Replace command in the command table with wrapper. The wrapped command will
538 be inserted into the command table specified by the table argument.
539 be inserted into the command table specified by the table argument.
539
540
540 The wrapper will be called like
541 The wrapper will be called like
541
542
542 wrapper(orig, *args, **kwargs)
543 wrapper(orig, *args, **kwargs)
543
544
544 where orig is the original (wrapped) function, and *args, **kwargs
545 where orig is the original (wrapped) function, and *args, **kwargs
545 are the arguments passed to it.
546 are the arguments passed to it.
546
547
547 Optionally append to the command synopsis and docstring, used for help.
548 Optionally append to the command synopsis and docstring, used for help.
548 For example, if your extension wraps the ``bookmarks`` command to add the
549 For example, if your extension wraps the ``bookmarks`` command to add the
549 flags ``--remote`` and ``--all`` you might call this function like so:
550 flags ``--remote`` and ``--all`` you might call this function like so:
550
551
551 synopsis = ' [-a] [--remote]'
552 synopsis = ' [-a] [--remote]'
552 docstring = """
553 docstring = """
553
554
554 The ``remotenames`` extension adds the ``--remote`` and ``--all`` (``-a``)
555 The ``remotenames`` extension adds the ``--remote`` and ``--all`` (``-a``)
555 flags to the bookmarks command. Either flag will show the remote bookmarks
556 flags to the bookmarks command. Either flag will show the remote bookmarks
556 known to the repository; ``--remote`` will also suppress the output of the
557 known to the repository; ``--remote`` will also suppress the output of the
557 local bookmarks.
558 local bookmarks.
558 """
559 """
559
560
560 extensions.wrapcommand(commands.table, 'bookmarks', exbookmarks,
561 extensions.wrapcommand(commands.table, 'bookmarks', exbookmarks,
561 synopsis, docstring)
562 synopsis, docstring)
562 '''
563 '''
563 assert callable(wrapper)
564 assert callable(wrapper)
564 aliases, entry = cmdutil.findcmd(command, table)
565 aliases, entry = cmdutil.findcmd(command, table)
565 for alias, e in pycompat.iteritems(table):
566 for alias, e in pycompat.iteritems(table):
566 if e is entry:
567 if e is entry:
567 key = alias
568 key = alias
568 break
569 break
569
570
570 origfn = entry[0]
571 origfn = entry[0]
571 wrap = functools.partial(
572 wrap = functools.partial(
572 util.checksignature(wrapper), util.checksignature(origfn)
573 util.checksignature(wrapper), util.checksignature(origfn)
573 )
574 )
574 _updatewrapper(wrap, origfn, wrapper)
575 _updatewrapper(wrap, origfn, wrapper)
575 if docstring is not None:
576 if docstring is not None:
576 wrap.__doc__ += docstring
577 wrap.__doc__ += docstring
577
578
578 newentry = list(entry)
579 newentry = list(entry)
579 newentry[0] = wrap
580 newentry[0] = wrap
580 if synopsis is not None:
581 if synopsis is not None:
581 newentry[2] += synopsis
582 newentry[2] += synopsis
582 table[key] = tuple(newentry)
583 table[key] = tuple(newentry)
583 return entry
584 return entry
584
585
585
586
586 def wrapfilecache(cls, propname, wrapper):
587 def wrapfilecache(cls, propname, wrapper):
587 """Wraps a filecache property.
588 """Wraps a filecache property.
588
589
589 These can't be wrapped using the normal wrapfunction.
590 These can't be wrapped using the normal wrapfunction.
590 """
591 """
591 propname = pycompat.sysstr(propname)
592 propname = pycompat.sysstr(propname)
592 assert callable(wrapper)
593 assert callable(wrapper)
593 for currcls in cls.__mro__:
594 for currcls in cls.__mro__:
594 if propname in currcls.__dict__:
595 if propname in currcls.__dict__:
595 origfn = currcls.__dict__[propname].func
596 origfn = currcls.__dict__[propname].func
596 assert callable(origfn)
597 assert callable(origfn)
597
598
598 def wrap(*args, **kwargs):
599 def wrap(*args, **kwargs):
599 return wrapper(origfn, *args, **kwargs)
600 return wrapper(origfn, *args, **kwargs)
600
601
601 currcls.__dict__[propname].func = wrap
602 currcls.__dict__[propname].func = wrap
602 break
603 break
603
604
604 if currcls is object:
605 if currcls is object:
605 raise AttributeError("type '%s' has no property '%s'" % (cls, propname))
606 raise AttributeError("type '%s' has no property '%s'" % (cls, propname))
606
607
607
608
608 class wrappedfunction(object):
609 class wrappedfunction(object):
609 '''context manager for temporarily wrapping a function'''
610 '''context manager for temporarily wrapping a function'''
610
611
611 def __init__(self, container, funcname, wrapper):
612 def __init__(self, container, funcname, wrapper):
612 assert callable(wrapper)
613 assert callable(wrapper)
613 self._container = container
614 self._container = container
614 self._funcname = funcname
615 self._funcname = funcname
615 self._wrapper = wrapper
616 self._wrapper = wrapper
616
617
617 def __enter__(self):
618 def __enter__(self):
618 wrapfunction(self._container, self._funcname, self._wrapper)
619 wrapfunction(self._container, self._funcname, self._wrapper)
619
620
620 def __exit__(self, exctype, excvalue, traceback):
621 def __exit__(self, exctype, excvalue, traceback):
621 unwrapfunction(self._container, self._funcname, self._wrapper)
622 unwrapfunction(self._container, self._funcname, self._wrapper)
622
623
623
624
624 def wrapfunction(container, funcname, wrapper):
625 def wrapfunction(container, funcname, wrapper):
625 """Wrap the function named funcname in container
626 """Wrap the function named funcname in container
626
627
627 Replace the funcname member in the given container with the specified
628 Replace the funcname member in the given container with the specified
628 wrapper. The container is typically a module, class, or instance.
629 wrapper. The container is typically a module, class, or instance.
629
630
630 The wrapper will be called like
631 The wrapper will be called like
631
632
632 wrapper(orig, *args, **kwargs)
633 wrapper(orig, *args, **kwargs)
633
634
634 where orig is the original (wrapped) function, and *args, **kwargs
635 where orig is the original (wrapped) function, and *args, **kwargs
635 are the arguments passed to it.
636 are the arguments passed to it.
636
637
637 Wrapping methods of the repository object is not recommended since
638 Wrapping methods of the repository object is not recommended since
638 it conflicts with extensions that extend the repository by
639 it conflicts with extensions that extend the repository by
639 subclassing. All extensions that need to extend methods of
640 subclassing. All extensions that need to extend methods of
640 localrepository should use this subclassing trick: namely,
641 localrepository should use this subclassing trick: namely,
641 reposetup() should look like
642 reposetup() should look like
642
643
643 def reposetup(ui, repo):
644 def reposetup(ui, repo):
644 class myrepo(repo.__class__):
645 class myrepo(repo.__class__):
645 def whatever(self, *args, **kwargs):
646 def whatever(self, *args, **kwargs):
646 [...extension stuff...]
647 [...extension stuff...]
647 super(myrepo, self).whatever(*args, **kwargs)
648 super(myrepo, self).whatever(*args, **kwargs)
648 [...extension stuff...]
649 [...extension stuff...]
649
650
650 repo.__class__ = myrepo
651 repo.__class__ = myrepo
651
652
652 In general, combining wrapfunction() with subclassing does not
653 In general, combining wrapfunction() with subclassing does not
653 work. Since you cannot control what other extensions are loaded by
654 work. Since you cannot control what other extensions are loaded by
654 your end users, you should play nicely with others by using the
655 your end users, you should play nicely with others by using the
655 subclass trick.
656 subclass trick.
656 """
657 """
657 assert callable(wrapper)
658 assert callable(wrapper)
658
659
659 origfn = getattr(container, funcname)
660 origfn = getattr(container, funcname)
660 assert callable(origfn)
661 assert callable(origfn)
661 if inspect.ismodule(container):
662 if inspect.ismodule(container):
662 # origfn is not an instance or class method. "partial" can be used.
663 # origfn is not an instance or class method. "partial" can be used.
663 # "partial" won't insert a frame in traceback.
664 # "partial" won't insert a frame in traceback.
664 wrap = functools.partial(wrapper, origfn)
665 wrap = functools.partial(wrapper, origfn)
665 else:
666 else:
666 # "partial" cannot be safely used. Emulate its effect by using "bind".
667 # "partial" cannot be safely used. Emulate its effect by using "bind".
667 # The downside is one more frame in traceback.
668 # The downside is one more frame in traceback.
668 wrap = bind(wrapper, origfn)
669 wrap = bind(wrapper, origfn)
669 _updatewrapper(wrap, origfn, wrapper)
670 _updatewrapper(wrap, origfn, wrapper)
670 setattr(container, funcname, wrap)
671 setattr(container, funcname, wrap)
671 return origfn
672 return origfn
672
673
673
674
674 def unwrapfunction(container, funcname, wrapper=None):
675 def unwrapfunction(container, funcname, wrapper=None):
675 """undo wrapfunction
676 """undo wrapfunction
676
677
677 If wrappers is None, undo the last wrap. Otherwise removes the wrapper
678 If wrappers is None, undo the last wrap. Otherwise removes the wrapper
678 from the chain of wrappers.
679 from the chain of wrappers.
679
680
680 Return the removed wrapper.
681 Return the removed wrapper.
681 Raise IndexError if wrapper is None and nothing to unwrap; ValueError if
682 Raise IndexError if wrapper is None and nothing to unwrap; ValueError if
682 wrapper is not None but is not found in the wrapper chain.
683 wrapper is not None but is not found in the wrapper chain.
683 """
684 """
684 chain = getwrapperchain(container, funcname)
685 chain = getwrapperchain(container, funcname)
685 origfn = chain.pop()
686 origfn = chain.pop()
686 if wrapper is None:
687 if wrapper is None:
687 wrapper = chain[0]
688 wrapper = chain[0]
688 chain.remove(wrapper)
689 chain.remove(wrapper)
689 setattr(container, funcname, origfn)
690 setattr(container, funcname, origfn)
690 for w in reversed(chain):
691 for w in reversed(chain):
691 wrapfunction(container, funcname, w)
692 wrapfunction(container, funcname, w)
692 return wrapper
693 return wrapper
693
694
694
695
695 def getwrapperchain(container, funcname):
696 def getwrapperchain(container, funcname):
696 """get a chain of wrappers of a function
697 """get a chain of wrappers of a function
697
698
698 Return a list of functions: [newest wrapper, ..., oldest wrapper, origfunc]
699 Return a list of functions: [newest wrapper, ..., oldest wrapper, origfunc]
699
700
700 The wrapper functions are the ones passed to wrapfunction, whose first
701 The wrapper functions are the ones passed to wrapfunction, whose first
701 argument is origfunc.
702 argument is origfunc.
702 """
703 """
703 result = []
704 result = []
704 fn = getattr(container, funcname)
705 fn = getattr(container, funcname)
705 while fn:
706 while fn:
706 assert callable(fn)
707 assert callable(fn)
707 result.append(getattr(fn, '_unboundwrapper', fn))
708 result.append(getattr(fn, '_unboundwrapper', fn))
708 fn = getattr(fn, '_origfunc', None)
709 fn = getattr(fn, '_origfunc', None)
709 return result
710 return result
710
711
711
712
712 def _disabledpaths():
713 def _disabledpaths():
713 '''find paths of disabled extensions. returns a dict of {name: path}'''
714 '''find paths of disabled extensions. returns a dict of {name: path}'''
714 import hgext
715 import hgext
715
716
716 # The hgext might not have a __file__ attribute (e.g. in PyOxidizer) and
717 # The hgext might not have a __file__ attribute (e.g. in PyOxidizer) and
717 # it might not be on a filesystem even if it does.
718 # it might not be on a filesystem even if it does.
718 if util.safehasattr(hgext, '__file__'):
719 if util.safehasattr(hgext, '__file__'):
719 extpath = os.path.dirname(
720 extpath = os.path.dirname(
720 util.abspath(pycompat.fsencode(hgext.__file__))
721 util.abspath(pycompat.fsencode(hgext.__file__))
721 )
722 )
722 try:
723 try:
723 files = os.listdir(extpath)
724 files = os.listdir(extpath)
724 except OSError:
725 except OSError:
725 return {}
726 return {}
726 else:
727 else:
727 return {}
728 return {}
728
729
729 exts = {}
730 exts = {}
730 for e in files:
731 for e in files:
731 if e.endswith(b'.py'):
732 if e.endswith(b'.py'):
732 name = e.rsplit(b'.', 1)[0]
733 name = e.rsplit(b'.', 1)[0]
733 path = os.path.join(extpath, e)
734 path = os.path.join(extpath, e)
734 else:
735 else:
735 name = e
736 name = e
736 path = os.path.join(extpath, e, b'__init__.py')
737 path = os.path.join(extpath, e, b'__init__.py')
737 if not os.path.exists(path):
738 if not os.path.exists(path):
738 continue
739 continue
739 if name in exts or name in _order or name == b'__init__':
740 if name in exts or name in _order or name == b'__init__':
740 continue
741 continue
741 exts[name] = path
742 exts[name] = path
742 for name, path in pycompat.iteritems(_disabledextensions):
743 for name, path in pycompat.iteritems(_disabledextensions):
743 # If no path was provided for a disabled extension (e.g. "color=!"),
744 # If no path was provided for a disabled extension (e.g. "color=!"),
744 # don't replace the path we already found by the scan above.
745 # don't replace the path we already found by the scan above.
745 if path:
746 if path:
746 exts[name] = path
747 exts[name] = path
747 return exts
748 return exts
748
749
749
750
750 def _moduledoc(file):
751 def _moduledoc(file):
751 """return the top-level python documentation for the given file
752 """return the top-level python documentation for the given file
752
753
753 Loosely inspired by pydoc.source_synopsis(), but rewritten to
754 Loosely inspired by pydoc.source_synopsis(), but rewritten to
754 handle triple quotes and to return the whole text instead of just
755 handle triple quotes and to return the whole text instead of just
755 the synopsis"""
756 the synopsis"""
756 result = []
757 result = []
757
758
758 line = file.readline()
759 line = file.readline()
759 while line[:1] == b'#' or not line.strip():
760 while line[:1] == b'#' or not line.strip():
760 line = file.readline()
761 line = file.readline()
761 if not line:
762 if not line:
762 break
763 break
763
764
764 start = line[:3]
765 start = line[:3]
765 if start == b'"""' or start == b"'''":
766 if start == b'"""' or start == b"'''":
766 line = line[3:]
767 line = line[3:]
767 while line:
768 while line:
768 if line.rstrip().endswith(start):
769 if line.rstrip().endswith(start):
769 line = line.split(start)[0]
770 line = line.split(start)[0]
770 if line:
771 if line:
771 result.append(line)
772 result.append(line)
772 break
773 break
773 elif not line:
774 elif not line:
774 return None # unmatched delimiter
775 return None # unmatched delimiter
775 result.append(line)
776 result.append(line)
776 line = file.readline()
777 line = file.readline()
777 else:
778 else:
778 return None
779 return None
779
780
780 return b''.join(result)
781 return b''.join(result)
781
782
782
783
783 def _disabledhelp(path):
784 def _disabledhelp(path):
784 '''retrieve help synopsis of a disabled extension (without importing)'''
785 '''retrieve help synopsis of a disabled extension (without importing)'''
785 try:
786 try:
786 with open(path, b'rb') as src:
787 with open(path, b'rb') as src:
787 doc = _moduledoc(src)
788 doc = _moduledoc(src)
788 except IOError:
789 except IOError:
789 return
790 return
790
791
791 if doc: # extracting localized synopsis
792 if doc: # extracting localized synopsis
792 return gettext(doc)
793 return gettext(doc)
793 else:
794 else:
794 return _(b'(no help text available)')
795 return _(b'(no help text available)')
795
796
796
797
797 def disabled():
798 def disabled():
798 '''find disabled extensions from hgext. returns a dict of {name: desc}'''
799 '''find disabled extensions from hgext. returns a dict of {name: desc}'''
799 try:
800 try:
800 from hgext import __index__ # pytype: disable=import-error
801 from hgext import __index__ # pytype: disable=import-error
801
802
802 return {
803 return {
803 name: gettext(desc)
804 name: gettext(desc)
804 for name, desc in pycompat.iteritems(__index__.docs)
805 for name, desc in pycompat.iteritems(__index__.docs)
805 if name not in _order
806 if name not in _order
806 }
807 }
807 except (ImportError, AttributeError):
808 except (ImportError, AttributeError):
808 pass
809 pass
809
810
810 paths = _disabledpaths()
811 paths = _disabledpaths()
811 if not paths:
812 if not paths:
812 return {}
813 return {}
813
814
814 exts = {}
815 exts = {}
815 for name, path in pycompat.iteritems(paths):
816 for name, path in pycompat.iteritems(paths):
816 doc = _disabledhelp(path)
817 doc = _disabledhelp(path)
817 if doc and name != b'__index__':
818 if doc and name != b'__index__':
818 exts[name] = doc.splitlines()[0]
819 exts[name] = doc.splitlines()[0]
819
820
820 return exts
821 return exts
821
822
822
823
823 def disabled_help(name):
824 def disabled_help(name):
824 """Obtain the full help text for a disabled extension, or None."""
825 """Obtain the full help text for a disabled extension, or None."""
825 paths = _disabledpaths()
826 paths = _disabledpaths()
826 if name in paths:
827 if name in paths:
827 return _disabledhelp(paths[name])
828 return _disabledhelp(paths[name])
828
829
829
830
830 def _walkcommand(node):
831 def _walkcommand(node):
831 """Scan @command() decorators in the tree starting at node"""
832 """Scan @command() decorators in the tree starting at node"""
832 todo = collections.deque([node])
833 todo = collections.deque([node])
833 while todo:
834 while todo:
834 node = todo.popleft()
835 node = todo.popleft()
835 if not isinstance(node, ast.FunctionDef):
836 if not isinstance(node, ast.FunctionDef):
836 todo.extend(ast.iter_child_nodes(node))
837 todo.extend(ast.iter_child_nodes(node))
837 continue
838 continue
838 for d in node.decorator_list:
839 for d in node.decorator_list:
839 if not isinstance(d, ast.Call):
840 if not isinstance(d, ast.Call):
840 continue
841 continue
841 if not isinstance(d.func, ast.Name):
842 if not isinstance(d.func, ast.Name):
842 continue
843 continue
843 if d.func.id != 'command':
844 if d.func.id != 'command':
844 continue
845 continue
845 yield d
846 yield d
846
847
847
848
848 def _disabledcmdtable(path):
849 def _disabledcmdtable(path):
849 """Construct a dummy command table without loading the extension module
850 """Construct a dummy command table without loading the extension module
850
851
851 This may raise IOError or SyntaxError.
852 This may raise IOError or SyntaxError.
852 """
853 """
853 with open(path, b'rb') as src:
854 with open(path, b'rb') as src:
854 root = ast.parse(src.read(), path)
855 root = ast.parse(src.read(), path)
855 cmdtable = {}
856 cmdtable = {}
856 for node in _walkcommand(root):
857 for node in _walkcommand(root):
857 if not node.args:
858 if not node.args:
858 continue
859 continue
859 a = node.args[0]
860 a = node.args[0]
860 if isinstance(a, ast.Str):
861 if isinstance(a, ast.Str):
861 name = pycompat.sysbytes(a.s)
862 name = pycompat.sysbytes(a.s)
862 elif pycompat.ispy3 and isinstance(a, ast.Bytes):
863 elif pycompat.ispy3 and isinstance(a, ast.Bytes):
863 name = a.s
864 name = a.s
864 else:
865 else:
865 continue
866 continue
866 cmdtable[name] = (None, [], b'')
867 cmdtable[name] = (None, [], b'')
867 return cmdtable
868 return cmdtable
868
869
869
870
870 def _finddisabledcmd(ui, cmd, name, path, strict):
871 def _finddisabledcmd(ui, cmd, name, path, strict):
871 try:
872 try:
872 cmdtable = _disabledcmdtable(path)
873 cmdtable = _disabledcmdtable(path)
873 except (IOError, SyntaxError):
874 except (IOError, SyntaxError):
874 return
875 return
875 try:
876 try:
876 aliases, entry = cmdutil.findcmd(cmd, cmdtable, strict)
877 aliases, entry = cmdutil.findcmd(cmd, cmdtable, strict)
877 except (error.AmbiguousCommand, error.UnknownCommand):
878 except (error.AmbiguousCommand, error.UnknownCommand):
878 return
879 return
879 for c in aliases:
880 for c in aliases:
880 if c.startswith(cmd):
881 if c.startswith(cmd):
881 cmd = c
882 cmd = c
882 break
883 break
883 else:
884 else:
884 cmd = aliases[0]
885 cmd = aliases[0]
885 doc = _disabledhelp(path)
886 doc = _disabledhelp(path)
886 return (cmd, name, doc)
887 return (cmd, name, doc)
887
888
888
889
889 def disabledcmd(ui, cmd, strict=False):
890 def disabledcmd(ui, cmd, strict=False):
890 """find cmd from disabled extensions without importing.
891 """find cmd from disabled extensions without importing.
891 returns (cmdname, extname, doc)"""
892 returns (cmdname, extname, doc)"""
892
893
893 paths = _disabledpaths()
894 paths = _disabledpaths()
894 if not paths:
895 if not paths:
895 raise error.UnknownCommand(cmd)
896 raise error.UnknownCommand(cmd)
896
897
897 ext = None
898 ext = None
898 # first, search for an extension with the same name as the command
899 # first, search for an extension with the same name as the command
899 path = paths.pop(cmd, None)
900 path = paths.pop(cmd, None)
900 if path:
901 if path:
901 ext = _finddisabledcmd(ui, cmd, cmd, path, strict=strict)
902 ext = _finddisabledcmd(ui, cmd, cmd, path, strict=strict)
902 if not ext:
903 if not ext:
903 # otherwise, interrogate each extension until there's a match
904 # otherwise, interrogate each extension until there's a match
904 for name, path in pycompat.iteritems(paths):
905 for name, path in pycompat.iteritems(paths):
905 ext = _finddisabledcmd(ui, cmd, name, path, strict=strict)
906 ext = _finddisabledcmd(ui, cmd, name, path, strict=strict)
906 if ext:
907 if ext:
907 break
908 break
908 if ext:
909 if ext:
909 return ext
910 return ext
910
911
911 raise error.UnknownCommand(cmd)
912 raise error.UnknownCommand(cmd)
912
913
913
914
914 def enabled(shortname=True):
915 def enabled(shortname=True):
915 '''return a dict of {name: desc} of extensions'''
916 '''return a dict of {name: desc} of extensions'''
916 exts = {}
917 exts = {}
917 for ename, ext in extensions():
918 for ename, ext in extensions():
918 doc = gettext(ext.__doc__) or _(b'(no help text available)')
919 doc = gettext(ext.__doc__) or _(b'(no help text available)')
919 assert doc is not None # help pytype
920 assert doc is not None # help pytype
920 if shortname:
921 if shortname:
921 ename = ename.split(b'.')[-1]
922 ename = ename.split(b'.')[-1]
922 exts[ename] = doc.splitlines()[0].strip()
923 exts[ename] = doc.splitlines()[0].strip()
923
924
924 return exts
925 return exts
925
926
926
927
927 def notloaded():
928 def notloaded():
928 '''return short names of extensions that failed to load'''
929 '''return short names of extensions that failed to load'''
929 return [
930 return [
930 name for name, mod in pycompat.iteritems(_extensions) if mod is None
931 name for name, mod in pycompat.iteritems(_extensions) if mod is None
931 ]
932 ]
932
933
933
934
934 def moduleversion(module):
935 def moduleversion(module):
935 '''return version information from given module as a string'''
936 '''return version information from given module as a string'''
936 if util.safehasattr(module, b'getversion') and callable(module.getversion):
937 if util.safehasattr(module, b'getversion') and callable(module.getversion):
937 try:
938 try:
938 version = module.getversion()
939 version = module.getversion()
939 except Exception:
940 except Exception:
940 version = b'unknown'
941 version = b'unknown'
941
942
942 elif util.safehasattr(module, b'__version__'):
943 elif util.safehasattr(module, b'__version__'):
943 version = module.__version__
944 version = module.__version__
944 else:
945 else:
945 version = b''
946 version = b''
946 if isinstance(version, (list, tuple)):
947 if isinstance(version, (list, tuple)):
947 version = b'.'.join(pycompat.bytestr(o) for o in version)
948 version = b'.'.join(pycompat.bytestr(o) for o in version)
948 else:
949 else:
949 # version data should be bytes, but not all extensions are ported
950 # version data should be bytes, but not all extensions are ported
950 # to py3.
951 # to py3.
951 version = stringutil.forcebytestr(version)
952 version = stringutil.forcebytestr(version)
952 return version
953 return version
953
954
954
955
955 def ismoduleinternal(module):
956 def ismoduleinternal(module):
956 exttestedwith = getattr(module, 'testedwith', None)
957 exttestedwith = getattr(module, 'testedwith', None)
957 return exttestedwith == b"ships-with-hg-core"
958 return exttestedwith == b"ships-with-hg-core"
General Comments 0
You need to be logged in to leave comments. Login now