##// END OF EJS Templates
hooks: forbid ':' in hook name...
marmoute -
r47240:86b01989 stable
parent child Browse files
Show More
@@ -1,2582 +1,2582 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'debug',
573 b'debug',
574 b'dirstate.delaywrite',
574 b'dirstate.delaywrite',
575 default=0,
575 default=0,
576 )
576 )
577 coreconfigitem(
577 coreconfigitem(
578 b'defaults',
578 b'defaults',
579 b'.*',
579 b'.*',
580 default=None,
580 default=None,
581 generic=True,
581 generic=True,
582 )
582 )
583 coreconfigitem(
583 coreconfigitem(
584 b'devel',
584 b'devel',
585 b'all-warnings',
585 b'all-warnings',
586 default=False,
586 default=False,
587 )
587 )
588 coreconfigitem(
588 coreconfigitem(
589 b'devel',
589 b'devel',
590 b'bundle2.debug',
590 b'bundle2.debug',
591 default=False,
591 default=False,
592 )
592 )
593 coreconfigitem(
593 coreconfigitem(
594 b'devel',
594 b'devel',
595 b'bundle.delta',
595 b'bundle.delta',
596 default=b'',
596 default=b'',
597 )
597 )
598 coreconfigitem(
598 coreconfigitem(
599 b'devel',
599 b'devel',
600 b'cache-vfs',
600 b'cache-vfs',
601 default=None,
601 default=None,
602 )
602 )
603 coreconfigitem(
603 coreconfigitem(
604 b'devel',
604 b'devel',
605 b'check-locks',
605 b'check-locks',
606 default=False,
606 default=False,
607 )
607 )
608 coreconfigitem(
608 coreconfigitem(
609 b'devel',
609 b'devel',
610 b'check-relroot',
610 b'check-relroot',
611 default=False,
611 default=False,
612 )
612 )
613 coreconfigitem(
613 coreconfigitem(
614 b'devel',
614 b'devel',
615 b'default-date',
615 b'default-date',
616 default=None,
616 default=None,
617 )
617 )
618 coreconfigitem(
618 coreconfigitem(
619 b'devel',
619 b'devel',
620 b'deprec-warn',
620 b'deprec-warn',
621 default=False,
621 default=False,
622 )
622 )
623 coreconfigitem(
623 coreconfigitem(
624 b'devel',
624 b'devel',
625 b'disableloaddefaultcerts',
625 b'disableloaddefaultcerts',
626 default=False,
626 default=False,
627 )
627 )
628 coreconfigitem(
628 coreconfigitem(
629 b'devel',
629 b'devel',
630 b'warn-empty-changegroup',
630 b'warn-empty-changegroup',
631 default=False,
631 default=False,
632 )
632 )
633 coreconfigitem(
633 coreconfigitem(
634 b'devel',
634 b'devel',
635 b'legacy.exchange',
635 b'legacy.exchange',
636 default=list,
636 default=list,
637 )
637 )
638 # When True, revlogs use a special reference version of the nodemap, that is not
638 # When True, revlogs use a special reference version of the nodemap, that is not
639 # performant but is "known" to behave properly.
639 # performant but is "known" to behave properly.
640 coreconfigitem(
640 coreconfigitem(
641 b'devel',
641 b'devel',
642 b'persistent-nodemap',
642 b'persistent-nodemap',
643 default=False,
643 default=False,
644 )
644 )
645 coreconfigitem(
645 coreconfigitem(
646 b'devel',
646 b'devel',
647 b'servercafile',
647 b'servercafile',
648 default=b'',
648 default=b'',
649 )
649 )
650 coreconfigitem(
650 coreconfigitem(
651 b'devel',
651 b'devel',
652 b'serverexactprotocol',
652 b'serverexactprotocol',
653 default=b'',
653 default=b'',
654 )
654 )
655 coreconfigitem(
655 coreconfigitem(
656 b'devel',
656 b'devel',
657 b'serverrequirecert',
657 b'serverrequirecert',
658 default=False,
658 default=False,
659 )
659 )
660 coreconfigitem(
660 coreconfigitem(
661 b'devel',
661 b'devel',
662 b'strip-obsmarkers',
662 b'strip-obsmarkers',
663 default=True,
663 default=True,
664 )
664 )
665 coreconfigitem(
665 coreconfigitem(
666 b'devel',
666 b'devel',
667 b'warn-config',
667 b'warn-config',
668 default=None,
668 default=None,
669 )
669 )
670 coreconfigitem(
670 coreconfigitem(
671 b'devel',
671 b'devel',
672 b'warn-config-default',
672 b'warn-config-default',
673 default=None,
673 default=None,
674 )
674 )
675 coreconfigitem(
675 coreconfigitem(
676 b'devel',
676 b'devel',
677 b'user.obsmarker',
677 b'user.obsmarker',
678 default=None,
678 default=None,
679 )
679 )
680 coreconfigitem(
680 coreconfigitem(
681 b'devel',
681 b'devel',
682 b'warn-config-unknown',
682 b'warn-config-unknown',
683 default=None,
683 default=None,
684 )
684 )
685 coreconfigitem(
685 coreconfigitem(
686 b'devel',
686 b'devel',
687 b'debug.copies',
687 b'debug.copies',
688 default=False,
688 default=False,
689 )
689 )
690 coreconfigitem(
690 coreconfigitem(
691 b'devel',
691 b'devel',
692 b'debug.extensions',
692 b'debug.extensions',
693 default=False,
693 default=False,
694 )
694 )
695 coreconfigitem(
695 coreconfigitem(
696 b'devel',
696 b'devel',
697 b'debug.repo-filters',
697 b'debug.repo-filters',
698 default=False,
698 default=False,
699 )
699 )
700 coreconfigitem(
700 coreconfigitem(
701 b'devel',
701 b'devel',
702 b'debug.peer-request',
702 b'debug.peer-request',
703 default=False,
703 default=False,
704 )
704 )
705 # If discovery.exchange-heads is False, the discovery will not start with
705 # If discovery.exchange-heads is False, the discovery will not start with
706 # remote head fetching and local head querying.
706 # remote head fetching and local head querying.
707 coreconfigitem(
707 coreconfigitem(
708 b'devel',
708 b'devel',
709 b'discovery.exchange-heads',
709 b'discovery.exchange-heads',
710 default=True,
710 default=True,
711 )
711 )
712 # If discovery.grow-sample is False, the sample size used in set discovery will
712 # If discovery.grow-sample is False, the sample size used in set discovery will
713 # not be increased through the process
713 # not be increased through the process
714 coreconfigitem(
714 coreconfigitem(
715 b'devel',
715 b'devel',
716 b'discovery.grow-sample',
716 b'discovery.grow-sample',
717 default=True,
717 default=True,
718 )
718 )
719 # discovery.grow-sample.rate control the rate at which the sample grow
719 # discovery.grow-sample.rate control the rate at which the sample grow
720 coreconfigitem(
720 coreconfigitem(
721 b'devel',
721 b'devel',
722 b'discovery.grow-sample.rate',
722 b'discovery.grow-sample.rate',
723 default=1.05,
723 default=1.05,
724 )
724 )
725 # If discovery.randomize is False, random sampling during discovery are
725 # If discovery.randomize is False, random sampling during discovery are
726 # deterministic. It is meant for integration tests.
726 # deterministic. It is meant for integration tests.
727 coreconfigitem(
727 coreconfigitem(
728 b'devel',
728 b'devel',
729 b'discovery.randomize',
729 b'discovery.randomize',
730 default=True,
730 default=True,
731 )
731 )
732 _registerdiffopts(section=b'diff')
732 _registerdiffopts(section=b'diff')
733 coreconfigitem(
733 coreconfigitem(
734 b'email',
734 b'email',
735 b'bcc',
735 b'bcc',
736 default=None,
736 default=None,
737 )
737 )
738 coreconfigitem(
738 coreconfigitem(
739 b'email',
739 b'email',
740 b'cc',
740 b'cc',
741 default=None,
741 default=None,
742 )
742 )
743 coreconfigitem(
743 coreconfigitem(
744 b'email',
744 b'email',
745 b'charsets',
745 b'charsets',
746 default=list,
746 default=list,
747 )
747 )
748 coreconfigitem(
748 coreconfigitem(
749 b'email',
749 b'email',
750 b'from',
750 b'from',
751 default=None,
751 default=None,
752 )
752 )
753 coreconfigitem(
753 coreconfigitem(
754 b'email',
754 b'email',
755 b'method',
755 b'method',
756 default=b'smtp',
756 default=b'smtp',
757 )
757 )
758 coreconfigitem(
758 coreconfigitem(
759 b'email',
759 b'email',
760 b'reply-to',
760 b'reply-to',
761 default=None,
761 default=None,
762 )
762 )
763 coreconfigitem(
763 coreconfigitem(
764 b'email',
764 b'email',
765 b'to',
765 b'to',
766 default=None,
766 default=None,
767 )
767 )
768 coreconfigitem(
768 coreconfigitem(
769 b'experimental',
769 b'experimental',
770 b'archivemetatemplate',
770 b'archivemetatemplate',
771 default=dynamicdefault,
771 default=dynamicdefault,
772 )
772 )
773 coreconfigitem(
773 coreconfigitem(
774 b'experimental',
774 b'experimental',
775 b'auto-publish',
775 b'auto-publish',
776 default=b'publish',
776 default=b'publish',
777 )
777 )
778 coreconfigitem(
778 coreconfigitem(
779 b'experimental',
779 b'experimental',
780 b'bundle-phases',
780 b'bundle-phases',
781 default=False,
781 default=False,
782 )
782 )
783 coreconfigitem(
783 coreconfigitem(
784 b'experimental',
784 b'experimental',
785 b'bundle2-advertise',
785 b'bundle2-advertise',
786 default=True,
786 default=True,
787 )
787 )
788 coreconfigitem(
788 coreconfigitem(
789 b'experimental',
789 b'experimental',
790 b'bundle2-output-capture',
790 b'bundle2-output-capture',
791 default=False,
791 default=False,
792 )
792 )
793 coreconfigitem(
793 coreconfigitem(
794 b'experimental',
794 b'experimental',
795 b'bundle2.pushback',
795 b'bundle2.pushback',
796 default=False,
796 default=False,
797 )
797 )
798 coreconfigitem(
798 coreconfigitem(
799 b'experimental',
799 b'experimental',
800 b'bundle2lazylocking',
800 b'bundle2lazylocking',
801 default=False,
801 default=False,
802 )
802 )
803 coreconfigitem(
803 coreconfigitem(
804 b'experimental',
804 b'experimental',
805 b'bundlecomplevel',
805 b'bundlecomplevel',
806 default=None,
806 default=None,
807 )
807 )
808 coreconfigitem(
808 coreconfigitem(
809 b'experimental',
809 b'experimental',
810 b'bundlecomplevel.bzip2',
810 b'bundlecomplevel.bzip2',
811 default=None,
811 default=None,
812 )
812 )
813 coreconfigitem(
813 coreconfigitem(
814 b'experimental',
814 b'experimental',
815 b'bundlecomplevel.gzip',
815 b'bundlecomplevel.gzip',
816 default=None,
816 default=None,
817 )
817 )
818 coreconfigitem(
818 coreconfigitem(
819 b'experimental',
819 b'experimental',
820 b'bundlecomplevel.none',
820 b'bundlecomplevel.none',
821 default=None,
821 default=None,
822 )
822 )
823 coreconfigitem(
823 coreconfigitem(
824 b'experimental',
824 b'experimental',
825 b'bundlecomplevel.zstd',
825 b'bundlecomplevel.zstd',
826 default=None,
826 default=None,
827 )
827 )
828 coreconfigitem(
828 coreconfigitem(
829 b'experimental',
829 b'experimental',
830 b'changegroup3',
830 b'changegroup3',
831 default=False,
831 default=False,
832 )
832 )
833 coreconfigitem(
833 coreconfigitem(
834 b'experimental',
834 b'experimental',
835 b'cleanup-as-archived',
835 b'cleanup-as-archived',
836 default=False,
836 default=False,
837 )
837 )
838 coreconfigitem(
838 coreconfigitem(
839 b'experimental',
839 b'experimental',
840 b'clientcompressionengines',
840 b'clientcompressionengines',
841 default=list,
841 default=list,
842 )
842 )
843 coreconfigitem(
843 coreconfigitem(
844 b'experimental',
844 b'experimental',
845 b'copytrace',
845 b'copytrace',
846 default=b'on',
846 default=b'on',
847 )
847 )
848 coreconfigitem(
848 coreconfigitem(
849 b'experimental',
849 b'experimental',
850 b'copytrace.movecandidateslimit',
850 b'copytrace.movecandidateslimit',
851 default=100,
851 default=100,
852 )
852 )
853 coreconfigitem(
853 coreconfigitem(
854 b'experimental',
854 b'experimental',
855 b'copytrace.sourcecommitlimit',
855 b'copytrace.sourcecommitlimit',
856 default=100,
856 default=100,
857 )
857 )
858 coreconfigitem(
858 coreconfigitem(
859 b'experimental',
859 b'experimental',
860 b'copies.read-from',
860 b'copies.read-from',
861 default=b"filelog-only",
861 default=b"filelog-only",
862 )
862 )
863 coreconfigitem(
863 coreconfigitem(
864 b'experimental',
864 b'experimental',
865 b'copies.write-to',
865 b'copies.write-to',
866 default=b'filelog-only',
866 default=b'filelog-only',
867 )
867 )
868 coreconfigitem(
868 coreconfigitem(
869 b'experimental',
869 b'experimental',
870 b'crecordtest',
870 b'crecordtest',
871 default=None,
871 default=None,
872 )
872 )
873 coreconfigitem(
873 coreconfigitem(
874 b'experimental',
874 b'experimental',
875 b'directaccess',
875 b'directaccess',
876 default=False,
876 default=False,
877 )
877 )
878 coreconfigitem(
878 coreconfigitem(
879 b'experimental',
879 b'experimental',
880 b'directaccess.revnums',
880 b'directaccess.revnums',
881 default=False,
881 default=False,
882 )
882 )
883 coreconfigitem(
883 coreconfigitem(
884 b'experimental',
884 b'experimental',
885 b'editortmpinhg',
885 b'editortmpinhg',
886 default=False,
886 default=False,
887 )
887 )
888 coreconfigitem(
888 coreconfigitem(
889 b'experimental',
889 b'experimental',
890 b'evolution',
890 b'evolution',
891 default=list,
891 default=list,
892 )
892 )
893 coreconfigitem(
893 coreconfigitem(
894 b'experimental',
894 b'experimental',
895 b'evolution.allowdivergence',
895 b'evolution.allowdivergence',
896 default=False,
896 default=False,
897 alias=[(b'experimental', b'allowdivergence')],
897 alias=[(b'experimental', b'allowdivergence')],
898 )
898 )
899 coreconfigitem(
899 coreconfigitem(
900 b'experimental',
900 b'experimental',
901 b'evolution.allowunstable',
901 b'evolution.allowunstable',
902 default=None,
902 default=None,
903 )
903 )
904 coreconfigitem(
904 coreconfigitem(
905 b'experimental',
905 b'experimental',
906 b'evolution.createmarkers',
906 b'evolution.createmarkers',
907 default=None,
907 default=None,
908 )
908 )
909 coreconfigitem(
909 coreconfigitem(
910 b'experimental',
910 b'experimental',
911 b'evolution.effect-flags',
911 b'evolution.effect-flags',
912 default=True,
912 default=True,
913 alias=[(b'experimental', b'effect-flags')],
913 alias=[(b'experimental', b'effect-flags')],
914 )
914 )
915 coreconfigitem(
915 coreconfigitem(
916 b'experimental',
916 b'experimental',
917 b'evolution.exchange',
917 b'evolution.exchange',
918 default=None,
918 default=None,
919 )
919 )
920 coreconfigitem(
920 coreconfigitem(
921 b'experimental',
921 b'experimental',
922 b'evolution.bundle-obsmarker',
922 b'evolution.bundle-obsmarker',
923 default=False,
923 default=False,
924 )
924 )
925 coreconfigitem(
925 coreconfigitem(
926 b'experimental',
926 b'experimental',
927 b'evolution.bundle-obsmarker:mandatory',
927 b'evolution.bundle-obsmarker:mandatory',
928 default=True,
928 default=True,
929 )
929 )
930 coreconfigitem(
930 coreconfigitem(
931 b'experimental',
931 b'experimental',
932 b'log.topo',
932 b'log.topo',
933 default=False,
933 default=False,
934 )
934 )
935 coreconfigitem(
935 coreconfigitem(
936 b'experimental',
936 b'experimental',
937 b'evolution.report-instabilities',
937 b'evolution.report-instabilities',
938 default=True,
938 default=True,
939 )
939 )
940 coreconfigitem(
940 coreconfigitem(
941 b'experimental',
941 b'experimental',
942 b'evolution.track-operation',
942 b'evolution.track-operation',
943 default=True,
943 default=True,
944 )
944 )
945 # repo-level config to exclude a revset visibility
945 # repo-level config to exclude a revset visibility
946 #
946 #
947 # The target use case is to use `share` to expose different subset of the same
947 # The target use case is to use `share` to expose different subset of the same
948 # repository, especially server side. See also `server.view`.
948 # repository, especially server side. See also `server.view`.
949 coreconfigitem(
949 coreconfigitem(
950 b'experimental',
950 b'experimental',
951 b'extra-filter-revs',
951 b'extra-filter-revs',
952 default=None,
952 default=None,
953 )
953 )
954 coreconfigitem(
954 coreconfigitem(
955 b'experimental',
955 b'experimental',
956 b'maxdeltachainspan',
956 b'maxdeltachainspan',
957 default=-1,
957 default=-1,
958 )
958 )
959 # tracks files which were undeleted (merge might delete them but we explicitly
959 # tracks files which were undeleted (merge might delete them but we explicitly
960 # kept/undeleted them) and creates new filenodes for them
960 # kept/undeleted them) and creates new filenodes for them
961 coreconfigitem(
961 coreconfigitem(
962 b'experimental',
962 b'experimental',
963 b'merge-track-salvaged',
963 b'merge-track-salvaged',
964 default=False,
964 default=False,
965 )
965 )
966 coreconfigitem(
966 coreconfigitem(
967 b'experimental',
967 b'experimental',
968 b'mergetempdirprefix',
968 b'mergetempdirprefix',
969 default=None,
969 default=None,
970 )
970 )
971 coreconfigitem(
971 coreconfigitem(
972 b'experimental',
972 b'experimental',
973 b'mmapindexthreshold',
973 b'mmapindexthreshold',
974 default=None,
974 default=None,
975 )
975 )
976 coreconfigitem(
976 coreconfigitem(
977 b'experimental',
977 b'experimental',
978 b'narrow',
978 b'narrow',
979 default=False,
979 default=False,
980 )
980 )
981 coreconfigitem(
981 coreconfigitem(
982 b'experimental',
982 b'experimental',
983 b'nonnormalparanoidcheck',
983 b'nonnormalparanoidcheck',
984 default=False,
984 default=False,
985 )
985 )
986 coreconfigitem(
986 coreconfigitem(
987 b'experimental',
987 b'experimental',
988 b'exportableenviron',
988 b'exportableenviron',
989 default=list,
989 default=list,
990 )
990 )
991 coreconfigitem(
991 coreconfigitem(
992 b'experimental',
992 b'experimental',
993 b'extendedheader.index',
993 b'extendedheader.index',
994 default=None,
994 default=None,
995 )
995 )
996 coreconfigitem(
996 coreconfigitem(
997 b'experimental',
997 b'experimental',
998 b'extendedheader.similarity',
998 b'extendedheader.similarity',
999 default=False,
999 default=False,
1000 )
1000 )
1001 coreconfigitem(
1001 coreconfigitem(
1002 b'experimental',
1002 b'experimental',
1003 b'graphshorten',
1003 b'graphshorten',
1004 default=False,
1004 default=False,
1005 )
1005 )
1006 coreconfigitem(
1006 coreconfigitem(
1007 b'experimental',
1007 b'experimental',
1008 b'graphstyle.parent',
1008 b'graphstyle.parent',
1009 default=dynamicdefault,
1009 default=dynamicdefault,
1010 )
1010 )
1011 coreconfigitem(
1011 coreconfigitem(
1012 b'experimental',
1012 b'experimental',
1013 b'graphstyle.missing',
1013 b'graphstyle.missing',
1014 default=dynamicdefault,
1014 default=dynamicdefault,
1015 )
1015 )
1016 coreconfigitem(
1016 coreconfigitem(
1017 b'experimental',
1017 b'experimental',
1018 b'graphstyle.grandparent',
1018 b'graphstyle.grandparent',
1019 default=dynamicdefault,
1019 default=dynamicdefault,
1020 )
1020 )
1021 coreconfigitem(
1021 coreconfigitem(
1022 b'experimental',
1022 b'experimental',
1023 b'hook-track-tags',
1023 b'hook-track-tags',
1024 default=False,
1024 default=False,
1025 )
1025 )
1026 coreconfigitem(
1026 coreconfigitem(
1027 b'experimental',
1027 b'experimental',
1028 b'httppeer.advertise-v2',
1028 b'httppeer.advertise-v2',
1029 default=False,
1029 default=False,
1030 )
1030 )
1031 coreconfigitem(
1031 coreconfigitem(
1032 b'experimental',
1032 b'experimental',
1033 b'httppeer.v2-encoder-order',
1033 b'httppeer.v2-encoder-order',
1034 default=None,
1034 default=None,
1035 )
1035 )
1036 coreconfigitem(
1036 coreconfigitem(
1037 b'experimental',
1037 b'experimental',
1038 b'httppostargs',
1038 b'httppostargs',
1039 default=False,
1039 default=False,
1040 )
1040 )
1041 coreconfigitem(b'experimental', b'nointerrupt', default=False)
1041 coreconfigitem(b'experimental', b'nointerrupt', default=False)
1042 coreconfigitem(b'experimental', b'nointerrupt-interactiveonly', default=True)
1042 coreconfigitem(b'experimental', b'nointerrupt-interactiveonly', default=True)
1043
1043
1044 coreconfigitem(
1044 coreconfigitem(
1045 b'experimental',
1045 b'experimental',
1046 b'obsmarkers-exchange-debug',
1046 b'obsmarkers-exchange-debug',
1047 default=False,
1047 default=False,
1048 )
1048 )
1049 coreconfigitem(
1049 coreconfigitem(
1050 b'experimental',
1050 b'experimental',
1051 b'remotenames',
1051 b'remotenames',
1052 default=False,
1052 default=False,
1053 )
1053 )
1054 coreconfigitem(
1054 coreconfigitem(
1055 b'experimental',
1055 b'experimental',
1056 b'removeemptydirs',
1056 b'removeemptydirs',
1057 default=True,
1057 default=True,
1058 )
1058 )
1059 coreconfigitem(
1059 coreconfigitem(
1060 b'experimental',
1060 b'experimental',
1061 b'revert.interactive.select-to-keep',
1061 b'revert.interactive.select-to-keep',
1062 default=False,
1062 default=False,
1063 )
1063 )
1064 coreconfigitem(
1064 coreconfigitem(
1065 b'experimental',
1065 b'experimental',
1066 b'revisions.prefixhexnode',
1066 b'revisions.prefixhexnode',
1067 default=False,
1067 default=False,
1068 )
1068 )
1069 coreconfigitem(
1069 coreconfigitem(
1070 b'experimental',
1070 b'experimental',
1071 b'revlogv2',
1071 b'revlogv2',
1072 default=None,
1072 default=None,
1073 )
1073 )
1074 coreconfigitem(
1074 coreconfigitem(
1075 b'experimental',
1075 b'experimental',
1076 b'revisions.disambiguatewithin',
1076 b'revisions.disambiguatewithin',
1077 default=None,
1077 default=None,
1078 )
1078 )
1079 coreconfigitem(
1079 coreconfigitem(
1080 b'experimental',
1080 b'experimental',
1081 b'rust.index',
1081 b'rust.index',
1082 default=False,
1082 default=False,
1083 )
1083 )
1084 coreconfigitem(
1084 coreconfigitem(
1085 b'experimental',
1085 b'experimental',
1086 b'server.filesdata.recommended-batch-size',
1086 b'server.filesdata.recommended-batch-size',
1087 default=50000,
1087 default=50000,
1088 )
1088 )
1089 coreconfigitem(
1089 coreconfigitem(
1090 b'experimental',
1090 b'experimental',
1091 b'server.manifestdata.recommended-batch-size',
1091 b'server.manifestdata.recommended-batch-size',
1092 default=100000,
1092 default=100000,
1093 )
1093 )
1094 coreconfigitem(
1094 coreconfigitem(
1095 b'experimental',
1095 b'experimental',
1096 b'server.stream-narrow-clones',
1096 b'server.stream-narrow-clones',
1097 default=False,
1097 default=False,
1098 )
1098 )
1099 coreconfigitem(
1099 coreconfigitem(
1100 b'experimental',
1100 b'experimental',
1101 b'single-head-per-branch',
1101 b'single-head-per-branch',
1102 default=False,
1102 default=False,
1103 )
1103 )
1104 coreconfigitem(
1104 coreconfigitem(
1105 b'experimental',
1105 b'experimental',
1106 b'single-head-per-branch:account-closed-heads',
1106 b'single-head-per-branch:account-closed-heads',
1107 default=False,
1107 default=False,
1108 )
1108 )
1109 coreconfigitem(
1109 coreconfigitem(
1110 b'experimental',
1110 b'experimental',
1111 b'single-head-per-branch:public-changes-only',
1111 b'single-head-per-branch:public-changes-only',
1112 default=False,
1112 default=False,
1113 )
1113 )
1114 coreconfigitem(
1114 coreconfigitem(
1115 b'experimental',
1115 b'experimental',
1116 b'sshserver.support-v2',
1116 b'sshserver.support-v2',
1117 default=False,
1117 default=False,
1118 )
1118 )
1119 coreconfigitem(
1119 coreconfigitem(
1120 b'experimental',
1120 b'experimental',
1121 b'sparse-read',
1121 b'sparse-read',
1122 default=False,
1122 default=False,
1123 )
1123 )
1124 coreconfigitem(
1124 coreconfigitem(
1125 b'experimental',
1125 b'experimental',
1126 b'sparse-read.density-threshold',
1126 b'sparse-read.density-threshold',
1127 default=0.50,
1127 default=0.50,
1128 )
1128 )
1129 coreconfigitem(
1129 coreconfigitem(
1130 b'experimental',
1130 b'experimental',
1131 b'sparse-read.min-gap-size',
1131 b'sparse-read.min-gap-size',
1132 default=b'65K',
1132 default=b'65K',
1133 )
1133 )
1134 coreconfigitem(
1134 coreconfigitem(
1135 b'experimental',
1135 b'experimental',
1136 b'treemanifest',
1136 b'treemanifest',
1137 default=False,
1137 default=False,
1138 )
1138 )
1139 coreconfigitem(
1139 coreconfigitem(
1140 b'experimental',
1140 b'experimental',
1141 b'update.atomic-file',
1141 b'update.atomic-file',
1142 default=False,
1142 default=False,
1143 )
1143 )
1144 coreconfigitem(
1144 coreconfigitem(
1145 b'experimental',
1145 b'experimental',
1146 b'sshpeer.advertise-v2',
1146 b'sshpeer.advertise-v2',
1147 default=False,
1147 default=False,
1148 )
1148 )
1149 coreconfigitem(
1149 coreconfigitem(
1150 b'experimental',
1150 b'experimental',
1151 b'web.apiserver',
1151 b'web.apiserver',
1152 default=False,
1152 default=False,
1153 )
1153 )
1154 coreconfigitem(
1154 coreconfigitem(
1155 b'experimental',
1155 b'experimental',
1156 b'web.api.http-v2',
1156 b'web.api.http-v2',
1157 default=False,
1157 default=False,
1158 )
1158 )
1159 coreconfigitem(
1159 coreconfigitem(
1160 b'experimental',
1160 b'experimental',
1161 b'web.api.debugreflect',
1161 b'web.api.debugreflect',
1162 default=False,
1162 default=False,
1163 )
1163 )
1164 coreconfigitem(
1164 coreconfigitem(
1165 b'experimental',
1165 b'experimental',
1166 b'worker.wdir-get-thread-safe',
1166 b'worker.wdir-get-thread-safe',
1167 default=False,
1167 default=False,
1168 )
1168 )
1169 coreconfigitem(
1169 coreconfigitem(
1170 b'experimental',
1170 b'experimental',
1171 b'worker.repository-upgrade',
1171 b'worker.repository-upgrade',
1172 default=False,
1172 default=False,
1173 )
1173 )
1174 coreconfigitem(
1174 coreconfigitem(
1175 b'experimental',
1175 b'experimental',
1176 b'xdiff',
1176 b'xdiff',
1177 default=False,
1177 default=False,
1178 )
1178 )
1179 coreconfigitem(
1179 coreconfigitem(
1180 b'extensions',
1180 b'extensions',
1181 b'.*',
1181 b'.*',
1182 default=None,
1182 default=None,
1183 generic=True,
1183 generic=True,
1184 )
1184 )
1185 coreconfigitem(
1185 coreconfigitem(
1186 b'extdata',
1186 b'extdata',
1187 b'.*',
1187 b'.*',
1188 default=None,
1188 default=None,
1189 generic=True,
1189 generic=True,
1190 )
1190 )
1191 coreconfigitem(
1191 coreconfigitem(
1192 b'format',
1192 b'format',
1193 b'bookmarks-in-store',
1193 b'bookmarks-in-store',
1194 default=False,
1194 default=False,
1195 )
1195 )
1196 coreconfigitem(
1196 coreconfigitem(
1197 b'format',
1197 b'format',
1198 b'chunkcachesize',
1198 b'chunkcachesize',
1199 default=None,
1199 default=None,
1200 experimental=True,
1200 experimental=True,
1201 )
1201 )
1202 coreconfigitem(
1202 coreconfigitem(
1203 b'format',
1203 b'format',
1204 b'dotencode',
1204 b'dotencode',
1205 default=True,
1205 default=True,
1206 )
1206 )
1207 coreconfigitem(
1207 coreconfigitem(
1208 b'format',
1208 b'format',
1209 b'generaldelta',
1209 b'generaldelta',
1210 default=False,
1210 default=False,
1211 experimental=True,
1211 experimental=True,
1212 )
1212 )
1213 coreconfigitem(
1213 coreconfigitem(
1214 b'format',
1214 b'format',
1215 b'manifestcachesize',
1215 b'manifestcachesize',
1216 default=None,
1216 default=None,
1217 experimental=True,
1217 experimental=True,
1218 )
1218 )
1219 coreconfigitem(
1219 coreconfigitem(
1220 b'format',
1220 b'format',
1221 b'maxchainlen',
1221 b'maxchainlen',
1222 default=dynamicdefault,
1222 default=dynamicdefault,
1223 experimental=True,
1223 experimental=True,
1224 )
1224 )
1225 coreconfigitem(
1225 coreconfigitem(
1226 b'format',
1226 b'format',
1227 b'obsstore-version',
1227 b'obsstore-version',
1228 default=None,
1228 default=None,
1229 )
1229 )
1230 coreconfigitem(
1230 coreconfigitem(
1231 b'format',
1231 b'format',
1232 b'sparse-revlog',
1232 b'sparse-revlog',
1233 default=True,
1233 default=True,
1234 )
1234 )
1235 coreconfigitem(
1235 coreconfigitem(
1236 b'format',
1236 b'format',
1237 b'revlog-compression',
1237 b'revlog-compression',
1238 default=lambda: [b'zlib'],
1238 default=lambda: [b'zlib'],
1239 alias=[(b'experimental', b'format.compression')],
1239 alias=[(b'experimental', b'format.compression')],
1240 )
1240 )
1241 coreconfigitem(
1241 coreconfigitem(
1242 b'format',
1242 b'format',
1243 b'usefncache',
1243 b'usefncache',
1244 default=True,
1244 default=True,
1245 )
1245 )
1246 coreconfigitem(
1246 coreconfigitem(
1247 b'format',
1247 b'format',
1248 b'usegeneraldelta',
1248 b'usegeneraldelta',
1249 default=True,
1249 default=True,
1250 )
1250 )
1251 coreconfigitem(
1251 coreconfigitem(
1252 b'format',
1252 b'format',
1253 b'usestore',
1253 b'usestore',
1254 default=True,
1254 default=True,
1255 )
1255 )
1256 coreconfigitem(
1256 coreconfigitem(
1257 b'format',
1257 b'format',
1258 b'use-persistent-nodemap',
1258 b'use-persistent-nodemap',
1259 default=False,
1259 default=False,
1260 )
1260 )
1261 coreconfigitem(
1261 coreconfigitem(
1262 b'format',
1262 b'format',
1263 b'exp-use-copies-side-data-changeset',
1263 b'exp-use-copies-side-data-changeset',
1264 default=False,
1264 default=False,
1265 experimental=True,
1265 experimental=True,
1266 )
1266 )
1267 coreconfigitem(
1267 coreconfigitem(
1268 b'format',
1268 b'format',
1269 b'exp-use-side-data',
1269 b'exp-use-side-data',
1270 default=False,
1270 default=False,
1271 experimental=True,
1271 experimental=True,
1272 )
1272 )
1273 coreconfigitem(
1273 coreconfigitem(
1274 b'format',
1274 b'format',
1275 b'use-share-safe',
1275 b'use-share-safe',
1276 default=False,
1276 default=False,
1277 )
1277 )
1278 coreconfigitem(
1278 coreconfigitem(
1279 b'format',
1279 b'format',
1280 b'internal-phase',
1280 b'internal-phase',
1281 default=False,
1281 default=False,
1282 experimental=True,
1282 experimental=True,
1283 )
1283 )
1284 coreconfigitem(
1284 coreconfigitem(
1285 b'fsmonitor',
1285 b'fsmonitor',
1286 b'warn_when_unused',
1286 b'warn_when_unused',
1287 default=True,
1287 default=True,
1288 )
1288 )
1289 coreconfigitem(
1289 coreconfigitem(
1290 b'fsmonitor',
1290 b'fsmonitor',
1291 b'warn_update_file_count',
1291 b'warn_update_file_count',
1292 default=50000,
1292 default=50000,
1293 )
1293 )
1294 coreconfigitem(
1294 coreconfigitem(
1295 b'fsmonitor',
1295 b'fsmonitor',
1296 b'warn_update_file_count_rust',
1296 b'warn_update_file_count_rust',
1297 default=400000,
1297 default=400000,
1298 )
1298 )
1299 coreconfigitem(
1299 coreconfigitem(
1300 b'help',
1300 b'help',
1301 br'hidden-command\..*',
1301 br'hidden-command\..*',
1302 default=False,
1302 default=False,
1303 generic=True,
1303 generic=True,
1304 )
1304 )
1305 coreconfigitem(
1305 coreconfigitem(
1306 b'help',
1306 b'help',
1307 br'hidden-topic\..*',
1307 br'hidden-topic\..*',
1308 default=False,
1308 default=False,
1309 generic=True,
1309 generic=True,
1310 )
1310 )
1311 coreconfigitem(
1311 coreconfigitem(
1312 b'hooks',
1312 b'hooks',
1313 b'.*',
1313 b'[^:]*',
1314 default=dynamicdefault,
1314 default=dynamicdefault,
1315 generic=True,
1315 generic=True,
1316 )
1316 )
1317 coreconfigitem(
1317 coreconfigitem(
1318 b'hgweb-paths',
1318 b'hgweb-paths',
1319 b'.*',
1319 b'.*',
1320 default=list,
1320 default=list,
1321 generic=True,
1321 generic=True,
1322 )
1322 )
1323 coreconfigitem(
1323 coreconfigitem(
1324 b'hostfingerprints',
1324 b'hostfingerprints',
1325 b'.*',
1325 b'.*',
1326 default=list,
1326 default=list,
1327 generic=True,
1327 generic=True,
1328 )
1328 )
1329 coreconfigitem(
1329 coreconfigitem(
1330 b'hostsecurity',
1330 b'hostsecurity',
1331 b'ciphers',
1331 b'ciphers',
1332 default=None,
1332 default=None,
1333 )
1333 )
1334 coreconfigitem(
1334 coreconfigitem(
1335 b'hostsecurity',
1335 b'hostsecurity',
1336 b'minimumprotocol',
1336 b'minimumprotocol',
1337 default=dynamicdefault,
1337 default=dynamicdefault,
1338 )
1338 )
1339 coreconfigitem(
1339 coreconfigitem(
1340 b'hostsecurity',
1340 b'hostsecurity',
1341 b'.*:minimumprotocol$',
1341 b'.*:minimumprotocol$',
1342 default=dynamicdefault,
1342 default=dynamicdefault,
1343 generic=True,
1343 generic=True,
1344 )
1344 )
1345 coreconfigitem(
1345 coreconfigitem(
1346 b'hostsecurity',
1346 b'hostsecurity',
1347 b'.*:ciphers$',
1347 b'.*:ciphers$',
1348 default=dynamicdefault,
1348 default=dynamicdefault,
1349 generic=True,
1349 generic=True,
1350 )
1350 )
1351 coreconfigitem(
1351 coreconfigitem(
1352 b'hostsecurity',
1352 b'hostsecurity',
1353 b'.*:fingerprints$',
1353 b'.*:fingerprints$',
1354 default=list,
1354 default=list,
1355 generic=True,
1355 generic=True,
1356 )
1356 )
1357 coreconfigitem(
1357 coreconfigitem(
1358 b'hostsecurity',
1358 b'hostsecurity',
1359 b'.*:verifycertsfile$',
1359 b'.*:verifycertsfile$',
1360 default=None,
1360 default=None,
1361 generic=True,
1361 generic=True,
1362 )
1362 )
1363
1363
1364 coreconfigitem(
1364 coreconfigitem(
1365 b'http_proxy',
1365 b'http_proxy',
1366 b'always',
1366 b'always',
1367 default=False,
1367 default=False,
1368 )
1368 )
1369 coreconfigitem(
1369 coreconfigitem(
1370 b'http_proxy',
1370 b'http_proxy',
1371 b'host',
1371 b'host',
1372 default=None,
1372 default=None,
1373 )
1373 )
1374 coreconfigitem(
1374 coreconfigitem(
1375 b'http_proxy',
1375 b'http_proxy',
1376 b'no',
1376 b'no',
1377 default=list,
1377 default=list,
1378 )
1378 )
1379 coreconfigitem(
1379 coreconfigitem(
1380 b'http_proxy',
1380 b'http_proxy',
1381 b'passwd',
1381 b'passwd',
1382 default=None,
1382 default=None,
1383 )
1383 )
1384 coreconfigitem(
1384 coreconfigitem(
1385 b'http_proxy',
1385 b'http_proxy',
1386 b'user',
1386 b'user',
1387 default=None,
1387 default=None,
1388 )
1388 )
1389
1389
1390 coreconfigitem(
1390 coreconfigitem(
1391 b'http',
1391 b'http',
1392 b'timeout',
1392 b'timeout',
1393 default=None,
1393 default=None,
1394 )
1394 )
1395
1395
1396 coreconfigitem(
1396 coreconfigitem(
1397 b'logtoprocess',
1397 b'logtoprocess',
1398 b'commandexception',
1398 b'commandexception',
1399 default=None,
1399 default=None,
1400 )
1400 )
1401 coreconfigitem(
1401 coreconfigitem(
1402 b'logtoprocess',
1402 b'logtoprocess',
1403 b'commandfinish',
1403 b'commandfinish',
1404 default=None,
1404 default=None,
1405 )
1405 )
1406 coreconfigitem(
1406 coreconfigitem(
1407 b'logtoprocess',
1407 b'logtoprocess',
1408 b'command',
1408 b'command',
1409 default=None,
1409 default=None,
1410 )
1410 )
1411 coreconfigitem(
1411 coreconfigitem(
1412 b'logtoprocess',
1412 b'logtoprocess',
1413 b'develwarn',
1413 b'develwarn',
1414 default=None,
1414 default=None,
1415 )
1415 )
1416 coreconfigitem(
1416 coreconfigitem(
1417 b'logtoprocess',
1417 b'logtoprocess',
1418 b'uiblocked',
1418 b'uiblocked',
1419 default=None,
1419 default=None,
1420 )
1420 )
1421 coreconfigitem(
1421 coreconfigitem(
1422 b'merge',
1422 b'merge',
1423 b'checkunknown',
1423 b'checkunknown',
1424 default=b'abort',
1424 default=b'abort',
1425 )
1425 )
1426 coreconfigitem(
1426 coreconfigitem(
1427 b'merge',
1427 b'merge',
1428 b'checkignored',
1428 b'checkignored',
1429 default=b'abort',
1429 default=b'abort',
1430 )
1430 )
1431 coreconfigitem(
1431 coreconfigitem(
1432 b'experimental',
1432 b'experimental',
1433 b'merge.checkpathconflicts',
1433 b'merge.checkpathconflicts',
1434 default=False,
1434 default=False,
1435 )
1435 )
1436 coreconfigitem(
1436 coreconfigitem(
1437 b'merge',
1437 b'merge',
1438 b'followcopies',
1438 b'followcopies',
1439 default=True,
1439 default=True,
1440 )
1440 )
1441 coreconfigitem(
1441 coreconfigitem(
1442 b'merge',
1442 b'merge',
1443 b'on-failure',
1443 b'on-failure',
1444 default=b'continue',
1444 default=b'continue',
1445 )
1445 )
1446 coreconfigitem(
1446 coreconfigitem(
1447 b'merge',
1447 b'merge',
1448 b'preferancestor',
1448 b'preferancestor',
1449 default=lambda: [b'*'],
1449 default=lambda: [b'*'],
1450 experimental=True,
1450 experimental=True,
1451 )
1451 )
1452 coreconfigitem(
1452 coreconfigitem(
1453 b'merge',
1453 b'merge',
1454 b'strict-capability-check',
1454 b'strict-capability-check',
1455 default=False,
1455 default=False,
1456 )
1456 )
1457 coreconfigitem(
1457 coreconfigitem(
1458 b'merge-tools',
1458 b'merge-tools',
1459 b'.*',
1459 b'.*',
1460 default=None,
1460 default=None,
1461 generic=True,
1461 generic=True,
1462 )
1462 )
1463 coreconfigitem(
1463 coreconfigitem(
1464 b'merge-tools',
1464 b'merge-tools',
1465 br'.*\.args$',
1465 br'.*\.args$',
1466 default=b"$local $base $other",
1466 default=b"$local $base $other",
1467 generic=True,
1467 generic=True,
1468 priority=-1,
1468 priority=-1,
1469 )
1469 )
1470 coreconfigitem(
1470 coreconfigitem(
1471 b'merge-tools',
1471 b'merge-tools',
1472 br'.*\.binary$',
1472 br'.*\.binary$',
1473 default=False,
1473 default=False,
1474 generic=True,
1474 generic=True,
1475 priority=-1,
1475 priority=-1,
1476 )
1476 )
1477 coreconfigitem(
1477 coreconfigitem(
1478 b'merge-tools',
1478 b'merge-tools',
1479 br'.*\.check$',
1479 br'.*\.check$',
1480 default=list,
1480 default=list,
1481 generic=True,
1481 generic=True,
1482 priority=-1,
1482 priority=-1,
1483 )
1483 )
1484 coreconfigitem(
1484 coreconfigitem(
1485 b'merge-tools',
1485 b'merge-tools',
1486 br'.*\.checkchanged$',
1486 br'.*\.checkchanged$',
1487 default=False,
1487 default=False,
1488 generic=True,
1488 generic=True,
1489 priority=-1,
1489 priority=-1,
1490 )
1490 )
1491 coreconfigitem(
1491 coreconfigitem(
1492 b'merge-tools',
1492 b'merge-tools',
1493 br'.*\.executable$',
1493 br'.*\.executable$',
1494 default=dynamicdefault,
1494 default=dynamicdefault,
1495 generic=True,
1495 generic=True,
1496 priority=-1,
1496 priority=-1,
1497 )
1497 )
1498 coreconfigitem(
1498 coreconfigitem(
1499 b'merge-tools',
1499 b'merge-tools',
1500 br'.*\.fixeol$',
1500 br'.*\.fixeol$',
1501 default=False,
1501 default=False,
1502 generic=True,
1502 generic=True,
1503 priority=-1,
1503 priority=-1,
1504 )
1504 )
1505 coreconfigitem(
1505 coreconfigitem(
1506 b'merge-tools',
1506 b'merge-tools',
1507 br'.*\.gui$',
1507 br'.*\.gui$',
1508 default=False,
1508 default=False,
1509 generic=True,
1509 generic=True,
1510 priority=-1,
1510 priority=-1,
1511 )
1511 )
1512 coreconfigitem(
1512 coreconfigitem(
1513 b'merge-tools',
1513 b'merge-tools',
1514 br'.*\.mergemarkers$',
1514 br'.*\.mergemarkers$',
1515 default=b'basic',
1515 default=b'basic',
1516 generic=True,
1516 generic=True,
1517 priority=-1,
1517 priority=-1,
1518 )
1518 )
1519 coreconfigitem(
1519 coreconfigitem(
1520 b'merge-tools',
1520 b'merge-tools',
1521 br'.*\.mergemarkertemplate$',
1521 br'.*\.mergemarkertemplate$',
1522 default=dynamicdefault, # take from command-templates.mergemarker
1522 default=dynamicdefault, # take from command-templates.mergemarker
1523 generic=True,
1523 generic=True,
1524 priority=-1,
1524 priority=-1,
1525 )
1525 )
1526 coreconfigitem(
1526 coreconfigitem(
1527 b'merge-tools',
1527 b'merge-tools',
1528 br'.*\.priority$',
1528 br'.*\.priority$',
1529 default=0,
1529 default=0,
1530 generic=True,
1530 generic=True,
1531 priority=-1,
1531 priority=-1,
1532 )
1532 )
1533 coreconfigitem(
1533 coreconfigitem(
1534 b'merge-tools',
1534 b'merge-tools',
1535 br'.*\.premerge$',
1535 br'.*\.premerge$',
1536 default=dynamicdefault,
1536 default=dynamicdefault,
1537 generic=True,
1537 generic=True,
1538 priority=-1,
1538 priority=-1,
1539 )
1539 )
1540 coreconfigitem(
1540 coreconfigitem(
1541 b'merge-tools',
1541 b'merge-tools',
1542 br'.*\.symlink$',
1542 br'.*\.symlink$',
1543 default=False,
1543 default=False,
1544 generic=True,
1544 generic=True,
1545 priority=-1,
1545 priority=-1,
1546 )
1546 )
1547 coreconfigitem(
1547 coreconfigitem(
1548 b'pager',
1548 b'pager',
1549 b'attend-.*',
1549 b'attend-.*',
1550 default=dynamicdefault,
1550 default=dynamicdefault,
1551 generic=True,
1551 generic=True,
1552 )
1552 )
1553 coreconfigitem(
1553 coreconfigitem(
1554 b'pager',
1554 b'pager',
1555 b'ignore',
1555 b'ignore',
1556 default=list,
1556 default=list,
1557 )
1557 )
1558 coreconfigitem(
1558 coreconfigitem(
1559 b'pager',
1559 b'pager',
1560 b'pager',
1560 b'pager',
1561 default=dynamicdefault,
1561 default=dynamicdefault,
1562 )
1562 )
1563 coreconfigitem(
1563 coreconfigitem(
1564 b'patch',
1564 b'patch',
1565 b'eol',
1565 b'eol',
1566 default=b'strict',
1566 default=b'strict',
1567 )
1567 )
1568 coreconfigitem(
1568 coreconfigitem(
1569 b'patch',
1569 b'patch',
1570 b'fuzz',
1570 b'fuzz',
1571 default=2,
1571 default=2,
1572 )
1572 )
1573 coreconfigitem(
1573 coreconfigitem(
1574 b'paths',
1574 b'paths',
1575 b'default',
1575 b'default',
1576 default=None,
1576 default=None,
1577 )
1577 )
1578 coreconfigitem(
1578 coreconfigitem(
1579 b'paths',
1579 b'paths',
1580 b'default-push',
1580 b'default-push',
1581 default=None,
1581 default=None,
1582 )
1582 )
1583 coreconfigitem(
1583 coreconfigitem(
1584 b'paths',
1584 b'paths',
1585 b'.*',
1585 b'.*',
1586 default=None,
1586 default=None,
1587 generic=True,
1587 generic=True,
1588 )
1588 )
1589 coreconfigitem(
1589 coreconfigitem(
1590 b'phases',
1590 b'phases',
1591 b'checksubrepos',
1591 b'checksubrepos',
1592 default=b'follow',
1592 default=b'follow',
1593 )
1593 )
1594 coreconfigitem(
1594 coreconfigitem(
1595 b'phases',
1595 b'phases',
1596 b'new-commit',
1596 b'new-commit',
1597 default=b'draft',
1597 default=b'draft',
1598 )
1598 )
1599 coreconfigitem(
1599 coreconfigitem(
1600 b'phases',
1600 b'phases',
1601 b'publish',
1601 b'publish',
1602 default=True,
1602 default=True,
1603 )
1603 )
1604 coreconfigitem(
1604 coreconfigitem(
1605 b'profiling',
1605 b'profiling',
1606 b'enabled',
1606 b'enabled',
1607 default=False,
1607 default=False,
1608 )
1608 )
1609 coreconfigitem(
1609 coreconfigitem(
1610 b'profiling',
1610 b'profiling',
1611 b'format',
1611 b'format',
1612 default=b'text',
1612 default=b'text',
1613 )
1613 )
1614 coreconfigitem(
1614 coreconfigitem(
1615 b'profiling',
1615 b'profiling',
1616 b'freq',
1616 b'freq',
1617 default=1000,
1617 default=1000,
1618 )
1618 )
1619 coreconfigitem(
1619 coreconfigitem(
1620 b'profiling',
1620 b'profiling',
1621 b'limit',
1621 b'limit',
1622 default=30,
1622 default=30,
1623 )
1623 )
1624 coreconfigitem(
1624 coreconfigitem(
1625 b'profiling',
1625 b'profiling',
1626 b'nested',
1626 b'nested',
1627 default=0,
1627 default=0,
1628 )
1628 )
1629 coreconfigitem(
1629 coreconfigitem(
1630 b'profiling',
1630 b'profiling',
1631 b'output',
1631 b'output',
1632 default=None,
1632 default=None,
1633 )
1633 )
1634 coreconfigitem(
1634 coreconfigitem(
1635 b'profiling',
1635 b'profiling',
1636 b'showmax',
1636 b'showmax',
1637 default=0.999,
1637 default=0.999,
1638 )
1638 )
1639 coreconfigitem(
1639 coreconfigitem(
1640 b'profiling',
1640 b'profiling',
1641 b'showmin',
1641 b'showmin',
1642 default=dynamicdefault,
1642 default=dynamicdefault,
1643 )
1643 )
1644 coreconfigitem(
1644 coreconfigitem(
1645 b'profiling',
1645 b'profiling',
1646 b'showtime',
1646 b'showtime',
1647 default=True,
1647 default=True,
1648 )
1648 )
1649 coreconfigitem(
1649 coreconfigitem(
1650 b'profiling',
1650 b'profiling',
1651 b'sort',
1651 b'sort',
1652 default=b'inlinetime',
1652 default=b'inlinetime',
1653 )
1653 )
1654 coreconfigitem(
1654 coreconfigitem(
1655 b'profiling',
1655 b'profiling',
1656 b'statformat',
1656 b'statformat',
1657 default=b'hotpath',
1657 default=b'hotpath',
1658 )
1658 )
1659 coreconfigitem(
1659 coreconfigitem(
1660 b'profiling',
1660 b'profiling',
1661 b'time-track',
1661 b'time-track',
1662 default=dynamicdefault,
1662 default=dynamicdefault,
1663 )
1663 )
1664 coreconfigitem(
1664 coreconfigitem(
1665 b'profiling',
1665 b'profiling',
1666 b'type',
1666 b'type',
1667 default=b'stat',
1667 default=b'stat',
1668 )
1668 )
1669 coreconfigitem(
1669 coreconfigitem(
1670 b'progress',
1670 b'progress',
1671 b'assume-tty',
1671 b'assume-tty',
1672 default=False,
1672 default=False,
1673 )
1673 )
1674 coreconfigitem(
1674 coreconfigitem(
1675 b'progress',
1675 b'progress',
1676 b'changedelay',
1676 b'changedelay',
1677 default=1,
1677 default=1,
1678 )
1678 )
1679 coreconfigitem(
1679 coreconfigitem(
1680 b'progress',
1680 b'progress',
1681 b'clear-complete',
1681 b'clear-complete',
1682 default=True,
1682 default=True,
1683 )
1683 )
1684 coreconfigitem(
1684 coreconfigitem(
1685 b'progress',
1685 b'progress',
1686 b'debug',
1686 b'debug',
1687 default=False,
1687 default=False,
1688 )
1688 )
1689 coreconfigitem(
1689 coreconfigitem(
1690 b'progress',
1690 b'progress',
1691 b'delay',
1691 b'delay',
1692 default=3,
1692 default=3,
1693 )
1693 )
1694 coreconfigitem(
1694 coreconfigitem(
1695 b'progress',
1695 b'progress',
1696 b'disable',
1696 b'disable',
1697 default=False,
1697 default=False,
1698 )
1698 )
1699 coreconfigitem(
1699 coreconfigitem(
1700 b'progress',
1700 b'progress',
1701 b'estimateinterval',
1701 b'estimateinterval',
1702 default=60.0,
1702 default=60.0,
1703 )
1703 )
1704 coreconfigitem(
1704 coreconfigitem(
1705 b'progress',
1705 b'progress',
1706 b'format',
1706 b'format',
1707 default=lambda: [b'topic', b'bar', b'number', b'estimate'],
1707 default=lambda: [b'topic', b'bar', b'number', b'estimate'],
1708 )
1708 )
1709 coreconfigitem(
1709 coreconfigitem(
1710 b'progress',
1710 b'progress',
1711 b'refresh',
1711 b'refresh',
1712 default=0.1,
1712 default=0.1,
1713 )
1713 )
1714 coreconfigitem(
1714 coreconfigitem(
1715 b'progress',
1715 b'progress',
1716 b'width',
1716 b'width',
1717 default=dynamicdefault,
1717 default=dynamicdefault,
1718 )
1718 )
1719 coreconfigitem(
1719 coreconfigitem(
1720 b'pull',
1720 b'pull',
1721 b'confirm',
1721 b'confirm',
1722 default=False,
1722 default=False,
1723 )
1723 )
1724 coreconfigitem(
1724 coreconfigitem(
1725 b'push',
1725 b'push',
1726 b'pushvars.server',
1726 b'pushvars.server',
1727 default=False,
1727 default=False,
1728 )
1728 )
1729 coreconfigitem(
1729 coreconfigitem(
1730 b'rewrite',
1730 b'rewrite',
1731 b'backup-bundle',
1731 b'backup-bundle',
1732 default=True,
1732 default=True,
1733 alias=[(b'ui', b'history-editing-backup')],
1733 alias=[(b'ui', b'history-editing-backup')],
1734 )
1734 )
1735 coreconfigitem(
1735 coreconfigitem(
1736 b'rewrite',
1736 b'rewrite',
1737 b'update-timestamp',
1737 b'update-timestamp',
1738 default=False,
1738 default=False,
1739 )
1739 )
1740 coreconfigitem(
1740 coreconfigitem(
1741 b'rewrite',
1741 b'rewrite',
1742 b'empty-successor',
1742 b'empty-successor',
1743 default=b'skip',
1743 default=b'skip',
1744 experimental=True,
1744 experimental=True,
1745 )
1745 )
1746 coreconfigitem(
1746 coreconfigitem(
1747 b'storage',
1747 b'storage',
1748 b'new-repo-backend',
1748 b'new-repo-backend',
1749 default=b'revlogv1',
1749 default=b'revlogv1',
1750 experimental=True,
1750 experimental=True,
1751 )
1751 )
1752 coreconfigitem(
1752 coreconfigitem(
1753 b'storage',
1753 b'storage',
1754 b'revlog.optimize-delta-parent-choice',
1754 b'revlog.optimize-delta-parent-choice',
1755 default=True,
1755 default=True,
1756 alias=[(b'format', b'aggressivemergedeltas')],
1756 alias=[(b'format', b'aggressivemergedeltas')],
1757 )
1757 )
1758 # experimental as long as rust is experimental (or a C version is implemented)
1758 # experimental as long as rust is experimental (or a C version is implemented)
1759 coreconfigitem(
1759 coreconfigitem(
1760 b'storage',
1760 b'storage',
1761 b'revlog.persistent-nodemap.mmap',
1761 b'revlog.persistent-nodemap.mmap',
1762 default=True,
1762 default=True,
1763 )
1763 )
1764 # experimental as long as format.use-persistent-nodemap is.
1764 # experimental as long as format.use-persistent-nodemap is.
1765 coreconfigitem(
1765 coreconfigitem(
1766 b'storage',
1766 b'storage',
1767 b'revlog.persistent-nodemap.slow-path',
1767 b'revlog.persistent-nodemap.slow-path',
1768 default=b"abort",
1768 default=b"abort",
1769 )
1769 )
1770
1770
1771 coreconfigitem(
1771 coreconfigitem(
1772 b'storage',
1772 b'storage',
1773 b'revlog.reuse-external-delta',
1773 b'revlog.reuse-external-delta',
1774 default=True,
1774 default=True,
1775 )
1775 )
1776 coreconfigitem(
1776 coreconfigitem(
1777 b'storage',
1777 b'storage',
1778 b'revlog.reuse-external-delta-parent',
1778 b'revlog.reuse-external-delta-parent',
1779 default=None,
1779 default=None,
1780 )
1780 )
1781 coreconfigitem(
1781 coreconfigitem(
1782 b'storage',
1782 b'storage',
1783 b'revlog.zlib.level',
1783 b'revlog.zlib.level',
1784 default=None,
1784 default=None,
1785 )
1785 )
1786 coreconfigitem(
1786 coreconfigitem(
1787 b'storage',
1787 b'storage',
1788 b'revlog.zstd.level',
1788 b'revlog.zstd.level',
1789 default=None,
1789 default=None,
1790 )
1790 )
1791 coreconfigitem(
1791 coreconfigitem(
1792 b'server',
1792 b'server',
1793 b'bookmarks-pushkey-compat',
1793 b'bookmarks-pushkey-compat',
1794 default=True,
1794 default=True,
1795 )
1795 )
1796 coreconfigitem(
1796 coreconfigitem(
1797 b'server',
1797 b'server',
1798 b'bundle1',
1798 b'bundle1',
1799 default=True,
1799 default=True,
1800 )
1800 )
1801 coreconfigitem(
1801 coreconfigitem(
1802 b'server',
1802 b'server',
1803 b'bundle1gd',
1803 b'bundle1gd',
1804 default=None,
1804 default=None,
1805 )
1805 )
1806 coreconfigitem(
1806 coreconfigitem(
1807 b'server',
1807 b'server',
1808 b'bundle1.pull',
1808 b'bundle1.pull',
1809 default=None,
1809 default=None,
1810 )
1810 )
1811 coreconfigitem(
1811 coreconfigitem(
1812 b'server',
1812 b'server',
1813 b'bundle1gd.pull',
1813 b'bundle1gd.pull',
1814 default=None,
1814 default=None,
1815 )
1815 )
1816 coreconfigitem(
1816 coreconfigitem(
1817 b'server',
1817 b'server',
1818 b'bundle1.push',
1818 b'bundle1.push',
1819 default=None,
1819 default=None,
1820 )
1820 )
1821 coreconfigitem(
1821 coreconfigitem(
1822 b'server',
1822 b'server',
1823 b'bundle1gd.push',
1823 b'bundle1gd.push',
1824 default=None,
1824 default=None,
1825 )
1825 )
1826 coreconfigitem(
1826 coreconfigitem(
1827 b'server',
1827 b'server',
1828 b'bundle2.stream',
1828 b'bundle2.stream',
1829 default=True,
1829 default=True,
1830 alias=[(b'experimental', b'bundle2.stream')],
1830 alias=[(b'experimental', b'bundle2.stream')],
1831 )
1831 )
1832 coreconfigitem(
1832 coreconfigitem(
1833 b'server',
1833 b'server',
1834 b'compressionengines',
1834 b'compressionengines',
1835 default=list,
1835 default=list,
1836 )
1836 )
1837 coreconfigitem(
1837 coreconfigitem(
1838 b'server',
1838 b'server',
1839 b'concurrent-push-mode',
1839 b'concurrent-push-mode',
1840 default=b'check-related',
1840 default=b'check-related',
1841 )
1841 )
1842 coreconfigitem(
1842 coreconfigitem(
1843 b'server',
1843 b'server',
1844 b'disablefullbundle',
1844 b'disablefullbundle',
1845 default=False,
1845 default=False,
1846 )
1846 )
1847 coreconfigitem(
1847 coreconfigitem(
1848 b'server',
1848 b'server',
1849 b'maxhttpheaderlen',
1849 b'maxhttpheaderlen',
1850 default=1024,
1850 default=1024,
1851 )
1851 )
1852 coreconfigitem(
1852 coreconfigitem(
1853 b'server',
1853 b'server',
1854 b'pullbundle',
1854 b'pullbundle',
1855 default=False,
1855 default=False,
1856 )
1856 )
1857 coreconfigitem(
1857 coreconfigitem(
1858 b'server',
1858 b'server',
1859 b'preferuncompressed',
1859 b'preferuncompressed',
1860 default=False,
1860 default=False,
1861 )
1861 )
1862 coreconfigitem(
1862 coreconfigitem(
1863 b'server',
1863 b'server',
1864 b'streamunbundle',
1864 b'streamunbundle',
1865 default=False,
1865 default=False,
1866 )
1866 )
1867 coreconfigitem(
1867 coreconfigitem(
1868 b'server',
1868 b'server',
1869 b'uncompressed',
1869 b'uncompressed',
1870 default=True,
1870 default=True,
1871 )
1871 )
1872 coreconfigitem(
1872 coreconfigitem(
1873 b'server',
1873 b'server',
1874 b'uncompressedallowsecret',
1874 b'uncompressedallowsecret',
1875 default=False,
1875 default=False,
1876 )
1876 )
1877 coreconfigitem(
1877 coreconfigitem(
1878 b'server',
1878 b'server',
1879 b'view',
1879 b'view',
1880 default=b'served',
1880 default=b'served',
1881 )
1881 )
1882 coreconfigitem(
1882 coreconfigitem(
1883 b'server',
1883 b'server',
1884 b'validate',
1884 b'validate',
1885 default=False,
1885 default=False,
1886 )
1886 )
1887 coreconfigitem(
1887 coreconfigitem(
1888 b'server',
1888 b'server',
1889 b'zliblevel',
1889 b'zliblevel',
1890 default=-1,
1890 default=-1,
1891 )
1891 )
1892 coreconfigitem(
1892 coreconfigitem(
1893 b'server',
1893 b'server',
1894 b'zstdlevel',
1894 b'zstdlevel',
1895 default=3,
1895 default=3,
1896 )
1896 )
1897 coreconfigitem(
1897 coreconfigitem(
1898 b'share',
1898 b'share',
1899 b'pool',
1899 b'pool',
1900 default=None,
1900 default=None,
1901 )
1901 )
1902 coreconfigitem(
1902 coreconfigitem(
1903 b'share',
1903 b'share',
1904 b'poolnaming',
1904 b'poolnaming',
1905 default=b'identity',
1905 default=b'identity',
1906 )
1906 )
1907 coreconfigitem(
1907 coreconfigitem(
1908 b'share',
1908 b'share',
1909 b'safe-mismatch.source-not-safe',
1909 b'safe-mismatch.source-not-safe',
1910 default=b'abort',
1910 default=b'abort',
1911 )
1911 )
1912 coreconfigitem(
1912 coreconfigitem(
1913 b'share',
1913 b'share',
1914 b'safe-mismatch.source-safe',
1914 b'safe-mismatch.source-safe',
1915 default=b'abort',
1915 default=b'abort',
1916 )
1916 )
1917 coreconfigitem(
1917 coreconfigitem(
1918 b'share',
1918 b'share',
1919 b'safe-mismatch.source-not-safe.warn',
1919 b'safe-mismatch.source-not-safe.warn',
1920 default=True,
1920 default=True,
1921 )
1921 )
1922 coreconfigitem(
1922 coreconfigitem(
1923 b'share',
1923 b'share',
1924 b'safe-mismatch.source-safe.warn',
1924 b'safe-mismatch.source-safe.warn',
1925 default=True,
1925 default=True,
1926 )
1926 )
1927 coreconfigitem(
1927 coreconfigitem(
1928 b'shelve',
1928 b'shelve',
1929 b'maxbackups',
1929 b'maxbackups',
1930 default=10,
1930 default=10,
1931 )
1931 )
1932 coreconfigitem(
1932 coreconfigitem(
1933 b'smtp',
1933 b'smtp',
1934 b'host',
1934 b'host',
1935 default=None,
1935 default=None,
1936 )
1936 )
1937 coreconfigitem(
1937 coreconfigitem(
1938 b'smtp',
1938 b'smtp',
1939 b'local_hostname',
1939 b'local_hostname',
1940 default=None,
1940 default=None,
1941 )
1941 )
1942 coreconfigitem(
1942 coreconfigitem(
1943 b'smtp',
1943 b'smtp',
1944 b'password',
1944 b'password',
1945 default=None,
1945 default=None,
1946 )
1946 )
1947 coreconfigitem(
1947 coreconfigitem(
1948 b'smtp',
1948 b'smtp',
1949 b'port',
1949 b'port',
1950 default=dynamicdefault,
1950 default=dynamicdefault,
1951 )
1951 )
1952 coreconfigitem(
1952 coreconfigitem(
1953 b'smtp',
1953 b'smtp',
1954 b'tls',
1954 b'tls',
1955 default=b'none',
1955 default=b'none',
1956 )
1956 )
1957 coreconfigitem(
1957 coreconfigitem(
1958 b'smtp',
1958 b'smtp',
1959 b'username',
1959 b'username',
1960 default=None,
1960 default=None,
1961 )
1961 )
1962 coreconfigitem(
1962 coreconfigitem(
1963 b'sparse',
1963 b'sparse',
1964 b'missingwarning',
1964 b'missingwarning',
1965 default=True,
1965 default=True,
1966 experimental=True,
1966 experimental=True,
1967 )
1967 )
1968 coreconfigitem(
1968 coreconfigitem(
1969 b'subrepos',
1969 b'subrepos',
1970 b'allowed',
1970 b'allowed',
1971 default=dynamicdefault, # to make backporting simpler
1971 default=dynamicdefault, # to make backporting simpler
1972 )
1972 )
1973 coreconfigitem(
1973 coreconfigitem(
1974 b'subrepos',
1974 b'subrepos',
1975 b'hg:allowed',
1975 b'hg:allowed',
1976 default=dynamicdefault,
1976 default=dynamicdefault,
1977 )
1977 )
1978 coreconfigitem(
1978 coreconfigitem(
1979 b'subrepos',
1979 b'subrepos',
1980 b'git:allowed',
1980 b'git:allowed',
1981 default=dynamicdefault,
1981 default=dynamicdefault,
1982 )
1982 )
1983 coreconfigitem(
1983 coreconfigitem(
1984 b'subrepos',
1984 b'subrepos',
1985 b'svn:allowed',
1985 b'svn:allowed',
1986 default=dynamicdefault,
1986 default=dynamicdefault,
1987 )
1987 )
1988 coreconfigitem(
1988 coreconfigitem(
1989 b'templates',
1989 b'templates',
1990 b'.*',
1990 b'.*',
1991 default=None,
1991 default=None,
1992 generic=True,
1992 generic=True,
1993 )
1993 )
1994 coreconfigitem(
1994 coreconfigitem(
1995 b'templateconfig',
1995 b'templateconfig',
1996 b'.*',
1996 b'.*',
1997 default=dynamicdefault,
1997 default=dynamicdefault,
1998 generic=True,
1998 generic=True,
1999 )
1999 )
2000 coreconfigitem(
2000 coreconfigitem(
2001 b'trusted',
2001 b'trusted',
2002 b'groups',
2002 b'groups',
2003 default=list,
2003 default=list,
2004 )
2004 )
2005 coreconfigitem(
2005 coreconfigitem(
2006 b'trusted',
2006 b'trusted',
2007 b'users',
2007 b'users',
2008 default=list,
2008 default=list,
2009 )
2009 )
2010 coreconfigitem(
2010 coreconfigitem(
2011 b'ui',
2011 b'ui',
2012 b'_usedassubrepo',
2012 b'_usedassubrepo',
2013 default=False,
2013 default=False,
2014 )
2014 )
2015 coreconfigitem(
2015 coreconfigitem(
2016 b'ui',
2016 b'ui',
2017 b'allowemptycommit',
2017 b'allowemptycommit',
2018 default=False,
2018 default=False,
2019 )
2019 )
2020 coreconfigitem(
2020 coreconfigitem(
2021 b'ui',
2021 b'ui',
2022 b'archivemeta',
2022 b'archivemeta',
2023 default=True,
2023 default=True,
2024 )
2024 )
2025 coreconfigitem(
2025 coreconfigitem(
2026 b'ui',
2026 b'ui',
2027 b'askusername',
2027 b'askusername',
2028 default=False,
2028 default=False,
2029 )
2029 )
2030 coreconfigitem(
2030 coreconfigitem(
2031 b'ui',
2031 b'ui',
2032 b'available-memory',
2032 b'available-memory',
2033 default=None,
2033 default=None,
2034 )
2034 )
2035
2035
2036 coreconfigitem(
2036 coreconfigitem(
2037 b'ui',
2037 b'ui',
2038 b'clonebundlefallback',
2038 b'clonebundlefallback',
2039 default=False,
2039 default=False,
2040 )
2040 )
2041 coreconfigitem(
2041 coreconfigitem(
2042 b'ui',
2042 b'ui',
2043 b'clonebundleprefers',
2043 b'clonebundleprefers',
2044 default=list,
2044 default=list,
2045 )
2045 )
2046 coreconfigitem(
2046 coreconfigitem(
2047 b'ui',
2047 b'ui',
2048 b'clonebundles',
2048 b'clonebundles',
2049 default=True,
2049 default=True,
2050 )
2050 )
2051 coreconfigitem(
2051 coreconfigitem(
2052 b'ui',
2052 b'ui',
2053 b'color',
2053 b'color',
2054 default=b'auto',
2054 default=b'auto',
2055 )
2055 )
2056 coreconfigitem(
2056 coreconfigitem(
2057 b'ui',
2057 b'ui',
2058 b'commitsubrepos',
2058 b'commitsubrepos',
2059 default=False,
2059 default=False,
2060 )
2060 )
2061 coreconfigitem(
2061 coreconfigitem(
2062 b'ui',
2062 b'ui',
2063 b'debug',
2063 b'debug',
2064 default=False,
2064 default=False,
2065 )
2065 )
2066 coreconfigitem(
2066 coreconfigitem(
2067 b'ui',
2067 b'ui',
2068 b'debugger',
2068 b'debugger',
2069 default=None,
2069 default=None,
2070 )
2070 )
2071 coreconfigitem(
2071 coreconfigitem(
2072 b'ui',
2072 b'ui',
2073 b'editor',
2073 b'editor',
2074 default=dynamicdefault,
2074 default=dynamicdefault,
2075 )
2075 )
2076 coreconfigitem(
2076 coreconfigitem(
2077 b'ui',
2077 b'ui',
2078 b'detailed-exit-code',
2078 b'detailed-exit-code',
2079 default=False,
2079 default=False,
2080 experimental=True,
2080 experimental=True,
2081 )
2081 )
2082 coreconfigitem(
2082 coreconfigitem(
2083 b'ui',
2083 b'ui',
2084 b'fallbackencoding',
2084 b'fallbackencoding',
2085 default=None,
2085 default=None,
2086 )
2086 )
2087 coreconfigitem(
2087 coreconfigitem(
2088 b'ui',
2088 b'ui',
2089 b'forcecwd',
2089 b'forcecwd',
2090 default=None,
2090 default=None,
2091 )
2091 )
2092 coreconfigitem(
2092 coreconfigitem(
2093 b'ui',
2093 b'ui',
2094 b'forcemerge',
2094 b'forcemerge',
2095 default=None,
2095 default=None,
2096 )
2096 )
2097 coreconfigitem(
2097 coreconfigitem(
2098 b'ui',
2098 b'ui',
2099 b'formatdebug',
2099 b'formatdebug',
2100 default=False,
2100 default=False,
2101 )
2101 )
2102 coreconfigitem(
2102 coreconfigitem(
2103 b'ui',
2103 b'ui',
2104 b'formatjson',
2104 b'formatjson',
2105 default=False,
2105 default=False,
2106 )
2106 )
2107 coreconfigitem(
2107 coreconfigitem(
2108 b'ui',
2108 b'ui',
2109 b'formatted',
2109 b'formatted',
2110 default=None,
2110 default=None,
2111 )
2111 )
2112 coreconfigitem(
2112 coreconfigitem(
2113 b'ui',
2113 b'ui',
2114 b'interactive',
2114 b'interactive',
2115 default=None,
2115 default=None,
2116 )
2116 )
2117 coreconfigitem(
2117 coreconfigitem(
2118 b'ui',
2118 b'ui',
2119 b'interface',
2119 b'interface',
2120 default=None,
2120 default=None,
2121 )
2121 )
2122 coreconfigitem(
2122 coreconfigitem(
2123 b'ui',
2123 b'ui',
2124 b'interface.chunkselector',
2124 b'interface.chunkselector',
2125 default=None,
2125 default=None,
2126 )
2126 )
2127 coreconfigitem(
2127 coreconfigitem(
2128 b'ui',
2128 b'ui',
2129 b'large-file-limit',
2129 b'large-file-limit',
2130 default=10000000,
2130 default=10000000,
2131 )
2131 )
2132 coreconfigitem(
2132 coreconfigitem(
2133 b'ui',
2133 b'ui',
2134 b'logblockedtimes',
2134 b'logblockedtimes',
2135 default=False,
2135 default=False,
2136 )
2136 )
2137 coreconfigitem(
2137 coreconfigitem(
2138 b'ui',
2138 b'ui',
2139 b'merge',
2139 b'merge',
2140 default=None,
2140 default=None,
2141 )
2141 )
2142 coreconfigitem(
2142 coreconfigitem(
2143 b'ui',
2143 b'ui',
2144 b'mergemarkers',
2144 b'mergemarkers',
2145 default=b'basic',
2145 default=b'basic',
2146 )
2146 )
2147 coreconfigitem(
2147 coreconfigitem(
2148 b'ui',
2148 b'ui',
2149 b'message-output',
2149 b'message-output',
2150 default=b'stdio',
2150 default=b'stdio',
2151 )
2151 )
2152 coreconfigitem(
2152 coreconfigitem(
2153 b'ui',
2153 b'ui',
2154 b'nontty',
2154 b'nontty',
2155 default=False,
2155 default=False,
2156 )
2156 )
2157 coreconfigitem(
2157 coreconfigitem(
2158 b'ui',
2158 b'ui',
2159 b'origbackuppath',
2159 b'origbackuppath',
2160 default=None,
2160 default=None,
2161 )
2161 )
2162 coreconfigitem(
2162 coreconfigitem(
2163 b'ui',
2163 b'ui',
2164 b'paginate',
2164 b'paginate',
2165 default=True,
2165 default=True,
2166 )
2166 )
2167 coreconfigitem(
2167 coreconfigitem(
2168 b'ui',
2168 b'ui',
2169 b'patch',
2169 b'patch',
2170 default=None,
2170 default=None,
2171 )
2171 )
2172 coreconfigitem(
2172 coreconfigitem(
2173 b'ui',
2173 b'ui',
2174 b'portablefilenames',
2174 b'portablefilenames',
2175 default=b'warn',
2175 default=b'warn',
2176 )
2176 )
2177 coreconfigitem(
2177 coreconfigitem(
2178 b'ui',
2178 b'ui',
2179 b'promptecho',
2179 b'promptecho',
2180 default=False,
2180 default=False,
2181 )
2181 )
2182 coreconfigitem(
2182 coreconfigitem(
2183 b'ui',
2183 b'ui',
2184 b'quiet',
2184 b'quiet',
2185 default=False,
2185 default=False,
2186 )
2186 )
2187 coreconfigitem(
2187 coreconfigitem(
2188 b'ui',
2188 b'ui',
2189 b'quietbookmarkmove',
2189 b'quietbookmarkmove',
2190 default=False,
2190 default=False,
2191 )
2191 )
2192 coreconfigitem(
2192 coreconfigitem(
2193 b'ui',
2193 b'ui',
2194 b'relative-paths',
2194 b'relative-paths',
2195 default=b'legacy',
2195 default=b'legacy',
2196 )
2196 )
2197 coreconfigitem(
2197 coreconfigitem(
2198 b'ui',
2198 b'ui',
2199 b'remotecmd',
2199 b'remotecmd',
2200 default=b'hg',
2200 default=b'hg',
2201 )
2201 )
2202 coreconfigitem(
2202 coreconfigitem(
2203 b'ui',
2203 b'ui',
2204 b'report_untrusted',
2204 b'report_untrusted',
2205 default=True,
2205 default=True,
2206 )
2206 )
2207 coreconfigitem(
2207 coreconfigitem(
2208 b'ui',
2208 b'ui',
2209 b'rollback',
2209 b'rollback',
2210 default=True,
2210 default=True,
2211 )
2211 )
2212 coreconfigitem(
2212 coreconfigitem(
2213 b'ui',
2213 b'ui',
2214 b'signal-safe-lock',
2214 b'signal-safe-lock',
2215 default=True,
2215 default=True,
2216 )
2216 )
2217 coreconfigitem(
2217 coreconfigitem(
2218 b'ui',
2218 b'ui',
2219 b'slash',
2219 b'slash',
2220 default=False,
2220 default=False,
2221 )
2221 )
2222 coreconfigitem(
2222 coreconfigitem(
2223 b'ui',
2223 b'ui',
2224 b'ssh',
2224 b'ssh',
2225 default=b'ssh',
2225 default=b'ssh',
2226 )
2226 )
2227 coreconfigitem(
2227 coreconfigitem(
2228 b'ui',
2228 b'ui',
2229 b'ssherrorhint',
2229 b'ssherrorhint',
2230 default=None,
2230 default=None,
2231 )
2231 )
2232 coreconfigitem(
2232 coreconfigitem(
2233 b'ui',
2233 b'ui',
2234 b'statuscopies',
2234 b'statuscopies',
2235 default=False,
2235 default=False,
2236 )
2236 )
2237 coreconfigitem(
2237 coreconfigitem(
2238 b'ui',
2238 b'ui',
2239 b'strict',
2239 b'strict',
2240 default=False,
2240 default=False,
2241 )
2241 )
2242 coreconfigitem(
2242 coreconfigitem(
2243 b'ui',
2243 b'ui',
2244 b'style',
2244 b'style',
2245 default=b'',
2245 default=b'',
2246 )
2246 )
2247 coreconfigitem(
2247 coreconfigitem(
2248 b'ui',
2248 b'ui',
2249 b'supportcontact',
2249 b'supportcontact',
2250 default=None,
2250 default=None,
2251 )
2251 )
2252 coreconfigitem(
2252 coreconfigitem(
2253 b'ui',
2253 b'ui',
2254 b'textwidth',
2254 b'textwidth',
2255 default=78,
2255 default=78,
2256 )
2256 )
2257 coreconfigitem(
2257 coreconfigitem(
2258 b'ui',
2258 b'ui',
2259 b'timeout',
2259 b'timeout',
2260 default=b'600',
2260 default=b'600',
2261 )
2261 )
2262 coreconfigitem(
2262 coreconfigitem(
2263 b'ui',
2263 b'ui',
2264 b'timeout.warn',
2264 b'timeout.warn',
2265 default=0,
2265 default=0,
2266 )
2266 )
2267 coreconfigitem(
2267 coreconfigitem(
2268 b'ui',
2268 b'ui',
2269 b'timestamp-output',
2269 b'timestamp-output',
2270 default=False,
2270 default=False,
2271 )
2271 )
2272 coreconfigitem(
2272 coreconfigitem(
2273 b'ui',
2273 b'ui',
2274 b'traceback',
2274 b'traceback',
2275 default=False,
2275 default=False,
2276 )
2276 )
2277 coreconfigitem(
2277 coreconfigitem(
2278 b'ui',
2278 b'ui',
2279 b'tweakdefaults',
2279 b'tweakdefaults',
2280 default=False,
2280 default=False,
2281 )
2281 )
2282 coreconfigitem(b'ui', b'username', alias=[(b'ui', b'user')])
2282 coreconfigitem(b'ui', b'username', alias=[(b'ui', b'user')])
2283 coreconfigitem(
2283 coreconfigitem(
2284 b'ui',
2284 b'ui',
2285 b'verbose',
2285 b'verbose',
2286 default=False,
2286 default=False,
2287 )
2287 )
2288 coreconfigitem(
2288 coreconfigitem(
2289 b'verify',
2289 b'verify',
2290 b'skipflags',
2290 b'skipflags',
2291 default=None,
2291 default=None,
2292 )
2292 )
2293 coreconfigitem(
2293 coreconfigitem(
2294 b'web',
2294 b'web',
2295 b'allowbz2',
2295 b'allowbz2',
2296 default=False,
2296 default=False,
2297 )
2297 )
2298 coreconfigitem(
2298 coreconfigitem(
2299 b'web',
2299 b'web',
2300 b'allowgz',
2300 b'allowgz',
2301 default=False,
2301 default=False,
2302 )
2302 )
2303 coreconfigitem(
2303 coreconfigitem(
2304 b'web',
2304 b'web',
2305 b'allow-pull',
2305 b'allow-pull',
2306 alias=[(b'web', b'allowpull')],
2306 alias=[(b'web', b'allowpull')],
2307 default=True,
2307 default=True,
2308 )
2308 )
2309 coreconfigitem(
2309 coreconfigitem(
2310 b'web',
2310 b'web',
2311 b'allow-push',
2311 b'allow-push',
2312 alias=[(b'web', b'allow_push')],
2312 alias=[(b'web', b'allow_push')],
2313 default=list,
2313 default=list,
2314 )
2314 )
2315 coreconfigitem(
2315 coreconfigitem(
2316 b'web',
2316 b'web',
2317 b'allowzip',
2317 b'allowzip',
2318 default=False,
2318 default=False,
2319 )
2319 )
2320 coreconfigitem(
2320 coreconfigitem(
2321 b'web',
2321 b'web',
2322 b'archivesubrepos',
2322 b'archivesubrepos',
2323 default=False,
2323 default=False,
2324 )
2324 )
2325 coreconfigitem(
2325 coreconfigitem(
2326 b'web',
2326 b'web',
2327 b'cache',
2327 b'cache',
2328 default=True,
2328 default=True,
2329 )
2329 )
2330 coreconfigitem(
2330 coreconfigitem(
2331 b'web',
2331 b'web',
2332 b'comparisoncontext',
2332 b'comparisoncontext',
2333 default=5,
2333 default=5,
2334 )
2334 )
2335 coreconfigitem(
2335 coreconfigitem(
2336 b'web',
2336 b'web',
2337 b'contact',
2337 b'contact',
2338 default=None,
2338 default=None,
2339 )
2339 )
2340 coreconfigitem(
2340 coreconfigitem(
2341 b'web',
2341 b'web',
2342 b'deny_push',
2342 b'deny_push',
2343 default=list,
2343 default=list,
2344 )
2344 )
2345 coreconfigitem(
2345 coreconfigitem(
2346 b'web',
2346 b'web',
2347 b'guessmime',
2347 b'guessmime',
2348 default=False,
2348 default=False,
2349 )
2349 )
2350 coreconfigitem(
2350 coreconfigitem(
2351 b'web',
2351 b'web',
2352 b'hidden',
2352 b'hidden',
2353 default=False,
2353 default=False,
2354 )
2354 )
2355 coreconfigitem(
2355 coreconfigitem(
2356 b'web',
2356 b'web',
2357 b'labels',
2357 b'labels',
2358 default=list,
2358 default=list,
2359 )
2359 )
2360 coreconfigitem(
2360 coreconfigitem(
2361 b'web',
2361 b'web',
2362 b'logoimg',
2362 b'logoimg',
2363 default=b'hglogo.png',
2363 default=b'hglogo.png',
2364 )
2364 )
2365 coreconfigitem(
2365 coreconfigitem(
2366 b'web',
2366 b'web',
2367 b'logourl',
2367 b'logourl',
2368 default=b'https://mercurial-scm.org/',
2368 default=b'https://mercurial-scm.org/',
2369 )
2369 )
2370 coreconfigitem(
2370 coreconfigitem(
2371 b'web',
2371 b'web',
2372 b'accesslog',
2372 b'accesslog',
2373 default=b'-',
2373 default=b'-',
2374 )
2374 )
2375 coreconfigitem(
2375 coreconfigitem(
2376 b'web',
2376 b'web',
2377 b'address',
2377 b'address',
2378 default=b'',
2378 default=b'',
2379 )
2379 )
2380 coreconfigitem(
2380 coreconfigitem(
2381 b'web',
2381 b'web',
2382 b'allow-archive',
2382 b'allow-archive',
2383 alias=[(b'web', b'allow_archive')],
2383 alias=[(b'web', b'allow_archive')],
2384 default=list,
2384 default=list,
2385 )
2385 )
2386 coreconfigitem(
2386 coreconfigitem(
2387 b'web',
2387 b'web',
2388 b'allow_read',
2388 b'allow_read',
2389 default=list,
2389 default=list,
2390 )
2390 )
2391 coreconfigitem(
2391 coreconfigitem(
2392 b'web',
2392 b'web',
2393 b'baseurl',
2393 b'baseurl',
2394 default=None,
2394 default=None,
2395 )
2395 )
2396 coreconfigitem(
2396 coreconfigitem(
2397 b'web',
2397 b'web',
2398 b'cacerts',
2398 b'cacerts',
2399 default=None,
2399 default=None,
2400 )
2400 )
2401 coreconfigitem(
2401 coreconfigitem(
2402 b'web',
2402 b'web',
2403 b'certificate',
2403 b'certificate',
2404 default=None,
2404 default=None,
2405 )
2405 )
2406 coreconfigitem(
2406 coreconfigitem(
2407 b'web',
2407 b'web',
2408 b'collapse',
2408 b'collapse',
2409 default=False,
2409 default=False,
2410 )
2410 )
2411 coreconfigitem(
2411 coreconfigitem(
2412 b'web',
2412 b'web',
2413 b'csp',
2413 b'csp',
2414 default=None,
2414 default=None,
2415 )
2415 )
2416 coreconfigitem(
2416 coreconfigitem(
2417 b'web',
2417 b'web',
2418 b'deny_read',
2418 b'deny_read',
2419 default=list,
2419 default=list,
2420 )
2420 )
2421 coreconfigitem(
2421 coreconfigitem(
2422 b'web',
2422 b'web',
2423 b'descend',
2423 b'descend',
2424 default=True,
2424 default=True,
2425 )
2425 )
2426 coreconfigitem(
2426 coreconfigitem(
2427 b'web',
2427 b'web',
2428 b'description',
2428 b'description',
2429 default=b"",
2429 default=b"",
2430 )
2430 )
2431 coreconfigitem(
2431 coreconfigitem(
2432 b'web',
2432 b'web',
2433 b'encoding',
2433 b'encoding',
2434 default=lambda: encoding.encoding,
2434 default=lambda: encoding.encoding,
2435 )
2435 )
2436 coreconfigitem(
2436 coreconfigitem(
2437 b'web',
2437 b'web',
2438 b'errorlog',
2438 b'errorlog',
2439 default=b'-',
2439 default=b'-',
2440 )
2440 )
2441 coreconfigitem(
2441 coreconfigitem(
2442 b'web',
2442 b'web',
2443 b'ipv6',
2443 b'ipv6',
2444 default=False,
2444 default=False,
2445 )
2445 )
2446 coreconfigitem(
2446 coreconfigitem(
2447 b'web',
2447 b'web',
2448 b'maxchanges',
2448 b'maxchanges',
2449 default=10,
2449 default=10,
2450 )
2450 )
2451 coreconfigitem(
2451 coreconfigitem(
2452 b'web',
2452 b'web',
2453 b'maxfiles',
2453 b'maxfiles',
2454 default=10,
2454 default=10,
2455 )
2455 )
2456 coreconfigitem(
2456 coreconfigitem(
2457 b'web',
2457 b'web',
2458 b'maxshortchanges',
2458 b'maxshortchanges',
2459 default=60,
2459 default=60,
2460 )
2460 )
2461 coreconfigitem(
2461 coreconfigitem(
2462 b'web',
2462 b'web',
2463 b'motd',
2463 b'motd',
2464 default=b'',
2464 default=b'',
2465 )
2465 )
2466 coreconfigitem(
2466 coreconfigitem(
2467 b'web',
2467 b'web',
2468 b'name',
2468 b'name',
2469 default=dynamicdefault,
2469 default=dynamicdefault,
2470 )
2470 )
2471 coreconfigitem(
2471 coreconfigitem(
2472 b'web',
2472 b'web',
2473 b'port',
2473 b'port',
2474 default=8000,
2474 default=8000,
2475 )
2475 )
2476 coreconfigitem(
2476 coreconfigitem(
2477 b'web',
2477 b'web',
2478 b'prefix',
2478 b'prefix',
2479 default=b'',
2479 default=b'',
2480 )
2480 )
2481 coreconfigitem(
2481 coreconfigitem(
2482 b'web',
2482 b'web',
2483 b'push_ssl',
2483 b'push_ssl',
2484 default=True,
2484 default=True,
2485 )
2485 )
2486 coreconfigitem(
2486 coreconfigitem(
2487 b'web',
2487 b'web',
2488 b'refreshinterval',
2488 b'refreshinterval',
2489 default=20,
2489 default=20,
2490 )
2490 )
2491 coreconfigitem(
2491 coreconfigitem(
2492 b'web',
2492 b'web',
2493 b'server-header',
2493 b'server-header',
2494 default=None,
2494 default=None,
2495 )
2495 )
2496 coreconfigitem(
2496 coreconfigitem(
2497 b'web',
2497 b'web',
2498 b'static',
2498 b'static',
2499 default=None,
2499 default=None,
2500 )
2500 )
2501 coreconfigitem(
2501 coreconfigitem(
2502 b'web',
2502 b'web',
2503 b'staticurl',
2503 b'staticurl',
2504 default=None,
2504 default=None,
2505 )
2505 )
2506 coreconfigitem(
2506 coreconfigitem(
2507 b'web',
2507 b'web',
2508 b'stripes',
2508 b'stripes',
2509 default=1,
2509 default=1,
2510 )
2510 )
2511 coreconfigitem(
2511 coreconfigitem(
2512 b'web',
2512 b'web',
2513 b'style',
2513 b'style',
2514 default=b'paper',
2514 default=b'paper',
2515 )
2515 )
2516 coreconfigitem(
2516 coreconfigitem(
2517 b'web',
2517 b'web',
2518 b'templates',
2518 b'templates',
2519 default=None,
2519 default=None,
2520 )
2520 )
2521 coreconfigitem(
2521 coreconfigitem(
2522 b'web',
2522 b'web',
2523 b'view',
2523 b'view',
2524 default=b'served',
2524 default=b'served',
2525 experimental=True,
2525 experimental=True,
2526 )
2526 )
2527 coreconfigitem(
2527 coreconfigitem(
2528 b'worker',
2528 b'worker',
2529 b'backgroundclose',
2529 b'backgroundclose',
2530 default=dynamicdefault,
2530 default=dynamicdefault,
2531 )
2531 )
2532 # Windows defaults to a limit of 512 open files. A buffer of 128
2532 # Windows defaults to a limit of 512 open files. A buffer of 128
2533 # should give us enough headway.
2533 # should give us enough headway.
2534 coreconfigitem(
2534 coreconfigitem(
2535 b'worker',
2535 b'worker',
2536 b'backgroundclosemaxqueue',
2536 b'backgroundclosemaxqueue',
2537 default=384,
2537 default=384,
2538 )
2538 )
2539 coreconfigitem(
2539 coreconfigitem(
2540 b'worker',
2540 b'worker',
2541 b'backgroundcloseminfilecount',
2541 b'backgroundcloseminfilecount',
2542 default=2048,
2542 default=2048,
2543 )
2543 )
2544 coreconfigitem(
2544 coreconfigitem(
2545 b'worker',
2545 b'worker',
2546 b'backgroundclosethreadcount',
2546 b'backgroundclosethreadcount',
2547 default=4,
2547 default=4,
2548 )
2548 )
2549 coreconfigitem(
2549 coreconfigitem(
2550 b'worker',
2550 b'worker',
2551 b'enabled',
2551 b'enabled',
2552 default=True,
2552 default=True,
2553 )
2553 )
2554 coreconfigitem(
2554 coreconfigitem(
2555 b'worker',
2555 b'worker',
2556 b'numcpus',
2556 b'numcpus',
2557 default=None,
2557 default=None,
2558 )
2558 )
2559
2559
2560 # Rebase related configuration moved to core because other extension are doing
2560 # Rebase related configuration moved to core because other extension are doing
2561 # strange things. For example, shelve import the extensions to reuse some bit
2561 # strange things. For example, shelve import the extensions to reuse some bit
2562 # without formally loading it.
2562 # without formally loading it.
2563 coreconfigitem(
2563 coreconfigitem(
2564 b'commands',
2564 b'commands',
2565 b'rebase.requiredest',
2565 b'rebase.requiredest',
2566 default=False,
2566 default=False,
2567 )
2567 )
2568 coreconfigitem(
2568 coreconfigitem(
2569 b'experimental',
2569 b'experimental',
2570 b'rebaseskipobsolete',
2570 b'rebaseskipobsolete',
2571 default=True,
2571 default=True,
2572 )
2572 )
2573 coreconfigitem(
2573 coreconfigitem(
2574 b'rebase',
2574 b'rebase',
2575 b'singletransaction',
2575 b'singletransaction',
2576 default=False,
2576 default=False,
2577 )
2577 )
2578 coreconfigitem(
2578 coreconfigitem(
2579 b'rebase',
2579 b'rebase',
2580 b'experimental.inmemory',
2580 b'experimental.inmemory',
2581 default=False,
2581 default=False,
2582 )
2582 )
@@ -1,350 +1,354 b''
1 # hook.py - hook support for mercurial
1 # hook.py - hook support for mercurial
2 #
2 #
3 # Copyright 2007 Matt Mackall <mpm@selenic.com>
3 # Copyright 2007 Matt Mackall <mpm@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 contextlib
10 import contextlib
11 import errno
11 import errno
12 import os
12 import os
13 import sys
13 import sys
14
14
15 from .i18n import _
15 from .i18n import _
16 from .pycompat import getattr
16 from .pycompat import getattr
17 from . import (
17 from . import (
18 demandimport,
18 demandimport,
19 encoding,
19 encoding,
20 error,
20 error,
21 extensions,
21 extensions,
22 pycompat,
22 pycompat,
23 util,
23 util,
24 )
24 )
25 from .utils import (
25 from .utils import (
26 procutil,
26 procutil,
27 resourceutil,
27 resourceutil,
28 stringutil,
28 stringutil,
29 )
29 )
30
30
31
31
32 def pythonhook(ui, repo, htype, hname, funcname, args, throw):
32 def pythonhook(ui, repo, htype, hname, funcname, args, throw):
33 """call python hook. hook is callable object, looked up as
33 """call python hook. hook is callable object, looked up as
34 name in python module. if callable returns "true", hook
34 name in python module. if callable returns "true", hook
35 fails, else passes. if hook raises exception, treated as
35 fails, else passes. if hook raises exception, treated as
36 hook failure. exception propagates if throw is "true".
36 hook failure. exception propagates if throw is "true".
37
37
38 reason for "true" meaning "hook failed" is so that
38 reason for "true" meaning "hook failed" is so that
39 unmodified commands (e.g. mercurial.commands.update) can
39 unmodified commands (e.g. mercurial.commands.update) can
40 be run as hooks without wrappers to convert return values."""
40 be run as hooks without wrappers to convert return values."""
41
41
42 if callable(funcname):
42 if callable(funcname):
43 obj = funcname
43 obj = funcname
44 funcname = pycompat.sysbytes(obj.__module__ + "." + obj.__name__)
44 funcname = pycompat.sysbytes(obj.__module__ + "." + obj.__name__)
45 else:
45 else:
46 d = funcname.rfind(b'.')
46 d = funcname.rfind(b'.')
47 if d == -1:
47 if d == -1:
48 raise error.HookLoadError(
48 raise error.HookLoadError(
49 _(b'%s hook is invalid: "%s" not in a module')
49 _(b'%s hook is invalid: "%s" not in a module')
50 % (hname, funcname)
50 % (hname, funcname)
51 )
51 )
52 modname = funcname[:d]
52 modname = funcname[:d]
53 oldpaths = sys.path
53 oldpaths = sys.path
54 if resourceutil.mainfrozen():
54 if resourceutil.mainfrozen():
55 # binary installs require sys.path manipulation
55 # binary installs require sys.path manipulation
56 modpath, modfile = os.path.split(modname)
56 modpath, modfile = os.path.split(modname)
57 if modpath and modfile:
57 if modpath and modfile:
58 sys.path = sys.path[:] + [modpath]
58 sys.path = sys.path[:] + [modpath]
59 modname = modfile
59 modname = modfile
60 with demandimport.deactivated():
60 with demandimport.deactivated():
61 try:
61 try:
62 obj = __import__(pycompat.sysstr(modname))
62 obj = __import__(pycompat.sysstr(modname))
63 except (ImportError, SyntaxError):
63 except (ImportError, SyntaxError):
64 e1 = sys.exc_info()
64 e1 = sys.exc_info()
65 try:
65 try:
66 # extensions are loaded with hgext_ prefix
66 # extensions are loaded with hgext_ prefix
67 obj = __import__("hgext_%s" % pycompat.sysstr(modname))
67 obj = __import__("hgext_%s" % pycompat.sysstr(modname))
68 except (ImportError, SyntaxError):
68 except (ImportError, SyntaxError):
69 e2 = sys.exc_info()
69 e2 = sys.exc_info()
70 if ui.tracebackflag:
70 if ui.tracebackflag:
71 ui.warn(
71 ui.warn(
72 _(
72 _(
73 b'exception from first failed import '
73 b'exception from first failed import '
74 b'attempt:\n'
74 b'attempt:\n'
75 )
75 )
76 )
76 )
77 ui.traceback(e1)
77 ui.traceback(e1)
78 if ui.tracebackflag:
78 if ui.tracebackflag:
79 ui.warn(
79 ui.warn(
80 _(
80 _(
81 b'exception from second failed import '
81 b'exception from second failed import '
82 b'attempt:\n'
82 b'attempt:\n'
83 )
83 )
84 )
84 )
85 ui.traceback(e2)
85 ui.traceback(e2)
86
86
87 if not ui.tracebackflag:
87 if not ui.tracebackflag:
88 tracebackhint = _(
88 tracebackhint = _(
89 b'run with --traceback for stack trace'
89 b'run with --traceback for stack trace'
90 )
90 )
91 else:
91 else:
92 tracebackhint = None
92 tracebackhint = None
93 raise error.HookLoadError(
93 raise error.HookLoadError(
94 _(b'%s hook is invalid: import of "%s" failed')
94 _(b'%s hook is invalid: import of "%s" failed')
95 % (hname, modname),
95 % (hname, modname),
96 hint=tracebackhint,
96 hint=tracebackhint,
97 )
97 )
98 sys.path = oldpaths
98 sys.path = oldpaths
99 try:
99 try:
100 for p in funcname.split(b'.')[1:]:
100 for p in funcname.split(b'.')[1:]:
101 obj = getattr(obj, p)
101 obj = getattr(obj, p)
102 except AttributeError:
102 except AttributeError:
103 raise error.HookLoadError(
103 raise error.HookLoadError(
104 _(b'%s hook is invalid: "%s" is not defined')
104 _(b'%s hook is invalid: "%s" is not defined')
105 % (hname, funcname)
105 % (hname, funcname)
106 )
106 )
107 if not callable(obj):
107 if not callable(obj):
108 raise error.HookLoadError(
108 raise error.HookLoadError(
109 _(b'%s hook is invalid: "%s" is not callable')
109 _(b'%s hook is invalid: "%s" is not callable')
110 % (hname, funcname)
110 % (hname, funcname)
111 )
111 )
112
112
113 ui.note(_(b"calling hook %s: %s\n") % (hname, funcname))
113 ui.note(_(b"calling hook %s: %s\n") % (hname, funcname))
114 starttime = util.timer()
114 starttime = util.timer()
115
115
116 try:
116 try:
117 r = obj(ui=ui, repo=repo, hooktype=htype, **pycompat.strkwargs(args))
117 r = obj(ui=ui, repo=repo, hooktype=htype, **pycompat.strkwargs(args))
118 except Exception as exc:
118 except Exception as exc:
119 if isinstance(exc, error.Abort):
119 if isinstance(exc, error.Abort):
120 ui.warn(_(b'error: %s hook failed: %s\n') % (hname, exc.args[0]))
120 ui.warn(_(b'error: %s hook failed: %s\n') % (hname, exc.args[0]))
121 else:
121 else:
122 ui.warn(
122 ui.warn(
123 _(b'error: %s hook raised an exception: %s\n')
123 _(b'error: %s hook raised an exception: %s\n')
124 % (hname, stringutil.forcebytestr(exc))
124 % (hname, stringutil.forcebytestr(exc))
125 )
125 )
126 if throw:
126 if throw:
127 raise
127 raise
128 if not ui.tracebackflag:
128 if not ui.tracebackflag:
129 ui.warn(_(b'(run with --traceback for stack trace)\n'))
129 ui.warn(_(b'(run with --traceback for stack trace)\n'))
130 ui.traceback()
130 ui.traceback()
131 return True, True
131 return True, True
132 finally:
132 finally:
133 duration = util.timer() - starttime
133 duration = util.timer() - starttime
134 ui.log(
134 ui.log(
135 b'pythonhook',
135 b'pythonhook',
136 b'pythonhook-%s: %s finished in %0.2f seconds\n',
136 b'pythonhook-%s: %s finished in %0.2f seconds\n',
137 htype,
137 htype,
138 funcname,
138 funcname,
139 duration,
139 duration,
140 )
140 )
141 if r:
141 if r:
142 if throw:
142 if throw:
143 raise error.HookAbort(_(b'%s hook failed') % hname)
143 raise error.HookAbort(_(b'%s hook failed') % hname)
144 ui.warn(_(b'warning: %s hook failed\n') % hname)
144 ui.warn(_(b'warning: %s hook failed\n') % hname)
145 return r, False
145 return r, False
146
146
147
147
148 def _exthook(ui, repo, htype, name, cmd, args, throw):
148 def _exthook(ui, repo, htype, name, cmd, args, throw):
149 starttime = util.timer()
149 starttime = util.timer()
150 env = {}
150 env = {}
151
151
152 # make in-memory changes visible to external process
152 # make in-memory changes visible to external process
153 if repo is not None:
153 if repo is not None:
154 tr = repo.currenttransaction()
154 tr = repo.currenttransaction()
155 repo.dirstate.write(tr)
155 repo.dirstate.write(tr)
156 if tr and tr.writepending():
156 if tr and tr.writepending():
157 env[b'HG_PENDING'] = repo.root
157 env[b'HG_PENDING'] = repo.root
158 env[b'HG_HOOKTYPE'] = htype
158 env[b'HG_HOOKTYPE'] = htype
159 env[b'HG_HOOKNAME'] = name
159 env[b'HG_HOOKNAME'] = name
160 env[b'HGPLAIN'] = b'1'
160 env[b'HGPLAIN'] = b'1'
161
161
162 for k, v in pycompat.iteritems(args):
162 for k, v in pycompat.iteritems(args):
163 # transaction changes can accumulate MBs of data, so skip it
163 # transaction changes can accumulate MBs of data, so skip it
164 # for external hooks
164 # for external hooks
165 if k == b'changes':
165 if k == b'changes':
166 continue
166 continue
167 if callable(v):
167 if callable(v):
168 v = v()
168 v = v()
169 if isinstance(v, (dict, list)):
169 if isinstance(v, (dict, list)):
170 v = stringutil.pprint(v)
170 v = stringutil.pprint(v)
171 env[b'HG_' + k.upper()] = v
171 env[b'HG_' + k.upper()] = v
172
172
173 if ui.configbool(b'hooks', b'tonative.%s' % name, False):
173 if ui.configbool(b'hooks', b'tonative.%s' % name, False):
174 oldcmd = cmd
174 oldcmd = cmd
175 cmd = procutil.shelltonative(cmd, env)
175 cmd = procutil.shelltonative(cmd, env)
176 if cmd != oldcmd:
176 if cmd != oldcmd:
177 ui.note(_(b'converting hook "%s" to native\n') % name)
177 ui.note(_(b'converting hook "%s" to native\n') % name)
178
178
179 ui.note(_(b"running hook %s: %s\n") % (name, cmd))
179 ui.note(_(b"running hook %s: %s\n") % (name, cmd))
180
180
181 if repo:
181 if repo:
182 cwd = repo.root
182 cwd = repo.root
183 else:
183 else:
184 cwd = encoding.getcwd()
184 cwd = encoding.getcwd()
185 r = ui.system(cmd, environ=env, cwd=cwd, blockedtag=b'exthook-%s' % (name,))
185 r = ui.system(cmd, environ=env, cwd=cwd, blockedtag=b'exthook-%s' % (name,))
186
186
187 duration = util.timer() - starttime
187 duration = util.timer() - starttime
188 ui.log(
188 ui.log(
189 b'exthook',
189 b'exthook',
190 b'exthook-%s: %s finished in %0.2f seconds\n',
190 b'exthook-%s: %s finished in %0.2f seconds\n',
191 name,
191 name,
192 cmd,
192 cmd,
193 duration,
193 duration,
194 )
194 )
195 if r:
195 if r:
196 desc = procutil.explainexit(r)
196 desc = procutil.explainexit(r)
197 if throw:
197 if throw:
198 raise error.HookAbort(_(b'%s hook %s') % (name, desc))
198 raise error.HookAbort(_(b'%s hook %s') % (name, desc))
199 ui.warn(_(b'warning: %s hook %s\n') % (name, desc))
199 ui.warn(_(b'warning: %s hook %s\n') % (name, desc))
200 return r
200 return r
201
201
202
202
203 # represent an untrusted hook command
203 # represent an untrusted hook command
204 _fromuntrusted = object()
204 _fromuntrusted = object()
205
205
206
206
207 def _allhooks(ui):
207 def _allhooks(ui):
208 """return a list of (hook-id, cmd) pairs sorted by priority"""
208 """return a list of (hook-id, cmd) pairs sorted by priority"""
209 hooks = _hookitems(ui)
209 hooks = _hookitems(ui)
210 # Be careful in this section, propagating the real commands from untrusted
210 # Be careful in this section, propagating the real commands from untrusted
211 # sources would create a security vulnerability, make sure anything altered
211 # sources would create a security vulnerability, make sure anything altered
212 # in that section uses "_fromuntrusted" as its command.
212 # in that section uses "_fromuntrusted" as its command.
213 untrustedhooks = _hookitems(ui, _untrusted=True)
213 untrustedhooks = _hookitems(ui, _untrusted=True)
214 for name, value in untrustedhooks.items():
214 for name, value in untrustedhooks.items():
215 trustedvalue = hooks.get(name, ((), (), name, _fromuntrusted))
215 trustedvalue = hooks.get(name, ((), (), name, _fromuntrusted))
216 if value != trustedvalue:
216 if value != trustedvalue:
217 (lp, lo, lk, lv) = trustedvalue
217 (lp, lo, lk, lv) = trustedvalue
218 hooks[name] = (lp, lo, lk, _fromuntrusted)
218 hooks[name] = (lp, lo, lk, _fromuntrusted)
219 # (end of the security sensitive section)
219 # (end of the security sensitive section)
220 return [(k, v) for p, o, k, v in sorted(hooks.values())]
220 return [(k, v) for p, o, k, v in sorted(hooks.values())]
221
221
222
222
223 def _hookitems(ui, _untrusted=False):
223 def _hookitems(ui, _untrusted=False):
224 """return all hooks items ready to be sorted"""
224 """return all hooks items ready to be sorted"""
225 hooks = {}
225 hooks = {}
226 for name, cmd in ui.configitems(b'hooks', untrusted=_untrusted):
226 for name, cmd in ui.configitems(b'hooks', untrusted=_untrusted):
227 if name.startswith(b'priority.') or name.startswith(b'tonative.'):
227 if (
228 name.startswith(b'priority.')
229 or name.startswith(b'tonative.')
230 or b':' in name
231 ):
228 continue
232 continue
229
233
230 priority = ui.configint(b'hooks', b'priority.%s' % name, 0)
234 priority = ui.configint(b'hooks', b'priority.%s' % name, 0)
231 hooks[name] = ((-priority,), (len(hooks),), name, cmd)
235 hooks[name] = ((-priority,), (len(hooks),), name, cmd)
232 return hooks
236 return hooks
233
237
234
238
235 _redirect = False
239 _redirect = False
236
240
237
241
238 def redirect(state):
242 def redirect(state):
239 global _redirect
243 global _redirect
240 _redirect = state
244 _redirect = state
241
245
242
246
243 def hashook(ui, htype):
247 def hashook(ui, htype):
244 """return True if a hook is configured for 'htype'"""
248 """return True if a hook is configured for 'htype'"""
245 if not ui.callhooks:
249 if not ui.callhooks:
246 return False
250 return False
247 for hname, cmd in _allhooks(ui):
251 for hname, cmd in _allhooks(ui):
248 if hname.split(b'.')[0] == htype and cmd:
252 if hname.split(b'.')[0] == htype and cmd:
249 return True
253 return True
250 return False
254 return False
251
255
252
256
253 def hook(ui, repo, htype, throw=False, **args):
257 def hook(ui, repo, htype, throw=False, **args):
254 if not ui.callhooks:
258 if not ui.callhooks:
255 return False
259 return False
256
260
257 hooks = []
261 hooks = []
258 for hname, cmd in _allhooks(ui):
262 for hname, cmd in _allhooks(ui):
259 if hname.split(b'.')[0] == htype and cmd:
263 if hname.split(b'.')[0] == htype and cmd:
260 hooks.append((hname, cmd))
264 hooks.append((hname, cmd))
261
265
262 res = runhooks(ui, repo, htype, hooks, throw=throw, **args)
266 res = runhooks(ui, repo, htype, hooks, throw=throw, **args)
263 r = False
267 r = False
264 for hname, cmd in hooks:
268 for hname, cmd in hooks:
265 r = res[hname][0] or r
269 r = res[hname][0] or r
266 return r
270 return r
267
271
268
272
269 @contextlib.contextmanager
273 @contextlib.contextmanager
270 def redirect_stdio():
274 def redirect_stdio():
271 """Redirects stdout to stderr, if possible."""
275 """Redirects stdout to stderr, if possible."""
272
276
273 oldstdout = -1
277 oldstdout = -1
274 try:
278 try:
275 if _redirect:
279 if _redirect:
276 try:
280 try:
277 stdoutno = procutil.stdout.fileno()
281 stdoutno = procutil.stdout.fileno()
278 stderrno = procutil.stderr.fileno()
282 stderrno = procutil.stderr.fileno()
279 # temporarily redirect stdout to stderr, if possible
283 # temporarily redirect stdout to stderr, if possible
280 if stdoutno >= 0 and stderrno >= 0:
284 if stdoutno >= 0 and stderrno >= 0:
281 procutil.stdout.flush()
285 procutil.stdout.flush()
282 oldstdout = os.dup(stdoutno)
286 oldstdout = os.dup(stdoutno)
283 os.dup2(stderrno, stdoutno)
287 os.dup2(stderrno, stdoutno)
284 except (OSError, AttributeError):
288 except (OSError, AttributeError):
285 # files seem to be bogus, give up on redirecting (WSGI, etc)
289 # files seem to be bogus, give up on redirecting (WSGI, etc)
286 pass
290 pass
287
291
288 yield
292 yield
289
293
290 finally:
294 finally:
291 # The stderr is fully buffered on Windows when connected to a pipe.
295 # The stderr is fully buffered on Windows when connected to a pipe.
292 # A forcible flush is required to make small stderr data in the
296 # A forcible flush is required to make small stderr data in the
293 # remote side available to the client immediately.
297 # remote side available to the client immediately.
294 try:
298 try:
295 procutil.stderr.flush()
299 procutil.stderr.flush()
296 except IOError as err:
300 except IOError as err:
297 if err.errno not in (errno.EPIPE, errno.EIO, errno.EBADF):
301 if err.errno not in (errno.EPIPE, errno.EIO, errno.EBADF):
298 raise error.StdioError(err)
302 raise error.StdioError(err)
299
303
300 if _redirect and oldstdout >= 0:
304 if _redirect and oldstdout >= 0:
301 try:
305 try:
302 procutil.stdout.flush() # write hook output to stderr fd
306 procutil.stdout.flush() # write hook output to stderr fd
303 except IOError as err:
307 except IOError as err:
304 if err.errno not in (errno.EPIPE, errno.EIO, errno.EBADF):
308 if err.errno not in (errno.EPIPE, errno.EIO, errno.EBADF):
305 raise error.StdioError(err)
309 raise error.StdioError(err)
306 os.dup2(oldstdout, stdoutno)
310 os.dup2(oldstdout, stdoutno)
307 os.close(oldstdout)
311 os.close(oldstdout)
308
312
309
313
310 def runhooks(ui, repo, htype, hooks, throw=False, **args):
314 def runhooks(ui, repo, htype, hooks, throw=False, **args):
311 args = pycompat.byteskwargs(args)
315 args = pycompat.byteskwargs(args)
312 res = {}
316 res = {}
313
317
314 with redirect_stdio():
318 with redirect_stdio():
315 for hname, cmd in hooks:
319 for hname, cmd in hooks:
316 if cmd is _fromuntrusted:
320 if cmd is _fromuntrusted:
317 if throw:
321 if throw:
318 raise error.HookAbort(
322 raise error.HookAbort(
319 _(b'untrusted hook %s not executed') % hname,
323 _(b'untrusted hook %s not executed') % hname,
320 hint=_(b"see 'hg help config.trusted'"),
324 hint=_(b"see 'hg help config.trusted'"),
321 )
325 )
322 ui.warn(_(b'warning: untrusted hook %s not executed\n') % hname)
326 ui.warn(_(b'warning: untrusted hook %s not executed\n') % hname)
323 r = 1
327 r = 1
324 raised = False
328 raised = False
325 elif callable(cmd):
329 elif callable(cmd):
326 r, raised = pythonhook(ui, repo, htype, hname, cmd, args, throw)
330 r, raised = pythonhook(ui, repo, htype, hname, cmd, args, throw)
327 elif cmd.startswith(b'python:'):
331 elif cmd.startswith(b'python:'):
328 if cmd.count(b':') >= 2:
332 if cmd.count(b':') >= 2:
329 path, cmd = cmd[7:].rsplit(b':', 1)
333 path, cmd = cmd[7:].rsplit(b':', 1)
330 path = util.expandpath(path)
334 path = util.expandpath(path)
331 if repo:
335 if repo:
332 path = os.path.join(repo.root, path)
336 path = os.path.join(repo.root, path)
333 try:
337 try:
334 mod = extensions.loadpath(path, b'hghook.%s' % hname)
338 mod = extensions.loadpath(path, b'hghook.%s' % hname)
335 except Exception:
339 except Exception:
336 ui.write(_(b"loading %s hook failed:\n") % hname)
340 ui.write(_(b"loading %s hook failed:\n") % hname)
337 raise
341 raise
338 hookfn = getattr(mod, cmd)
342 hookfn = getattr(mod, cmd)
339 else:
343 else:
340 hookfn = cmd[7:].strip()
344 hookfn = cmd[7:].strip()
341 r, raised = pythonhook(
345 r, raised = pythonhook(
342 ui, repo, htype, hname, hookfn, args, throw
346 ui, repo, htype, hname, hookfn, args, throw
343 )
347 )
344 else:
348 else:
345 r = _exthook(ui, repo, htype, hname, cmd, args, throw)
349 r = _exthook(ui, repo, htype, hname, cmd, args, throw)
346 raised = False
350 raised = False
347
351
348 res[hname] = r, raised
352 res[hname] = r, raised
349
353
350 return res
354 return res
General Comments 0
You need to be logged in to leave comments. Login now