##// END OF EJS Templates
rank: actually persist revision's rank in changelog-v2...
marmoute -
r49331:c5d6c874 default
parent child Browse files
Show More
@@ -1,2737 +1,2737 b''
1 # configitems.py - centralized declaration of configuration option
1 # configitems.py - centralized declaration of configuration option
2 #
2 #
3 # Copyright 2017 Pierre-Yves David <pierre-yves.david@octobus.net>
3 # Copyright 2017 Pierre-Yves David <pierre-yves.david@octobus.net>
4 #
4 #
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 from __future__ import absolute_import
8 from __future__ import absolute_import
9
9
10 import functools
10 import functools
11 import re
11 import re
12
12
13 from . import (
13 from . import (
14 encoding,
14 encoding,
15 error,
15 error,
16 )
16 )
17
17
18
18
19 def loadconfigtable(ui, extname, configtable):
19 def loadconfigtable(ui, extname, configtable):
20 """update config item known to the ui with the extension ones"""
20 """update config item known to the ui with the extension ones"""
21 for section, items in sorted(configtable.items()):
21 for section, items in sorted(configtable.items()):
22 knownitems = ui._knownconfig.setdefault(section, itemregister())
22 knownitems = ui._knownconfig.setdefault(section, itemregister())
23 knownkeys = set(knownitems)
23 knownkeys = set(knownitems)
24 newkeys = set(items)
24 newkeys = set(items)
25 for key in sorted(knownkeys & newkeys):
25 for key in sorted(knownkeys & newkeys):
26 msg = b"extension '%s' overwrite config item '%s.%s'"
26 msg = b"extension '%s' overwrite config item '%s.%s'"
27 msg %= (extname, section, key)
27 msg %= (extname, section, key)
28 ui.develwarn(msg, config=b'warn-config')
28 ui.develwarn(msg, config=b'warn-config')
29
29
30 knownitems.update(items)
30 knownitems.update(items)
31
31
32
32
33 class configitem(object):
33 class configitem(object):
34 """represent a known config item
34 """represent a known config item
35
35
36 :section: the official config section where to find this item,
36 :section: the official config section where to find this item,
37 :name: the official name within the section,
37 :name: the official name within the section,
38 :default: default value for this item,
38 :default: default value for this item,
39 :alias: optional list of tuples as alternatives,
39 :alias: optional list of tuples as alternatives,
40 :generic: this is a generic definition, match name using regular expression.
40 :generic: this is a generic definition, match name using regular expression.
41 """
41 """
42
42
43 def __init__(
43 def __init__(
44 self,
44 self,
45 section,
45 section,
46 name,
46 name,
47 default=None,
47 default=None,
48 alias=(),
48 alias=(),
49 generic=False,
49 generic=False,
50 priority=0,
50 priority=0,
51 experimental=False,
51 experimental=False,
52 ):
52 ):
53 self.section = section
53 self.section = section
54 self.name = name
54 self.name = name
55 self.default = default
55 self.default = default
56 self.alias = list(alias)
56 self.alias = list(alias)
57 self.generic = generic
57 self.generic = generic
58 self.priority = priority
58 self.priority = priority
59 self.experimental = experimental
59 self.experimental = experimental
60 self._re = None
60 self._re = None
61 if generic:
61 if generic:
62 self._re = re.compile(self.name)
62 self._re = re.compile(self.name)
63
63
64
64
65 class itemregister(dict):
65 class itemregister(dict):
66 """A specialized dictionary that can handle wild-card selection"""
66 """A specialized dictionary that can handle wild-card selection"""
67
67
68 def __init__(self):
68 def __init__(self):
69 super(itemregister, self).__init__()
69 super(itemregister, self).__init__()
70 self._generics = set()
70 self._generics = set()
71
71
72 def update(self, other):
72 def update(self, other):
73 super(itemregister, self).update(other)
73 super(itemregister, self).update(other)
74 self._generics.update(other._generics)
74 self._generics.update(other._generics)
75
75
76 def __setitem__(self, key, item):
76 def __setitem__(self, key, item):
77 super(itemregister, self).__setitem__(key, item)
77 super(itemregister, self).__setitem__(key, item)
78 if item.generic:
78 if item.generic:
79 self._generics.add(item)
79 self._generics.add(item)
80
80
81 def get(self, key):
81 def get(self, key):
82 baseitem = super(itemregister, self).get(key)
82 baseitem = super(itemregister, self).get(key)
83 if baseitem is not None and not baseitem.generic:
83 if baseitem is not None and not baseitem.generic:
84 return baseitem
84 return baseitem
85
85
86 # search for a matching generic item
86 # search for a matching generic item
87 generics = sorted(self._generics, key=(lambda x: (x.priority, x.name)))
87 generics = sorted(self._generics, key=(lambda x: (x.priority, x.name)))
88 for item in generics:
88 for item in generics:
89 # we use 'match' instead of 'search' to make the matching simpler
89 # we use 'match' instead of 'search' to make the matching simpler
90 # for people unfamiliar with regular expression. Having the match
90 # for people unfamiliar with regular expression. Having the match
91 # rooted to the start of the string will produce less surprising
91 # rooted to the start of the string will produce less surprising
92 # result for user writing simple regex for sub-attribute.
92 # result for user writing simple regex for sub-attribute.
93 #
93 #
94 # For example using "color\..*" match produces an unsurprising
94 # For example using "color\..*" match produces an unsurprising
95 # result, while using search could suddenly match apparently
95 # result, while using search could suddenly match apparently
96 # unrelated configuration that happens to contains "color."
96 # unrelated configuration that happens to contains "color."
97 # anywhere. This is a tradeoff where we favor requiring ".*" on
97 # anywhere. This is a tradeoff where we favor requiring ".*" on
98 # some match to avoid the need to prefix most pattern with "^".
98 # some match to avoid the need to prefix most pattern with "^".
99 # The "^" seems more error prone.
99 # The "^" seems more error prone.
100 if item._re.match(key):
100 if item._re.match(key):
101 return item
101 return item
102
102
103 return None
103 return None
104
104
105
105
106 coreitems = {}
106 coreitems = {}
107
107
108
108
109 def _register(configtable, *args, **kwargs):
109 def _register(configtable, *args, **kwargs):
110 item = configitem(*args, **kwargs)
110 item = configitem(*args, **kwargs)
111 section = configtable.setdefault(item.section, itemregister())
111 section = configtable.setdefault(item.section, itemregister())
112 if item.name in section:
112 if item.name in section:
113 msg = b"duplicated config item registration for '%s.%s'"
113 msg = b"duplicated config item registration for '%s.%s'"
114 raise error.ProgrammingError(msg % (item.section, item.name))
114 raise error.ProgrammingError(msg % (item.section, item.name))
115 section[item.name] = item
115 section[item.name] = item
116
116
117
117
118 # special value for case where the default is derived from other values
118 # special value for case where the default is derived from other values
119 dynamicdefault = object()
119 dynamicdefault = object()
120
120
121 # Registering actual config items
121 # Registering actual config items
122
122
123
123
124 def getitemregister(configtable):
124 def getitemregister(configtable):
125 f = functools.partial(_register, configtable)
125 f = functools.partial(_register, configtable)
126 # export pseudo enum as configitem.*
126 # export pseudo enum as configitem.*
127 f.dynamicdefault = dynamicdefault
127 f.dynamicdefault = dynamicdefault
128 return f
128 return f
129
129
130
130
131 coreconfigitem = getitemregister(coreitems)
131 coreconfigitem = getitemregister(coreitems)
132
132
133
133
134 def _registerdiffopts(section, configprefix=b''):
134 def _registerdiffopts(section, configprefix=b''):
135 coreconfigitem(
135 coreconfigitem(
136 section,
136 section,
137 configprefix + b'nodates',
137 configprefix + b'nodates',
138 default=False,
138 default=False,
139 )
139 )
140 coreconfigitem(
140 coreconfigitem(
141 section,
141 section,
142 configprefix + b'showfunc',
142 configprefix + b'showfunc',
143 default=False,
143 default=False,
144 )
144 )
145 coreconfigitem(
145 coreconfigitem(
146 section,
146 section,
147 configprefix + b'unified',
147 configprefix + b'unified',
148 default=None,
148 default=None,
149 )
149 )
150 coreconfigitem(
150 coreconfigitem(
151 section,
151 section,
152 configprefix + b'git',
152 configprefix + b'git',
153 default=False,
153 default=False,
154 )
154 )
155 coreconfigitem(
155 coreconfigitem(
156 section,
156 section,
157 configprefix + b'ignorews',
157 configprefix + b'ignorews',
158 default=False,
158 default=False,
159 )
159 )
160 coreconfigitem(
160 coreconfigitem(
161 section,
161 section,
162 configprefix + b'ignorewsamount',
162 configprefix + b'ignorewsamount',
163 default=False,
163 default=False,
164 )
164 )
165 coreconfigitem(
165 coreconfigitem(
166 section,
166 section,
167 configprefix + b'ignoreblanklines',
167 configprefix + b'ignoreblanklines',
168 default=False,
168 default=False,
169 )
169 )
170 coreconfigitem(
170 coreconfigitem(
171 section,
171 section,
172 configprefix + b'ignorewseol',
172 configprefix + b'ignorewseol',
173 default=False,
173 default=False,
174 )
174 )
175 coreconfigitem(
175 coreconfigitem(
176 section,
176 section,
177 configprefix + b'nobinary',
177 configprefix + b'nobinary',
178 default=False,
178 default=False,
179 )
179 )
180 coreconfigitem(
180 coreconfigitem(
181 section,
181 section,
182 configprefix + b'noprefix',
182 configprefix + b'noprefix',
183 default=False,
183 default=False,
184 )
184 )
185 coreconfigitem(
185 coreconfigitem(
186 section,
186 section,
187 configprefix + b'word-diff',
187 configprefix + b'word-diff',
188 default=False,
188 default=False,
189 )
189 )
190
190
191
191
192 coreconfigitem(
192 coreconfigitem(
193 b'alias',
193 b'alias',
194 b'.*',
194 b'.*',
195 default=dynamicdefault,
195 default=dynamicdefault,
196 generic=True,
196 generic=True,
197 )
197 )
198 coreconfigitem(
198 coreconfigitem(
199 b'auth',
199 b'auth',
200 b'cookiefile',
200 b'cookiefile',
201 default=None,
201 default=None,
202 )
202 )
203 _registerdiffopts(section=b'annotate')
203 _registerdiffopts(section=b'annotate')
204 # bookmarks.pushing: internal hack for discovery
204 # bookmarks.pushing: internal hack for discovery
205 coreconfigitem(
205 coreconfigitem(
206 b'bookmarks',
206 b'bookmarks',
207 b'pushing',
207 b'pushing',
208 default=list,
208 default=list,
209 )
209 )
210 # bundle.mainreporoot: internal hack for bundlerepo
210 # bundle.mainreporoot: internal hack for bundlerepo
211 coreconfigitem(
211 coreconfigitem(
212 b'bundle',
212 b'bundle',
213 b'mainreporoot',
213 b'mainreporoot',
214 default=b'',
214 default=b'',
215 )
215 )
216 coreconfigitem(
216 coreconfigitem(
217 b'censor',
217 b'censor',
218 b'policy',
218 b'policy',
219 default=b'abort',
219 default=b'abort',
220 experimental=True,
220 experimental=True,
221 )
221 )
222 coreconfigitem(
222 coreconfigitem(
223 b'chgserver',
223 b'chgserver',
224 b'idletimeout',
224 b'idletimeout',
225 default=3600,
225 default=3600,
226 )
226 )
227 coreconfigitem(
227 coreconfigitem(
228 b'chgserver',
228 b'chgserver',
229 b'skiphash',
229 b'skiphash',
230 default=False,
230 default=False,
231 )
231 )
232 coreconfigitem(
232 coreconfigitem(
233 b'cmdserver',
233 b'cmdserver',
234 b'log',
234 b'log',
235 default=None,
235 default=None,
236 )
236 )
237 coreconfigitem(
237 coreconfigitem(
238 b'cmdserver',
238 b'cmdserver',
239 b'max-log-files',
239 b'max-log-files',
240 default=7,
240 default=7,
241 )
241 )
242 coreconfigitem(
242 coreconfigitem(
243 b'cmdserver',
243 b'cmdserver',
244 b'max-log-size',
244 b'max-log-size',
245 default=b'1 MB',
245 default=b'1 MB',
246 )
246 )
247 coreconfigitem(
247 coreconfigitem(
248 b'cmdserver',
248 b'cmdserver',
249 b'max-repo-cache',
249 b'max-repo-cache',
250 default=0,
250 default=0,
251 experimental=True,
251 experimental=True,
252 )
252 )
253 coreconfigitem(
253 coreconfigitem(
254 b'cmdserver',
254 b'cmdserver',
255 b'message-encodings',
255 b'message-encodings',
256 default=list,
256 default=list,
257 )
257 )
258 coreconfigitem(
258 coreconfigitem(
259 b'cmdserver',
259 b'cmdserver',
260 b'track-log',
260 b'track-log',
261 default=lambda: [b'chgserver', b'cmdserver', b'repocache'],
261 default=lambda: [b'chgserver', b'cmdserver', b'repocache'],
262 )
262 )
263 coreconfigitem(
263 coreconfigitem(
264 b'cmdserver',
264 b'cmdserver',
265 b'shutdown-on-interrupt',
265 b'shutdown-on-interrupt',
266 default=True,
266 default=True,
267 )
267 )
268 coreconfigitem(
268 coreconfigitem(
269 b'color',
269 b'color',
270 b'.*',
270 b'.*',
271 default=None,
271 default=None,
272 generic=True,
272 generic=True,
273 )
273 )
274 coreconfigitem(
274 coreconfigitem(
275 b'color',
275 b'color',
276 b'mode',
276 b'mode',
277 default=b'auto',
277 default=b'auto',
278 )
278 )
279 coreconfigitem(
279 coreconfigitem(
280 b'color',
280 b'color',
281 b'pagermode',
281 b'pagermode',
282 default=dynamicdefault,
282 default=dynamicdefault,
283 )
283 )
284 coreconfigitem(
284 coreconfigitem(
285 b'command-templates',
285 b'command-templates',
286 b'graphnode',
286 b'graphnode',
287 default=None,
287 default=None,
288 alias=[(b'ui', b'graphnodetemplate')],
288 alias=[(b'ui', b'graphnodetemplate')],
289 )
289 )
290 coreconfigitem(
290 coreconfigitem(
291 b'command-templates',
291 b'command-templates',
292 b'log',
292 b'log',
293 default=None,
293 default=None,
294 alias=[(b'ui', b'logtemplate')],
294 alias=[(b'ui', b'logtemplate')],
295 )
295 )
296 coreconfigitem(
296 coreconfigitem(
297 b'command-templates',
297 b'command-templates',
298 b'mergemarker',
298 b'mergemarker',
299 default=(
299 default=(
300 b'{node|short} '
300 b'{node|short} '
301 b'{ifeq(tags, "tip", "", '
301 b'{ifeq(tags, "tip", "", '
302 b'ifeq(tags, "", "", "{tags} "))}'
302 b'ifeq(tags, "", "", "{tags} "))}'
303 b'{if(bookmarks, "{bookmarks} ")}'
303 b'{if(bookmarks, "{bookmarks} ")}'
304 b'{ifeq(branch, "default", "", "{branch} ")}'
304 b'{ifeq(branch, "default", "", "{branch} ")}'
305 b'- {author|user}: {desc|firstline}'
305 b'- {author|user}: {desc|firstline}'
306 ),
306 ),
307 alias=[(b'ui', b'mergemarkertemplate')],
307 alias=[(b'ui', b'mergemarkertemplate')],
308 )
308 )
309 coreconfigitem(
309 coreconfigitem(
310 b'command-templates',
310 b'command-templates',
311 b'pre-merge-tool-output',
311 b'pre-merge-tool-output',
312 default=None,
312 default=None,
313 alias=[(b'ui', b'pre-merge-tool-output-template')],
313 alias=[(b'ui', b'pre-merge-tool-output-template')],
314 )
314 )
315 coreconfigitem(
315 coreconfigitem(
316 b'command-templates',
316 b'command-templates',
317 b'oneline-summary',
317 b'oneline-summary',
318 default=None,
318 default=None,
319 )
319 )
320 coreconfigitem(
320 coreconfigitem(
321 b'command-templates',
321 b'command-templates',
322 b'oneline-summary.*',
322 b'oneline-summary.*',
323 default=dynamicdefault,
323 default=dynamicdefault,
324 generic=True,
324 generic=True,
325 )
325 )
326 _registerdiffopts(section=b'commands', configprefix=b'commit.interactive.')
326 _registerdiffopts(section=b'commands', configprefix=b'commit.interactive.')
327 coreconfigitem(
327 coreconfigitem(
328 b'commands',
328 b'commands',
329 b'commit.post-status',
329 b'commit.post-status',
330 default=False,
330 default=False,
331 )
331 )
332 coreconfigitem(
332 coreconfigitem(
333 b'commands',
333 b'commands',
334 b'grep.all-files',
334 b'grep.all-files',
335 default=False,
335 default=False,
336 experimental=True,
336 experimental=True,
337 )
337 )
338 coreconfigitem(
338 coreconfigitem(
339 b'commands',
339 b'commands',
340 b'merge.require-rev',
340 b'merge.require-rev',
341 default=False,
341 default=False,
342 )
342 )
343 coreconfigitem(
343 coreconfigitem(
344 b'commands',
344 b'commands',
345 b'push.require-revs',
345 b'push.require-revs',
346 default=False,
346 default=False,
347 )
347 )
348 coreconfigitem(
348 coreconfigitem(
349 b'commands',
349 b'commands',
350 b'resolve.confirm',
350 b'resolve.confirm',
351 default=False,
351 default=False,
352 )
352 )
353 coreconfigitem(
353 coreconfigitem(
354 b'commands',
354 b'commands',
355 b'resolve.explicit-re-merge',
355 b'resolve.explicit-re-merge',
356 default=False,
356 default=False,
357 )
357 )
358 coreconfigitem(
358 coreconfigitem(
359 b'commands',
359 b'commands',
360 b'resolve.mark-check',
360 b'resolve.mark-check',
361 default=b'none',
361 default=b'none',
362 )
362 )
363 _registerdiffopts(section=b'commands', configprefix=b'revert.interactive.')
363 _registerdiffopts(section=b'commands', configprefix=b'revert.interactive.')
364 coreconfigitem(
364 coreconfigitem(
365 b'commands',
365 b'commands',
366 b'show.aliasprefix',
366 b'show.aliasprefix',
367 default=list,
367 default=list,
368 )
368 )
369 coreconfigitem(
369 coreconfigitem(
370 b'commands',
370 b'commands',
371 b'status.relative',
371 b'status.relative',
372 default=False,
372 default=False,
373 )
373 )
374 coreconfigitem(
374 coreconfigitem(
375 b'commands',
375 b'commands',
376 b'status.skipstates',
376 b'status.skipstates',
377 default=[],
377 default=[],
378 experimental=True,
378 experimental=True,
379 )
379 )
380 coreconfigitem(
380 coreconfigitem(
381 b'commands',
381 b'commands',
382 b'status.terse',
382 b'status.terse',
383 default=b'',
383 default=b'',
384 )
384 )
385 coreconfigitem(
385 coreconfigitem(
386 b'commands',
386 b'commands',
387 b'status.verbose',
387 b'status.verbose',
388 default=False,
388 default=False,
389 )
389 )
390 coreconfigitem(
390 coreconfigitem(
391 b'commands',
391 b'commands',
392 b'update.check',
392 b'update.check',
393 default=None,
393 default=None,
394 )
394 )
395 coreconfigitem(
395 coreconfigitem(
396 b'commands',
396 b'commands',
397 b'update.requiredest',
397 b'update.requiredest',
398 default=False,
398 default=False,
399 )
399 )
400 coreconfigitem(
400 coreconfigitem(
401 b'committemplate',
401 b'committemplate',
402 b'.*',
402 b'.*',
403 default=None,
403 default=None,
404 generic=True,
404 generic=True,
405 )
405 )
406 coreconfigitem(
406 coreconfigitem(
407 b'convert',
407 b'convert',
408 b'bzr.saverev',
408 b'bzr.saverev',
409 default=True,
409 default=True,
410 )
410 )
411 coreconfigitem(
411 coreconfigitem(
412 b'convert',
412 b'convert',
413 b'cvsps.cache',
413 b'cvsps.cache',
414 default=True,
414 default=True,
415 )
415 )
416 coreconfigitem(
416 coreconfigitem(
417 b'convert',
417 b'convert',
418 b'cvsps.fuzz',
418 b'cvsps.fuzz',
419 default=60,
419 default=60,
420 )
420 )
421 coreconfigitem(
421 coreconfigitem(
422 b'convert',
422 b'convert',
423 b'cvsps.logencoding',
423 b'cvsps.logencoding',
424 default=None,
424 default=None,
425 )
425 )
426 coreconfigitem(
426 coreconfigitem(
427 b'convert',
427 b'convert',
428 b'cvsps.mergefrom',
428 b'cvsps.mergefrom',
429 default=None,
429 default=None,
430 )
430 )
431 coreconfigitem(
431 coreconfigitem(
432 b'convert',
432 b'convert',
433 b'cvsps.mergeto',
433 b'cvsps.mergeto',
434 default=None,
434 default=None,
435 )
435 )
436 coreconfigitem(
436 coreconfigitem(
437 b'convert',
437 b'convert',
438 b'git.committeractions',
438 b'git.committeractions',
439 default=lambda: [b'messagedifferent'],
439 default=lambda: [b'messagedifferent'],
440 )
440 )
441 coreconfigitem(
441 coreconfigitem(
442 b'convert',
442 b'convert',
443 b'git.extrakeys',
443 b'git.extrakeys',
444 default=list,
444 default=list,
445 )
445 )
446 coreconfigitem(
446 coreconfigitem(
447 b'convert',
447 b'convert',
448 b'git.findcopiesharder',
448 b'git.findcopiesharder',
449 default=False,
449 default=False,
450 )
450 )
451 coreconfigitem(
451 coreconfigitem(
452 b'convert',
452 b'convert',
453 b'git.remoteprefix',
453 b'git.remoteprefix',
454 default=b'remote',
454 default=b'remote',
455 )
455 )
456 coreconfigitem(
456 coreconfigitem(
457 b'convert',
457 b'convert',
458 b'git.renamelimit',
458 b'git.renamelimit',
459 default=400,
459 default=400,
460 )
460 )
461 coreconfigitem(
461 coreconfigitem(
462 b'convert',
462 b'convert',
463 b'git.saverev',
463 b'git.saverev',
464 default=True,
464 default=True,
465 )
465 )
466 coreconfigitem(
466 coreconfigitem(
467 b'convert',
467 b'convert',
468 b'git.similarity',
468 b'git.similarity',
469 default=50,
469 default=50,
470 )
470 )
471 coreconfigitem(
471 coreconfigitem(
472 b'convert',
472 b'convert',
473 b'git.skipsubmodules',
473 b'git.skipsubmodules',
474 default=False,
474 default=False,
475 )
475 )
476 coreconfigitem(
476 coreconfigitem(
477 b'convert',
477 b'convert',
478 b'hg.clonebranches',
478 b'hg.clonebranches',
479 default=False,
479 default=False,
480 )
480 )
481 coreconfigitem(
481 coreconfigitem(
482 b'convert',
482 b'convert',
483 b'hg.ignoreerrors',
483 b'hg.ignoreerrors',
484 default=False,
484 default=False,
485 )
485 )
486 coreconfigitem(
486 coreconfigitem(
487 b'convert',
487 b'convert',
488 b'hg.preserve-hash',
488 b'hg.preserve-hash',
489 default=False,
489 default=False,
490 )
490 )
491 coreconfigitem(
491 coreconfigitem(
492 b'convert',
492 b'convert',
493 b'hg.revs',
493 b'hg.revs',
494 default=None,
494 default=None,
495 )
495 )
496 coreconfigitem(
496 coreconfigitem(
497 b'convert',
497 b'convert',
498 b'hg.saverev',
498 b'hg.saverev',
499 default=False,
499 default=False,
500 )
500 )
501 coreconfigitem(
501 coreconfigitem(
502 b'convert',
502 b'convert',
503 b'hg.sourcename',
503 b'hg.sourcename',
504 default=None,
504 default=None,
505 )
505 )
506 coreconfigitem(
506 coreconfigitem(
507 b'convert',
507 b'convert',
508 b'hg.startrev',
508 b'hg.startrev',
509 default=None,
509 default=None,
510 )
510 )
511 coreconfigitem(
511 coreconfigitem(
512 b'convert',
512 b'convert',
513 b'hg.tagsbranch',
513 b'hg.tagsbranch',
514 default=b'default',
514 default=b'default',
515 )
515 )
516 coreconfigitem(
516 coreconfigitem(
517 b'convert',
517 b'convert',
518 b'hg.usebranchnames',
518 b'hg.usebranchnames',
519 default=True,
519 default=True,
520 )
520 )
521 coreconfigitem(
521 coreconfigitem(
522 b'convert',
522 b'convert',
523 b'ignoreancestorcheck',
523 b'ignoreancestorcheck',
524 default=False,
524 default=False,
525 experimental=True,
525 experimental=True,
526 )
526 )
527 coreconfigitem(
527 coreconfigitem(
528 b'convert',
528 b'convert',
529 b'localtimezone',
529 b'localtimezone',
530 default=False,
530 default=False,
531 )
531 )
532 coreconfigitem(
532 coreconfigitem(
533 b'convert',
533 b'convert',
534 b'p4.encoding',
534 b'p4.encoding',
535 default=dynamicdefault,
535 default=dynamicdefault,
536 )
536 )
537 coreconfigitem(
537 coreconfigitem(
538 b'convert',
538 b'convert',
539 b'p4.startrev',
539 b'p4.startrev',
540 default=0,
540 default=0,
541 )
541 )
542 coreconfigitem(
542 coreconfigitem(
543 b'convert',
543 b'convert',
544 b'skiptags',
544 b'skiptags',
545 default=False,
545 default=False,
546 )
546 )
547 coreconfigitem(
547 coreconfigitem(
548 b'convert',
548 b'convert',
549 b'svn.debugsvnlog',
549 b'svn.debugsvnlog',
550 default=True,
550 default=True,
551 )
551 )
552 coreconfigitem(
552 coreconfigitem(
553 b'convert',
553 b'convert',
554 b'svn.trunk',
554 b'svn.trunk',
555 default=None,
555 default=None,
556 )
556 )
557 coreconfigitem(
557 coreconfigitem(
558 b'convert',
558 b'convert',
559 b'svn.tags',
559 b'svn.tags',
560 default=None,
560 default=None,
561 )
561 )
562 coreconfigitem(
562 coreconfigitem(
563 b'convert',
563 b'convert',
564 b'svn.branches',
564 b'svn.branches',
565 default=None,
565 default=None,
566 )
566 )
567 coreconfigitem(
567 coreconfigitem(
568 b'convert',
568 b'convert',
569 b'svn.startrev',
569 b'svn.startrev',
570 default=0,
570 default=0,
571 )
571 )
572 coreconfigitem(
572 coreconfigitem(
573 b'convert',
573 b'convert',
574 b'svn.dangerous-set-commit-dates',
574 b'svn.dangerous-set-commit-dates',
575 default=False,
575 default=False,
576 )
576 )
577 coreconfigitem(
577 coreconfigitem(
578 b'debug',
578 b'debug',
579 b'dirstate.delaywrite',
579 b'dirstate.delaywrite',
580 default=0,
580 default=0,
581 )
581 )
582 coreconfigitem(
582 coreconfigitem(
583 b'debug',
583 b'debug',
584 b'revlog.verifyposition.changelog',
584 b'revlog.verifyposition.changelog',
585 default=b'',
585 default=b'',
586 )
586 )
587 coreconfigitem(
587 coreconfigitem(
588 b'defaults',
588 b'defaults',
589 b'.*',
589 b'.*',
590 default=None,
590 default=None,
591 generic=True,
591 generic=True,
592 )
592 )
593 coreconfigitem(
593 coreconfigitem(
594 b'devel',
594 b'devel',
595 b'all-warnings',
595 b'all-warnings',
596 default=False,
596 default=False,
597 )
597 )
598 coreconfigitem(
598 coreconfigitem(
599 b'devel',
599 b'devel',
600 b'bundle2.debug',
600 b'bundle2.debug',
601 default=False,
601 default=False,
602 )
602 )
603 coreconfigitem(
603 coreconfigitem(
604 b'devel',
604 b'devel',
605 b'bundle.delta',
605 b'bundle.delta',
606 default=b'',
606 default=b'',
607 )
607 )
608 coreconfigitem(
608 coreconfigitem(
609 b'devel',
609 b'devel',
610 b'cache-vfs',
610 b'cache-vfs',
611 default=None,
611 default=None,
612 )
612 )
613 coreconfigitem(
613 coreconfigitem(
614 b'devel',
614 b'devel',
615 b'check-locks',
615 b'check-locks',
616 default=False,
616 default=False,
617 )
617 )
618 coreconfigitem(
618 coreconfigitem(
619 b'devel',
619 b'devel',
620 b'check-relroot',
620 b'check-relroot',
621 default=False,
621 default=False,
622 )
622 )
623 # Track copy information for all file, not just "added" one (very slow)
623 # Track copy information for all file, not just "added" one (very slow)
624 coreconfigitem(
624 coreconfigitem(
625 b'devel',
625 b'devel',
626 b'copy-tracing.trace-all-files',
626 b'copy-tracing.trace-all-files',
627 default=False,
627 default=False,
628 )
628 )
629 coreconfigitem(
629 coreconfigitem(
630 b'devel',
630 b'devel',
631 b'default-date',
631 b'default-date',
632 default=None,
632 default=None,
633 )
633 )
634 coreconfigitem(
634 coreconfigitem(
635 b'devel',
635 b'devel',
636 b'deprec-warn',
636 b'deprec-warn',
637 default=False,
637 default=False,
638 )
638 )
639 coreconfigitem(
639 coreconfigitem(
640 b'devel',
640 b'devel',
641 b'disableloaddefaultcerts',
641 b'disableloaddefaultcerts',
642 default=False,
642 default=False,
643 )
643 )
644 coreconfigitem(
644 coreconfigitem(
645 b'devel',
645 b'devel',
646 b'warn-empty-changegroup',
646 b'warn-empty-changegroup',
647 default=False,
647 default=False,
648 )
648 )
649 coreconfigitem(
649 coreconfigitem(
650 b'devel',
650 b'devel',
651 b'legacy.exchange',
651 b'legacy.exchange',
652 default=list,
652 default=list,
653 )
653 )
654 # When True, revlogs use a special reference version of the nodemap, that is not
654 # When True, revlogs use a special reference version of the nodemap, that is not
655 # performant but is "known" to behave properly.
655 # performant but is "known" to behave properly.
656 coreconfigitem(
656 coreconfigitem(
657 b'devel',
657 b'devel',
658 b'persistent-nodemap',
658 b'persistent-nodemap',
659 default=False,
659 default=False,
660 )
660 )
661 coreconfigitem(
661 coreconfigitem(
662 b'devel',
662 b'devel',
663 b'servercafile',
663 b'servercafile',
664 default=b'',
664 default=b'',
665 )
665 )
666 coreconfigitem(
666 coreconfigitem(
667 b'devel',
667 b'devel',
668 b'serverexactprotocol',
668 b'serverexactprotocol',
669 default=b'',
669 default=b'',
670 )
670 )
671 coreconfigitem(
671 coreconfigitem(
672 b'devel',
672 b'devel',
673 b'serverrequirecert',
673 b'serverrequirecert',
674 default=False,
674 default=False,
675 )
675 )
676 coreconfigitem(
676 coreconfigitem(
677 b'devel',
677 b'devel',
678 b'strip-obsmarkers',
678 b'strip-obsmarkers',
679 default=True,
679 default=True,
680 )
680 )
681 coreconfigitem(
681 coreconfigitem(
682 b'devel',
682 b'devel',
683 b'warn-config',
683 b'warn-config',
684 default=None,
684 default=None,
685 )
685 )
686 coreconfigitem(
686 coreconfigitem(
687 b'devel',
687 b'devel',
688 b'warn-config-default',
688 b'warn-config-default',
689 default=None,
689 default=None,
690 )
690 )
691 coreconfigitem(
691 coreconfigitem(
692 b'devel',
692 b'devel',
693 b'user.obsmarker',
693 b'user.obsmarker',
694 default=None,
694 default=None,
695 )
695 )
696 coreconfigitem(
696 coreconfigitem(
697 b'devel',
697 b'devel',
698 b'warn-config-unknown',
698 b'warn-config-unknown',
699 default=None,
699 default=None,
700 )
700 )
701 coreconfigitem(
701 coreconfigitem(
702 b'devel',
702 b'devel',
703 b'debug.copies',
703 b'debug.copies',
704 default=False,
704 default=False,
705 )
705 )
706 coreconfigitem(
706 coreconfigitem(
707 b'devel',
707 b'devel',
708 b'copy-tracing.multi-thread',
708 b'copy-tracing.multi-thread',
709 default=True,
709 default=True,
710 )
710 )
711 coreconfigitem(
711 coreconfigitem(
712 b'devel',
712 b'devel',
713 b'debug.extensions',
713 b'debug.extensions',
714 default=False,
714 default=False,
715 )
715 )
716 coreconfigitem(
716 coreconfigitem(
717 b'devel',
717 b'devel',
718 b'debug.repo-filters',
718 b'debug.repo-filters',
719 default=False,
719 default=False,
720 )
720 )
721 coreconfigitem(
721 coreconfigitem(
722 b'devel',
722 b'devel',
723 b'debug.peer-request',
723 b'debug.peer-request',
724 default=False,
724 default=False,
725 )
725 )
726 # If discovery.exchange-heads is False, the discovery will not start with
726 # If discovery.exchange-heads is False, the discovery will not start with
727 # remote head fetching and local head querying.
727 # remote head fetching and local head querying.
728 coreconfigitem(
728 coreconfigitem(
729 b'devel',
729 b'devel',
730 b'discovery.exchange-heads',
730 b'discovery.exchange-heads',
731 default=True,
731 default=True,
732 )
732 )
733 # If discovery.grow-sample is False, the sample size used in set discovery will
733 # If discovery.grow-sample is False, the sample size used in set discovery will
734 # not be increased through the process
734 # not be increased through the process
735 coreconfigitem(
735 coreconfigitem(
736 b'devel',
736 b'devel',
737 b'discovery.grow-sample',
737 b'discovery.grow-sample',
738 default=True,
738 default=True,
739 )
739 )
740 # When discovery.grow-sample.dynamic is True, the default, the sample size is
740 # When discovery.grow-sample.dynamic is True, the default, the sample size is
741 # adapted to the shape of the undecided set (it is set to the max of:
741 # adapted to the shape of the undecided set (it is set to the max of:
742 # <target-size>, len(roots(undecided)), len(heads(undecided)
742 # <target-size>, len(roots(undecided)), len(heads(undecided)
743 coreconfigitem(
743 coreconfigitem(
744 b'devel',
744 b'devel',
745 b'discovery.grow-sample.dynamic',
745 b'discovery.grow-sample.dynamic',
746 default=True,
746 default=True,
747 )
747 )
748 # discovery.grow-sample.rate control the rate at which the sample grow
748 # discovery.grow-sample.rate control the rate at which the sample grow
749 coreconfigitem(
749 coreconfigitem(
750 b'devel',
750 b'devel',
751 b'discovery.grow-sample.rate',
751 b'discovery.grow-sample.rate',
752 default=1.05,
752 default=1.05,
753 )
753 )
754 # If discovery.randomize is False, random sampling during discovery are
754 # If discovery.randomize is False, random sampling during discovery are
755 # deterministic. It is meant for integration tests.
755 # deterministic. It is meant for integration tests.
756 coreconfigitem(
756 coreconfigitem(
757 b'devel',
757 b'devel',
758 b'discovery.randomize',
758 b'discovery.randomize',
759 default=True,
759 default=True,
760 )
760 )
761 # Control the initial size of the discovery sample
761 # Control the initial size of the discovery sample
762 coreconfigitem(
762 coreconfigitem(
763 b'devel',
763 b'devel',
764 b'discovery.sample-size',
764 b'discovery.sample-size',
765 default=200,
765 default=200,
766 )
766 )
767 # Control the initial size of the discovery for initial change
767 # Control the initial size of the discovery for initial change
768 coreconfigitem(
768 coreconfigitem(
769 b'devel',
769 b'devel',
770 b'discovery.sample-size.initial',
770 b'discovery.sample-size.initial',
771 default=100,
771 default=100,
772 )
772 )
773 _registerdiffopts(section=b'diff')
773 _registerdiffopts(section=b'diff')
774 coreconfigitem(
774 coreconfigitem(
775 b'diff',
775 b'diff',
776 b'merge',
776 b'merge',
777 default=False,
777 default=False,
778 experimental=True,
778 experimental=True,
779 )
779 )
780 coreconfigitem(
780 coreconfigitem(
781 b'email',
781 b'email',
782 b'bcc',
782 b'bcc',
783 default=None,
783 default=None,
784 )
784 )
785 coreconfigitem(
785 coreconfigitem(
786 b'email',
786 b'email',
787 b'cc',
787 b'cc',
788 default=None,
788 default=None,
789 )
789 )
790 coreconfigitem(
790 coreconfigitem(
791 b'email',
791 b'email',
792 b'charsets',
792 b'charsets',
793 default=list,
793 default=list,
794 )
794 )
795 coreconfigitem(
795 coreconfigitem(
796 b'email',
796 b'email',
797 b'from',
797 b'from',
798 default=None,
798 default=None,
799 )
799 )
800 coreconfigitem(
800 coreconfigitem(
801 b'email',
801 b'email',
802 b'method',
802 b'method',
803 default=b'smtp',
803 default=b'smtp',
804 )
804 )
805 coreconfigitem(
805 coreconfigitem(
806 b'email',
806 b'email',
807 b'reply-to',
807 b'reply-to',
808 default=None,
808 default=None,
809 )
809 )
810 coreconfigitem(
810 coreconfigitem(
811 b'email',
811 b'email',
812 b'to',
812 b'to',
813 default=None,
813 default=None,
814 )
814 )
815 coreconfigitem(
815 coreconfigitem(
816 b'experimental',
816 b'experimental',
817 b'archivemetatemplate',
817 b'archivemetatemplate',
818 default=dynamicdefault,
818 default=dynamicdefault,
819 )
819 )
820 coreconfigitem(
820 coreconfigitem(
821 b'experimental',
821 b'experimental',
822 b'auto-publish',
822 b'auto-publish',
823 default=b'publish',
823 default=b'publish',
824 )
824 )
825 coreconfigitem(
825 coreconfigitem(
826 b'experimental',
826 b'experimental',
827 b'bundle-phases',
827 b'bundle-phases',
828 default=False,
828 default=False,
829 )
829 )
830 coreconfigitem(
830 coreconfigitem(
831 b'experimental',
831 b'experimental',
832 b'bundle2-advertise',
832 b'bundle2-advertise',
833 default=True,
833 default=True,
834 )
834 )
835 coreconfigitem(
835 coreconfigitem(
836 b'experimental',
836 b'experimental',
837 b'bundle2-output-capture',
837 b'bundle2-output-capture',
838 default=False,
838 default=False,
839 )
839 )
840 coreconfigitem(
840 coreconfigitem(
841 b'experimental',
841 b'experimental',
842 b'bundle2.pushback',
842 b'bundle2.pushback',
843 default=False,
843 default=False,
844 )
844 )
845 coreconfigitem(
845 coreconfigitem(
846 b'experimental',
846 b'experimental',
847 b'bundle2lazylocking',
847 b'bundle2lazylocking',
848 default=False,
848 default=False,
849 )
849 )
850 coreconfigitem(
850 coreconfigitem(
851 b'experimental',
851 b'experimental',
852 b'bundlecomplevel',
852 b'bundlecomplevel',
853 default=None,
853 default=None,
854 )
854 )
855 coreconfigitem(
855 coreconfigitem(
856 b'experimental',
856 b'experimental',
857 b'bundlecomplevel.bzip2',
857 b'bundlecomplevel.bzip2',
858 default=None,
858 default=None,
859 )
859 )
860 coreconfigitem(
860 coreconfigitem(
861 b'experimental',
861 b'experimental',
862 b'bundlecomplevel.gzip',
862 b'bundlecomplevel.gzip',
863 default=None,
863 default=None,
864 )
864 )
865 coreconfigitem(
865 coreconfigitem(
866 b'experimental',
866 b'experimental',
867 b'bundlecomplevel.none',
867 b'bundlecomplevel.none',
868 default=None,
868 default=None,
869 )
869 )
870 coreconfigitem(
870 coreconfigitem(
871 b'experimental',
871 b'experimental',
872 b'bundlecomplevel.zstd',
872 b'bundlecomplevel.zstd',
873 default=None,
873 default=None,
874 )
874 )
875 coreconfigitem(
875 coreconfigitem(
876 b'experimental',
876 b'experimental',
877 b'bundlecompthreads',
877 b'bundlecompthreads',
878 default=None,
878 default=None,
879 )
879 )
880 coreconfigitem(
880 coreconfigitem(
881 b'experimental',
881 b'experimental',
882 b'bundlecompthreads.bzip2',
882 b'bundlecompthreads.bzip2',
883 default=None,
883 default=None,
884 )
884 )
885 coreconfigitem(
885 coreconfigitem(
886 b'experimental',
886 b'experimental',
887 b'bundlecompthreads.gzip',
887 b'bundlecompthreads.gzip',
888 default=None,
888 default=None,
889 )
889 )
890 coreconfigitem(
890 coreconfigitem(
891 b'experimental',
891 b'experimental',
892 b'bundlecompthreads.none',
892 b'bundlecompthreads.none',
893 default=None,
893 default=None,
894 )
894 )
895 coreconfigitem(
895 coreconfigitem(
896 b'experimental',
896 b'experimental',
897 b'bundlecompthreads.zstd',
897 b'bundlecompthreads.zstd',
898 default=None,
898 default=None,
899 )
899 )
900 coreconfigitem(
900 coreconfigitem(
901 b'experimental',
901 b'experimental',
902 b'changegroup3',
902 b'changegroup3',
903 default=False,
903 default=False,
904 )
904 )
905 coreconfigitem(
905 coreconfigitem(
906 b'experimental',
906 b'experimental',
907 b'changegroup4',
907 b'changegroup4',
908 default=False,
908 default=False,
909 )
909 )
910 coreconfigitem(
910 coreconfigitem(
911 b'experimental',
911 b'experimental',
912 b'cleanup-as-archived',
912 b'cleanup-as-archived',
913 default=False,
913 default=False,
914 )
914 )
915 coreconfigitem(
915 coreconfigitem(
916 b'experimental',
916 b'experimental',
917 b'clientcompressionengines',
917 b'clientcompressionengines',
918 default=list,
918 default=list,
919 )
919 )
920 coreconfigitem(
920 coreconfigitem(
921 b'experimental',
921 b'experimental',
922 b'copytrace',
922 b'copytrace',
923 default=b'on',
923 default=b'on',
924 )
924 )
925 coreconfigitem(
925 coreconfigitem(
926 b'experimental',
926 b'experimental',
927 b'copytrace.movecandidateslimit',
927 b'copytrace.movecandidateslimit',
928 default=100,
928 default=100,
929 )
929 )
930 coreconfigitem(
930 coreconfigitem(
931 b'experimental',
931 b'experimental',
932 b'copytrace.sourcecommitlimit',
932 b'copytrace.sourcecommitlimit',
933 default=100,
933 default=100,
934 )
934 )
935 coreconfigitem(
935 coreconfigitem(
936 b'experimental',
936 b'experimental',
937 b'copies.read-from',
937 b'copies.read-from',
938 default=b"filelog-only",
938 default=b"filelog-only",
939 )
939 )
940 coreconfigitem(
940 coreconfigitem(
941 b'experimental',
941 b'experimental',
942 b'copies.write-to',
942 b'copies.write-to',
943 default=b'filelog-only',
943 default=b'filelog-only',
944 )
944 )
945 coreconfigitem(
945 coreconfigitem(
946 b'experimental',
946 b'experimental',
947 b'crecordtest',
947 b'crecordtest',
948 default=None,
948 default=None,
949 )
949 )
950 coreconfigitem(
950 coreconfigitem(
951 b'experimental',
951 b'experimental',
952 b'directaccess',
952 b'directaccess',
953 default=False,
953 default=False,
954 )
954 )
955 coreconfigitem(
955 coreconfigitem(
956 b'experimental',
956 b'experimental',
957 b'directaccess.revnums',
957 b'directaccess.revnums',
958 default=False,
958 default=False,
959 )
959 )
960 coreconfigitem(
960 coreconfigitem(
961 b'experimental',
961 b'experimental',
962 b'editortmpinhg',
962 b'editortmpinhg',
963 default=False,
963 default=False,
964 )
964 )
965 coreconfigitem(
965 coreconfigitem(
966 b'experimental',
966 b'experimental',
967 b'evolution',
967 b'evolution',
968 default=list,
968 default=list,
969 )
969 )
970 coreconfigitem(
970 coreconfigitem(
971 b'experimental',
971 b'experimental',
972 b'evolution.allowdivergence',
972 b'evolution.allowdivergence',
973 default=False,
973 default=False,
974 alias=[(b'experimental', b'allowdivergence')],
974 alias=[(b'experimental', b'allowdivergence')],
975 )
975 )
976 coreconfigitem(
976 coreconfigitem(
977 b'experimental',
977 b'experimental',
978 b'evolution.allowunstable',
978 b'evolution.allowunstable',
979 default=None,
979 default=None,
980 )
980 )
981 coreconfigitem(
981 coreconfigitem(
982 b'experimental',
982 b'experimental',
983 b'evolution.createmarkers',
983 b'evolution.createmarkers',
984 default=None,
984 default=None,
985 )
985 )
986 coreconfigitem(
986 coreconfigitem(
987 b'experimental',
987 b'experimental',
988 b'evolution.effect-flags',
988 b'evolution.effect-flags',
989 default=True,
989 default=True,
990 alias=[(b'experimental', b'effect-flags')],
990 alias=[(b'experimental', b'effect-flags')],
991 )
991 )
992 coreconfigitem(
992 coreconfigitem(
993 b'experimental',
993 b'experimental',
994 b'evolution.exchange',
994 b'evolution.exchange',
995 default=None,
995 default=None,
996 )
996 )
997 coreconfigitem(
997 coreconfigitem(
998 b'experimental',
998 b'experimental',
999 b'evolution.bundle-obsmarker',
999 b'evolution.bundle-obsmarker',
1000 default=False,
1000 default=False,
1001 )
1001 )
1002 coreconfigitem(
1002 coreconfigitem(
1003 b'experimental',
1003 b'experimental',
1004 b'evolution.bundle-obsmarker:mandatory',
1004 b'evolution.bundle-obsmarker:mandatory',
1005 default=True,
1005 default=True,
1006 )
1006 )
1007 coreconfigitem(
1007 coreconfigitem(
1008 b'experimental',
1008 b'experimental',
1009 b'log.topo',
1009 b'log.topo',
1010 default=False,
1010 default=False,
1011 )
1011 )
1012 coreconfigitem(
1012 coreconfigitem(
1013 b'experimental',
1013 b'experimental',
1014 b'evolution.report-instabilities',
1014 b'evolution.report-instabilities',
1015 default=True,
1015 default=True,
1016 )
1016 )
1017 coreconfigitem(
1017 coreconfigitem(
1018 b'experimental',
1018 b'experimental',
1019 b'evolution.track-operation',
1019 b'evolution.track-operation',
1020 default=True,
1020 default=True,
1021 )
1021 )
1022 # repo-level config to exclude a revset visibility
1022 # repo-level config to exclude a revset visibility
1023 #
1023 #
1024 # The target use case is to use `share` to expose different subset of the same
1024 # The target use case is to use `share` to expose different subset of the same
1025 # repository, especially server side. See also `server.view`.
1025 # repository, especially server side. See also `server.view`.
1026 coreconfigitem(
1026 coreconfigitem(
1027 b'experimental',
1027 b'experimental',
1028 b'extra-filter-revs',
1028 b'extra-filter-revs',
1029 default=None,
1029 default=None,
1030 )
1030 )
1031 coreconfigitem(
1031 coreconfigitem(
1032 b'experimental',
1032 b'experimental',
1033 b'maxdeltachainspan',
1033 b'maxdeltachainspan',
1034 default=-1,
1034 default=-1,
1035 )
1035 )
1036 # tracks files which were undeleted (merge might delete them but we explicitly
1036 # tracks files which were undeleted (merge might delete them but we explicitly
1037 # kept/undeleted them) and creates new filenodes for them
1037 # kept/undeleted them) and creates new filenodes for them
1038 coreconfigitem(
1038 coreconfigitem(
1039 b'experimental',
1039 b'experimental',
1040 b'merge-track-salvaged',
1040 b'merge-track-salvaged',
1041 default=False,
1041 default=False,
1042 )
1042 )
1043 coreconfigitem(
1043 coreconfigitem(
1044 b'experimental',
1044 b'experimental',
1045 b'mergetempdirprefix',
1045 b'mergetempdirprefix',
1046 default=None,
1046 default=None,
1047 )
1047 )
1048 coreconfigitem(
1048 coreconfigitem(
1049 b'experimental',
1049 b'experimental',
1050 b'mmapindexthreshold',
1050 b'mmapindexthreshold',
1051 default=None,
1051 default=None,
1052 )
1052 )
1053 coreconfigitem(
1053 coreconfigitem(
1054 b'experimental',
1054 b'experimental',
1055 b'narrow',
1055 b'narrow',
1056 default=False,
1056 default=False,
1057 )
1057 )
1058 coreconfigitem(
1058 coreconfigitem(
1059 b'experimental',
1059 b'experimental',
1060 b'nonnormalparanoidcheck',
1060 b'nonnormalparanoidcheck',
1061 default=False,
1061 default=False,
1062 )
1062 )
1063 coreconfigitem(
1063 coreconfigitem(
1064 b'experimental',
1064 b'experimental',
1065 b'exportableenviron',
1065 b'exportableenviron',
1066 default=list,
1066 default=list,
1067 )
1067 )
1068 coreconfigitem(
1068 coreconfigitem(
1069 b'experimental',
1069 b'experimental',
1070 b'extendedheader.index',
1070 b'extendedheader.index',
1071 default=None,
1071 default=None,
1072 )
1072 )
1073 coreconfigitem(
1073 coreconfigitem(
1074 b'experimental',
1074 b'experimental',
1075 b'extendedheader.similarity',
1075 b'extendedheader.similarity',
1076 default=False,
1076 default=False,
1077 )
1077 )
1078 coreconfigitem(
1078 coreconfigitem(
1079 b'experimental',
1079 b'experimental',
1080 b'graphshorten',
1080 b'graphshorten',
1081 default=False,
1081 default=False,
1082 )
1082 )
1083 coreconfigitem(
1083 coreconfigitem(
1084 b'experimental',
1084 b'experimental',
1085 b'graphstyle.parent',
1085 b'graphstyle.parent',
1086 default=dynamicdefault,
1086 default=dynamicdefault,
1087 )
1087 )
1088 coreconfigitem(
1088 coreconfigitem(
1089 b'experimental',
1089 b'experimental',
1090 b'graphstyle.missing',
1090 b'graphstyle.missing',
1091 default=dynamicdefault,
1091 default=dynamicdefault,
1092 )
1092 )
1093 coreconfigitem(
1093 coreconfigitem(
1094 b'experimental',
1094 b'experimental',
1095 b'graphstyle.grandparent',
1095 b'graphstyle.grandparent',
1096 default=dynamicdefault,
1096 default=dynamicdefault,
1097 )
1097 )
1098 coreconfigitem(
1098 coreconfigitem(
1099 b'experimental',
1099 b'experimental',
1100 b'hook-track-tags',
1100 b'hook-track-tags',
1101 default=False,
1101 default=False,
1102 )
1102 )
1103 coreconfigitem(
1103 coreconfigitem(
1104 b'experimental',
1104 b'experimental',
1105 b'httppeer.advertise-v2',
1105 b'httppeer.advertise-v2',
1106 default=False,
1106 default=False,
1107 )
1107 )
1108 coreconfigitem(
1108 coreconfigitem(
1109 b'experimental',
1109 b'experimental',
1110 b'httppeer.v2-encoder-order',
1110 b'httppeer.v2-encoder-order',
1111 default=None,
1111 default=None,
1112 )
1112 )
1113 coreconfigitem(
1113 coreconfigitem(
1114 b'experimental',
1114 b'experimental',
1115 b'httppostargs',
1115 b'httppostargs',
1116 default=False,
1116 default=False,
1117 )
1117 )
1118 coreconfigitem(b'experimental', b'nointerrupt', default=False)
1118 coreconfigitem(b'experimental', b'nointerrupt', default=False)
1119 coreconfigitem(b'experimental', b'nointerrupt-interactiveonly', default=True)
1119 coreconfigitem(b'experimental', b'nointerrupt-interactiveonly', default=True)
1120
1120
1121 coreconfigitem(
1121 coreconfigitem(
1122 b'experimental',
1122 b'experimental',
1123 b'obsmarkers-exchange-debug',
1123 b'obsmarkers-exchange-debug',
1124 default=False,
1124 default=False,
1125 )
1125 )
1126 coreconfigitem(
1126 coreconfigitem(
1127 b'experimental',
1127 b'experimental',
1128 b'remotenames',
1128 b'remotenames',
1129 default=False,
1129 default=False,
1130 )
1130 )
1131 coreconfigitem(
1131 coreconfigitem(
1132 b'experimental',
1132 b'experimental',
1133 b'removeemptydirs',
1133 b'removeemptydirs',
1134 default=True,
1134 default=True,
1135 )
1135 )
1136 coreconfigitem(
1136 coreconfigitem(
1137 b'experimental',
1137 b'experimental',
1138 b'revert.interactive.select-to-keep',
1138 b'revert.interactive.select-to-keep',
1139 default=False,
1139 default=False,
1140 )
1140 )
1141 coreconfigitem(
1141 coreconfigitem(
1142 b'experimental',
1142 b'experimental',
1143 b'revisions.prefixhexnode',
1143 b'revisions.prefixhexnode',
1144 default=False,
1144 default=False,
1145 )
1145 )
1146 # "out of experimental" todo list.
1146 # "out of experimental" todo list.
1147 #
1147 #
1148 # * include management of a persistent nodemap in the main docket
1148 # * include management of a persistent nodemap in the main docket
1149 # * enforce a "no-truncate" policy for mmap safety
1149 # * enforce a "no-truncate" policy for mmap safety
1150 # - for censoring operation
1150 # - for censoring operation
1151 # - for stripping operation
1151 # - for stripping operation
1152 # - for rollback operation
1152 # - for rollback operation
1153 # * proper streaming (race free) of the docket file
1153 # * proper streaming (race free) of the docket file
1154 # * track garbage data to evemtually allow rewriting -existing- sidedata.
1154 # * track garbage data to evemtually allow rewriting -existing- sidedata.
1155 # * Exchange-wise, we will also need to do something more efficient than
1155 # * Exchange-wise, we will also need to do something more efficient than
1156 # keeping references to the affected revlogs, especially memory-wise when
1156 # keeping references to the affected revlogs, especially memory-wise when
1157 # rewriting sidedata.
1157 # rewriting sidedata.
1158 # * introduce a proper solution to reduce the number of filelog related files.
1158 # * introduce a proper solution to reduce the number of filelog related files.
1159 # * use caching for reading sidedata (similar to what we do for data).
1159 # * use caching for reading sidedata (similar to what we do for data).
1160 # * no longer set offset=0 if sidedata_size=0 (simplify cutoff computation).
1160 # * no longer set offset=0 if sidedata_size=0 (simplify cutoff computation).
1161 # * Improvement to consider
1161 # * Improvement to consider
1162 # - avoid compression header in chunk using the default compression?
1162 # - avoid compression header in chunk using the default compression?
1163 # - forbid "inline" compression mode entirely?
1163 # - forbid "inline" compression mode entirely?
1164 # - split the data offset and flag field (the 2 bytes save are mostly trouble)
1164 # - split the data offset and flag field (the 2 bytes save are mostly trouble)
1165 # - keep track of uncompressed -chunk- size (to preallocate memory better)
1165 # - keep track of uncompressed -chunk- size (to preallocate memory better)
1166 # - keep track of chain base or size (probably not that useful anymore)
1166 # - keep track of chain base or size (probably not that useful anymore)
1167 coreconfigitem(
1167 coreconfigitem(
1168 b'experimental',
1168 b'experimental',
1169 b'revlogv2',
1169 b'revlogv2',
1170 default=None,
1170 default=None,
1171 )
1171 )
1172 coreconfigitem(
1172 coreconfigitem(
1173 b'experimental',
1173 b'experimental',
1174 b'revisions.disambiguatewithin',
1174 b'revisions.disambiguatewithin',
1175 default=None,
1175 default=None,
1176 )
1176 )
1177 coreconfigitem(
1177 coreconfigitem(
1178 b'experimental',
1178 b'experimental',
1179 b'rust.index',
1179 b'rust.index',
1180 default=False,
1180 default=False,
1181 )
1181 )
1182 coreconfigitem(
1182 coreconfigitem(
1183 b'experimental',
1183 b'experimental',
1184 b'server.filesdata.recommended-batch-size',
1184 b'server.filesdata.recommended-batch-size',
1185 default=50000,
1185 default=50000,
1186 )
1186 )
1187 coreconfigitem(
1187 coreconfigitem(
1188 b'experimental',
1188 b'experimental',
1189 b'server.manifestdata.recommended-batch-size',
1189 b'server.manifestdata.recommended-batch-size',
1190 default=100000,
1190 default=100000,
1191 )
1191 )
1192 coreconfigitem(
1192 coreconfigitem(
1193 b'experimental',
1193 b'experimental',
1194 b'server.stream-narrow-clones',
1194 b'server.stream-narrow-clones',
1195 default=False,
1195 default=False,
1196 )
1196 )
1197 coreconfigitem(
1197 coreconfigitem(
1198 b'experimental',
1198 b'experimental',
1199 b'single-head-per-branch',
1199 b'single-head-per-branch',
1200 default=False,
1200 default=False,
1201 )
1201 )
1202 coreconfigitem(
1202 coreconfigitem(
1203 b'experimental',
1203 b'experimental',
1204 b'single-head-per-branch:account-closed-heads',
1204 b'single-head-per-branch:account-closed-heads',
1205 default=False,
1205 default=False,
1206 )
1206 )
1207 coreconfigitem(
1207 coreconfigitem(
1208 b'experimental',
1208 b'experimental',
1209 b'single-head-per-branch:public-changes-only',
1209 b'single-head-per-branch:public-changes-only',
1210 default=False,
1210 default=False,
1211 )
1211 )
1212 coreconfigitem(
1212 coreconfigitem(
1213 b'experimental',
1213 b'experimental',
1214 b'sshserver.support-v2',
1214 b'sshserver.support-v2',
1215 default=False,
1215 default=False,
1216 )
1216 )
1217 coreconfigitem(
1217 coreconfigitem(
1218 b'experimental',
1218 b'experimental',
1219 b'sparse-read',
1219 b'sparse-read',
1220 default=False,
1220 default=False,
1221 )
1221 )
1222 coreconfigitem(
1222 coreconfigitem(
1223 b'experimental',
1223 b'experimental',
1224 b'sparse-read.density-threshold',
1224 b'sparse-read.density-threshold',
1225 default=0.50,
1225 default=0.50,
1226 )
1226 )
1227 coreconfigitem(
1227 coreconfigitem(
1228 b'experimental',
1228 b'experimental',
1229 b'sparse-read.min-gap-size',
1229 b'sparse-read.min-gap-size',
1230 default=b'65K',
1230 default=b'65K',
1231 )
1231 )
1232 coreconfigitem(
1232 coreconfigitem(
1233 b'experimental',
1233 b'experimental',
1234 b'treemanifest',
1234 b'treemanifest',
1235 default=False,
1235 default=False,
1236 )
1236 )
1237 coreconfigitem(
1237 coreconfigitem(
1238 b'experimental',
1238 b'experimental',
1239 b'update.atomic-file',
1239 b'update.atomic-file',
1240 default=False,
1240 default=False,
1241 )
1241 )
1242 coreconfigitem(
1242 coreconfigitem(
1243 b'experimental',
1243 b'experimental',
1244 b'sshpeer.advertise-v2',
1244 b'sshpeer.advertise-v2',
1245 default=False,
1245 default=False,
1246 )
1246 )
1247 coreconfigitem(
1247 coreconfigitem(
1248 b'experimental',
1248 b'experimental',
1249 b'web.apiserver',
1249 b'web.apiserver',
1250 default=False,
1250 default=False,
1251 )
1251 )
1252 coreconfigitem(
1252 coreconfigitem(
1253 b'experimental',
1253 b'experimental',
1254 b'web.api.http-v2',
1254 b'web.api.http-v2',
1255 default=False,
1255 default=False,
1256 )
1256 )
1257 coreconfigitem(
1257 coreconfigitem(
1258 b'experimental',
1258 b'experimental',
1259 b'web.api.debugreflect',
1259 b'web.api.debugreflect',
1260 default=False,
1260 default=False,
1261 )
1261 )
1262 coreconfigitem(
1262 coreconfigitem(
1263 b'experimental',
1263 b'experimental',
1264 b'web.full-garbage-collection-rate',
1264 b'web.full-garbage-collection-rate',
1265 default=1, # still forcing a full collection on each request
1265 default=1, # still forcing a full collection on each request
1266 )
1266 )
1267 coreconfigitem(
1267 coreconfigitem(
1268 b'experimental',
1268 b'experimental',
1269 b'worker.wdir-get-thread-safe',
1269 b'worker.wdir-get-thread-safe',
1270 default=False,
1270 default=False,
1271 )
1271 )
1272 coreconfigitem(
1272 coreconfigitem(
1273 b'experimental',
1273 b'experimental',
1274 b'worker.repository-upgrade',
1274 b'worker.repository-upgrade',
1275 default=False,
1275 default=False,
1276 )
1276 )
1277 coreconfigitem(
1277 coreconfigitem(
1278 b'experimental',
1278 b'experimental',
1279 b'xdiff',
1279 b'xdiff',
1280 default=False,
1280 default=False,
1281 )
1281 )
1282 coreconfigitem(
1282 coreconfigitem(
1283 b'extensions',
1283 b'extensions',
1284 b'[^:]*',
1284 b'[^:]*',
1285 default=None,
1285 default=None,
1286 generic=True,
1286 generic=True,
1287 )
1287 )
1288 coreconfigitem(
1288 coreconfigitem(
1289 b'extensions',
1289 b'extensions',
1290 b'[^:]*:required',
1290 b'[^:]*:required',
1291 default=False,
1291 default=False,
1292 generic=True,
1292 generic=True,
1293 )
1293 )
1294 coreconfigitem(
1294 coreconfigitem(
1295 b'extdata',
1295 b'extdata',
1296 b'.*',
1296 b'.*',
1297 default=None,
1297 default=None,
1298 generic=True,
1298 generic=True,
1299 )
1299 )
1300 coreconfigitem(
1300 coreconfigitem(
1301 b'format',
1301 b'format',
1302 b'bookmarks-in-store',
1302 b'bookmarks-in-store',
1303 default=False,
1303 default=False,
1304 )
1304 )
1305 coreconfigitem(
1305 coreconfigitem(
1306 b'format',
1306 b'format',
1307 b'chunkcachesize',
1307 b'chunkcachesize',
1308 default=None,
1308 default=None,
1309 experimental=True,
1309 experimental=True,
1310 )
1310 )
1311 coreconfigitem(
1311 coreconfigitem(
1312 # Enable this dirstate format *when creating a new repository*.
1312 # Enable this dirstate format *when creating a new repository*.
1313 # Which format to use for existing repos is controlled by .hg/requires
1313 # Which format to use for existing repos is controlled by .hg/requires
1314 b'format',
1314 b'format',
1315 b'exp-rc-dirstate-v2',
1315 b'exp-rc-dirstate-v2',
1316 default=False,
1316 default=False,
1317 experimental=True,
1317 experimental=True,
1318 )
1318 )
1319 coreconfigitem(
1319 coreconfigitem(
1320 b'format',
1320 b'format',
1321 b'dotencode',
1321 b'dotencode',
1322 default=True,
1322 default=True,
1323 )
1323 )
1324 coreconfigitem(
1324 coreconfigitem(
1325 b'format',
1325 b'format',
1326 b'generaldelta',
1326 b'generaldelta',
1327 default=False,
1327 default=False,
1328 experimental=True,
1328 experimental=True,
1329 )
1329 )
1330 coreconfigitem(
1330 coreconfigitem(
1331 b'format',
1331 b'format',
1332 b'manifestcachesize',
1332 b'manifestcachesize',
1333 default=None,
1333 default=None,
1334 experimental=True,
1334 experimental=True,
1335 )
1335 )
1336 coreconfigitem(
1336 coreconfigitem(
1337 b'format',
1337 b'format',
1338 b'maxchainlen',
1338 b'maxchainlen',
1339 default=dynamicdefault,
1339 default=dynamicdefault,
1340 experimental=True,
1340 experimental=True,
1341 )
1341 )
1342 coreconfigitem(
1342 coreconfigitem(
1343 b'format',
1343 b'format',
1344 b'obsstore-version',
1344 b'obsstore-version',
1345 default=None,
1345 default=None,
1346 )
1346 )
1347 coreconfigitem(
1347 coreconfigitem(
1348 b'format',
1348 b'format',
1349 b'sparse-revlog',
1349 b'sparse-revlog',
1350 default=True,
1350 default=True,
1351 )
1351 )
1352 coreconfigitem(
1352 coreconfigitem(
1353 b'format',
1353 b'format',
1354 b'revlog-compression',
1354 b'revlog-compression',
1355 default=lambda: [b'zstd', b'zlib'],
1355 default=lambda: [b'zstd', b'zlib'],
1356 alias=[(b'experimental', b'format.compression')],
1356 alias=[(b'experimental', b'format.compression')],
1357 )
1357 )
1358 # Experimental TODOs:
1358 # Experimental TODOs:
1359 #
1359 #
1360 # * Same as for evlogv2 (but for the reduction of the number of files)
1360 # * Same as for revlogv2 (but for the reduction of the number of files)
1361 # * Actually computing the rank of changesets
1361 # * Improvement to investigate
1362 # * Improvement to investigate
1362 # - storing .hgtags fnode
1363 # - storing .hgtags fnode
1363 # - storing `rank` of changesets
1364 # - storing branch related identifier
1364 # - storing branch related identifier
1365
1365
1366 coreconfigitem(
1366 coreconfigitem(
1367 b'format',
1367 b'format',
1368 b'exp-use-changelog-v2',
1368 b'exp-use-changelog-v2',
1369 default=None,
1369 default=None,
1370 experimental=True,
1370 experimental=True,
1371 )
1371 )
1372 coreconfigitem(
1372 coreconfigitem(
1373 b'format',
1373 b'format',
1374 b'usefncache',
1374 b'usefncache',
1375 default=True,
1375 default=True,
1376 )
1376 )
1377 coreconfigitem(
1377 coreconfigitem(
1378 b'format',
1378 b'format',
1379 b'usegeneraldelta',
1379 b'usegeneraldelta',
1380 default=True,
1380 default=True,
1381 )
1381 )
1382 coreconfigitem(
1382 coreconfigitem(
1383 b'format',
1383 b'format',
1384 b'usestore',
1384 b'usestore',
1385 default=True,
1385 default=True,
1386 )
1386 )
1387
1387
1388
1388
1389 def _persistent_nodemap_default():
1389 def _persistent_nodemap_default():
1390 """compute `use-persistent-nodemap` default value
1390 """compute `use-persistent-nodemap` default value
1391
1391
1392 The feature is disabled unless a fast implementation is available.
1392 The feature is disabled unless a fast implementation is available.
1393 """
1393 """
1394 from . import policy
1394 from . import policy
1395
1395
1396 return policy.importrust('revlog') is not None
1396 return policy.importrust('revlog') is not None
1397
1397
1398
1398
1399 coreconfigitem(
1399 coreconfigitem(
1400 b'format',
1400 b'format',
1401 b'use-persistent-nodemap',
1401 b'use-persistent-nodemap',
1402 default=_persistent_nodemap_default,
1402 default=_persistent_nodemap_default,
1403 )
1403 )
1404 coreconfigitem(
1404 coreconfigitem(
1405 b'format',
1405 b'format',
1406 b'exp-use-copies-side-data-changeset',
1406 b'exp-use-copies-side-data-changeset',
1407 default=False,
1407 default=False,
1408 experimental=True,
1408 experimental=True,
1409 )
1409 )
1410 coreconfigitem(
1410 coreconfigitem(
1411 b'format',
1411 b'format',
1412 b'use-share-safe',
1412 b'use-share-safe',
1413 default=False,
1413 default=False,
1414 )
1414 )
1415 coreconfigitem(
1415 coreconfigitem(
1416 b'format',
1416 b'format',
1417 b'internal-phase',
1417 b'internal-phase',
1418 default=False,
1418 default=False,
1419 experimental=True,
1419 experimental=True,
1420 )
1420 )
1421 coreconfigitem(
1421 coreconfigitem(
1422 b'fsmonitor',
1422 b'fsmonitor',
1423 b'warn_when_unused',
1423 b'warn_when_unused',
1424 default=True,
1424 default=True,
1425 )
1425 )
1426 coreconfigitem(
1426 coreconfigitem(
1427 b'fsmonitor',
1427 b'fsmonitor',
1428 b'warn_update_file_count',
1428 b'warn_update_file_count',
1429 default=50000,
1429 default=50000,
1430 )
1430 )
1431 coreconfigitem(
1431 coreconfigitem(
1432 b'fsmonitor',
1432 b'fsmonitor',
1433 b'warn_update_file_count_rust',
1433 b'warn_update_file_count_rust',
1434 default=400000,
1434 default=400000,
1435 )
1435 )
1436 coreconfigitem(
1436 coreconfigitem(
1437 b'help',
1437 b'help',
1438 br'hidden-command\..*',
1438 br'hidden-command\..*',
1439 default=False,
1439 default=False,
1440 generic=True,
1440 generic=True,
1441 )
1441 )
1442 coreconfigitem(
1442 coreconfigitem(
1443 b'help',
1443 b'help',
1444 br'hidden-topic\..*',
1444 br'hidden-topic\..*',
1445 default=False,
1445 default=False,
1446 generic=True,
1446 generic=True,
1447 )
1447 )
1448 coreconfigitem(
1448 coreconfigitem(
1449 b'hooks',
1449 b'hooks',
1450 b'[^:]*',
1450 b'[^:]*',
1451 default=dynamicdefault,
1451 default=dynamicdefault,
1452 generic=True,
1452 generic=True,
1453 )
1453 )
1454 coreconfigitem(
1454 coreconfigitem(
1455 b'hooks',
1455 b'hooks',
1456 b'.*:run-with-plain',
1456 b'.*:run-with-plain',
1457 default=True,
1457 default=True,
1458 generic=True,
1458 generic=True,
1459 )
1459 )
1460 coreconfigitem(
1460 coreconfigitem(
1461 b'hgweb-paths',
1461 b'hgweb-paths',
1462 b'.*',
1462 b'.*',
1463 default=list,
1463 default=list,
1464 generic=True,
1464 generic=True,
1465 )
1465 )
1466 coreconfigitem(
1466 coreconfigitem(
1467 b'hostfingerprints',
1467 b'hostfingerprints',
1468 b'.*',
1468 b'.*',
1469 default=list,
1469 default=list,
1470 generic=True,
1470 generic=True,
1471 )
1471 )
1472 coreconfigitem(
1472 coreconfigitem(
1473 b'hostsecurity',
1473 b'hostsecurity',
1474 b'ciphers',
1474 b'ciphers',
1475 default=None,
1475 default=None,
1476 )
1476 )
1477 coreconfigitem(
1477 coreconfigitem(
1478 b'hostsecurity',
1478 b'hostsecurity',
1479 b'minimumprotocol',
1479 b'minimumprotocol',
1480 default=dynamicdefault,
1480 default=dynamicdefault,
1481 )
1481 )
1482 coreconfigitem(
1482 coreconfigitem(
1483 b'hostsecurity',
1483 b'hostsecurity',
1484 b'.*:minimumprotocol$',
1484 b'.*:minimumprotocol$',
1485 default=dynamicdefault,
1485 default=dynamicdefault,
1486 generic=True,
1486 generic=True,
1487 )
1487 )
1488 coreconfigitem(
1488 coreconfigitem(
1489 b'hostsecurity',
1489 b'hostsecurity',
1490 b'.*:ciphers$',
1490 b'.*:ciphers$',
1491 default=dynamicdefault,
1491 default=dynamicdefault,
1492 generic=True,
1492 generic=True,
1493 )
1493 )
1494 coreconfigitem(
1494 coreconfigitem(
1495 b'hostsecurity',
1495 b'hostsecurity',
1496 b'.*:fingerprints$',
1496 b'.*:fingerprints$',
1497 default=list,
1497 default=list,
1498 generic=True,
1498 generic=True,
1499 )
1499 )
1500 coreconfigitem(
1500 coreconfigitem(
1501 b'hostsecurity',
1501 b'hostsecurity',
1502 b'.*:verifycertsfile$',
1502 b'.*:verifycertsfile$',
1503 default=None,
1503 default=None,
1504 generic=True,
1504 generic=True,
1505 )
1505 )
1506
1506
1507 coreconfigitem(
1507 coreconfigitem(
1508 b'http_proxy',
1508 b'http_proxy',
1509 b'always',
1509 b'always',
1510 default=False,
1510 default=False,
1511 )
1511 )
1512 coreconfigitem(
1512 coreconfigitem(
1513 b'http_proxy',
1513 b'http_proxy',
1514 b'host',
1514 b'host',
1515 default=None,
1515 default=None,
1516 )
1516 )
1517 coreconfigitem(
1517 coreconfigitem(
1518 b'http_proxy',
1518 b'http_proxy',
1519 b'no',
1519 b'no',
1520 default=list,
1520 default=list,
1521 )
1521 )
1522 coreconfigitem(
1522 coreconfigitem(
1523 b'http_proxy',
1523 b'http_proxy',
1524 b'passwd',
1524 b'passwd',
1525 default=None,
1525 default=None,
1526 )
1526 )
1527 coreconfigitem(
1527 coreconfigitem(
1528 b'http_proxy',
1528 b'http_proxy',
1529 b'user',
1529 b'user',
1530 default=None,
1530 default=None,
1531 )
1531 )
1532
1532
1533 coreconfigitem(
1533 coreconfigitem(
1534 b'http',
1534 b'http',
1535 b'timeout',
1535 b'timeout',
1536 default=None,
1536 default=None,
1537 )
1537 )
1538
1538
1539 coreconfigitem(
1539 coreconfigitem(
1540 b'logtoprocess',
1540 b'logtoprocess',
1541 b'commandexception',
1541 b'commandexception',
1542 default=None,
1542 default=None,
1543 )
1543 )
1544 coreconfigitem(
1544 coreconfigitem(
1545 b'logtoprocess',
1545 b'logtoprocess',
1546 b'commandfinish',
1546 b'commandfinish',
1547 default=None,
1547 default=None,
1548 )
1548 )
1549 coreconfigitem(
1549 coreconfigitem(
1550 b'logtoprocess',
1550 b'logtoprocess',
1551 b'command',
1551 b'command',
1552 default=None,
1552 default=None,
1553 )
1553 )
1554 coreconfigitem(
1554 coreconfigitem(
1555 b'logtoprocess',
1555 b'logtoprocess',
1556 b'develwarn',
1556 b'develwarn',
1557 default=None,
1557 default=None,
1558 )
1558 )
1559 coreconfigitem(
1559 coreconfigitem(
1560 b'logtoprocess',
1560 b'logtoprocess',
1561 b'uiblocked',
1561 b'uiblocked',
1562 default=None,
1562 default=None,
1563 )
1563 )
1564 coreconfigitem(
1564 coreconfigitem(
1565 b'merge',
1565 b'merge',
1566 b'checkunknown',
1566 b'checkunknown',
1567 default=b'abort',
1567 default=b'abort',
1568 )
1568 )
1569 coreconfigitem(
1569 coreconfigitem(
1570 b'merge',
1570 b'merge',
1571 b'checkignored',
1571 b'checkignored',
1572 default=b'abort',
1572 default=b'abort',
1573 )
1573 )
1574 coreconfigitem(
1574 coreconfigitem(
1575 b'experimental',
1575 b'experimental',
1576 b'merge.checkpathconflicts',
1576 b'merge.checkpathconflicts',
1577 default=False,
1577 default=False,
1578 )
1578 )
1579 coreconfigitem(
1579 coreconfigitem(
1580 b'merge',
1580 b'merge',
1581 b'followcopies',
1581 b'followcopies',
1582 default=True,
1582 default=True,
1583 )
1583 )
1584 coreconfigitem(
1584 coreconfigitem(
1585 b'merge',
1585 b'merge',
1586 b'on-failure',
1586 b'on-failure',
1587 default=b'continue',
1587 default=b'continue',
1588 )
1588 )
1589 coreconfigitem(
1589 coreconfigitem(
1590 b'merge',
1590 b'merge',
1591 b'preferancestor',
1591 b'preferancestor',
1592 default=lambda: [b'*'],
1592 default=lambda: [b'*'],
1593 experimental=True,
1593 experimental=True,
1594 )
1594 )
1595 coreconfigitem(
1595 coreconfigitem(
1596 b'merge',
1596 b'merge',
1597 b'strict-capability-check',
1597 b'strict-capability-check',
1598 default=False,
1598 default=False,
1599 )
1599 )
1600 coreconfigitem(
1600 coreconfigitem(
1601 b'merge-tools',
1601 b'merge-tools',
1602 b'.*',
1602 b'.*',
1603 default=None,
1603 default=None,
1604 generic=True,
1604 generic=True,
1605 )
1605 )
1606 coreconfigitem(
1606 coreconfigitem(
1607 b'merge-tools',
1607 b'merge-tools',
1608 br'.*\.args$',
1608 br'.*\.args$',
1609 default=b"$local $base $other",
1609 default=b"$local $base $other",
1610 generic=True,
1610 generic=True,
1611 priority=-1,
1611 priority=-1,
1612 )
1612 )
1613 coreconfigitem(
1613 coreconfigitem(
1614 b'merge-tools',
1614 b'merge-tools',
1615 br'.*\.binary$',
1615 br'.*\.binary$',
1616 default=False,
1616 default=False,
1617 generic=True,
1617 generic=True,
1618 priority=-1,
1618 priority=-1,
1619 )
1619 )
1620 coreconfigitem(
1620 coreconfigitem(
1621 b'merge-tools',
1621 b'merge-tools',
1622 br'.*\.check$',
1622 br'.*\.check$',
1623 default=list,
1623 default=list,
1624 generic=True,
1624 generic=True,
1625 priority=-1,
1625 priority=-1,
1626 )
1626 )
1627 coreconfigitem(
1627 coreconfigitem(
1628 b'merge-tools',
1628 b'merge-tools',
1629 br'.*\.checkchanged$',
1629 br'.*\.checkchanged$',
1630 default=False,
1630 default=False,
1631 generic=True,
1631 generic=True,
1632 priority=-1,
1632 priority=-1,
1633 )
1633 )
1634 coreconfigitem(
1634 coreconfigitem(
1635 b'merge-tools',
1635 b'merge-tools',
1636 br'.*\.executable$',
1636 br'.*\.executable$',
1637 default=dynamicdefault,
1637 default=dynamicdefault,
1638 generic=True,
1638 generic=True,
1639 priority=-1,
1639 priority=-1,
1640 )
1640 )
1641 coreconfigitem(
1641 coreconfigitem(
1642 b'merge-tools',
1642 b'merge-tools',
1643 br'.*\.fixeol$',
1643 br'.*\.fixeol$',
1644 default=False,
1644 default=False,
1645 generic=True,
1645 generic=True,
1646 priority=-1,
1646 priority=-1,
1647 )
1647 )
1648 coreconfigitem(
1648 coreconfigitem(
1649 b'merge-tools',
1649 b'merge-tools',
1650 br'.*\.gui$',
1650 br'.*\.gui$',
1651 default=False,
1651 default=False,
1652 generic=True,
1652 generic=True,
1653 priority=-1,
1653 priority=-1,
1654 )
1654 )
1655 coreconfigitem(
1655 coreconfigitem(
1656 b'merge-tools',
1656 b'merge-tools',
1657 br'.*\.mergemarkers$',
1657 br'.*\.mergemarkers$',
1658 default=b'basic',
1658 default=b'basic',
1659 generic=True,
1659 generic=True,
1660 priority=-1,
1660 priority=-1,
1661 )
1661 )
1662 coreconfigitem(
1662 coreconfigitem(
1663 b'merge-tools',
1663 b'merge-tools',
1664 br'.*\.mergemarkertemplate$',
1664 br'.*\.mergemarkertemplate$',
1665 default=dynamicdefault, # take from command-templates.mergemarker
1665 default=dynamicdefault, # take from command-templates.mergemarker
1666 generic=True,
1666 generic=True,
1667 priority=-1,
1667 priority=-1,
1668 )
1668 )
1669 coreconfigitem(
1669 coreconfigitem(
1670 b'merge-tools',
1670 b'merge-tools',
1671 br'.*\.priority$',
1671 br'.*\.priority$',
1672 default=0,
1672 default=0,
1673 generic=True,
1673 generic=True,
1674 priority=-1,
1674 priority=-1,
1675 )
1675 )
1676 coreconfigitem(
1676 coreconfigitem(
1677 b'merge-tools',
1677 b'merge-tools',
1678 br'.*\.premerge$',
1678 br'.*\.premerge$',
1679 default=dynamicdefault,
1679 default=dynamicdefault,
1680 generic=True,
1680 generic=True,
1681 priority=-1,
1681 priority=-1,
1682 )
1682 )
1683 coreconfigitem(
1683 coreconfigitem(
1684 b'merge-tools',
1684 b'merge-tools',
1685 br'.*\.symlink$',
1685 br'.*\.symlink$',
1686 default=False,
1686 default=False,
1687 generic=True,
1687 generic=True,
1688 priority=-1,
1688 priority=-1,
1689 )
1689 )
1690 coreconfigitem(
1690 coreconfigitem(
1691 b'pager',
1691 b'pager',
1692 b'attend-.*',
1692 b'attend-.*',
1693 default=dynamicdefault,
1693 default=dynamicdefault,
1694 generic=True,
1694 generic=True,
1695 )
1695 )
1696 coreconfigitem(
1696 coreconfigitem(
1697 b'pager',
1697 b'pager',
1698 b'ignore',
1698 b'ignore',
1699 default=list,
1699 default=list,
1700 )
1700 )
1701 coreconfigitem(
1701 coreconfigitem(
1702 b'pager',
1702 b'pager',
1703 b'pager',
1703 b'pager',
1704 default=dynamicdefault,
1704 default=dynamicdefault,
1705 )
1705 )
1706 coreconfigitem(
1706 coreconfigitem(
1707 b'patch',
1707 b'patch',
1708 b'eol',
1708 b'eol',
1709 default=b'strict',
1709 default=b'strict',
1710 )
1710 )
1711 coreconfigitem(
1711 coreconfigitem(
1712 b'patch',
1712 b'patch',
1713 b'fuzz',
1713 b'fuzz',
1714 default=2,
1714 default=2,
1715 )
1715 )
1716 coreconfigitem(
1716 coreconfigitem(
1717 b'paths',
1717 b'paths',
1718 b'default',
1718 b'default',
1719 default=None,
1719 default=None,
1720 )
1720 )
1721 coreconfigitem(
1721 coreconfigitem(
1722 b'paths',
1722 b'paths',
1723 b'default-push',
1723 b'default-push',
1724 default=None,
1724 default=None,
1725 )
1725 )
1726 coreconfigitem(
1726 coreconfigitem(
1727 b'paths',
1727 b'paths',
1728 b'.*',
1728 b'.*',
1729 default=None,
1729 default=None,
1730 generic=True,
1730 generic=True,
1731 )
1731 )
1732 coreconfigitem(
1732 coreconfigitem(
1733 b'phases',
1733 b'phases',
1734 b'checksubrepos',
1734 b'checksubrepos',
1735 default=b'follow',
1735 default=b'follow',
1736 )
1736 )
1737 coreconfigitem(
1737 coreconfigitem(
1738 b'phases',
1738 b'phases',
1739 b'new-commit',
1739 b'new-commit',
1740 default=b'draft',
1740 default=b'draft',
1741 )
1741 )
1742 coreconfigitem(
1742 coreconfigitem(
1743 b'phases',
1743 b'phases',
1744 b'publish',
1744 b'publish',
1745 default=True,
1745 default=True,
1746 )
1746 )
1747 coreconfigitem(
1747 coreconfigitem(
1748 b'profiling',
1748 b'profiling',
1749 b'enabled',
1749 b'enabled',
1750 default=False,
1750 default=False,
1751 )
1751 )
1752 coreconfigitem(
1752 coreconfigitem(
1753 b'profiling',
1753 b'profiling',
1754 b'format',
1754 b'format',
1755 default=b'text',
1755 default=b'text',
1756 )
1756 )
1757 coreconfigitem(
1757 coreconfigitem(
1758 b'profiling',
1758 b'profiling',
1759 b'freq',
1759 b'freq',
1760 default=1000,
1760 default=1000,
1761 )
1761 )
1762 coreconfigitem(
1762 coreconfigitem(
1763 b'profiling',
1763 b'profiling',
1764 b'limit',
1764 b'limit',
1765 default=30,
1765 default=30,
1766 )
1766 )
1767 coreconfigitem(
1767 coreconfigitem(
1768 b'profiling',
1768 b'profiling',
1769 b'nested',
1769 b'nested',
1770 default=0,
1770 default=0,
1771 )
1771 )
1772 coreconfigitem(
1772 coreconfigitem(
1773 b'profiling',
1773 b'profiling',
1774 b'output',
1774 b'output',
1775 default=None,
1775 default=None,
1776 )
1776 )
1777 coreconfigitem(
1777 coreconfigitem(
1778 b'profiling',
1778 b'profiling',
1779 b'showmax',
1779 b'showmax',
1780 default=0.999,
1780 default=0.999,
1781 )
1781 )
1782 coreconfigitem(
1782 coreconfigitem(
1783 b'profiling',
1783 b'profiling',
1784 b'showmin',
1784 b'showmin',
1785 default=dynamicdefault,
1785 default=dynamicdefault,
1786 )
1786 )
1787 coreconfigitem(
1787 coreconfigitem(
1788 b'profiling',
1788 b'profiling',
1789 b'showtime',
1789 b'showtime',
1790 default=True,
1790 default=True,
1791 )
1791 )
1792 coreconfigitem(
1792 coreconfigitem(
1793 b'profiling',
1793 b'profiling',
1794 b'sort',
1794 b'sort',
1795 default=b'inlinetime',
1795 default=b'inlinetime',
1796 )
1796 )
1797 coreconfigitem(
1797 coreconfigitem(
1798 b'profiling',
1798 b'profiling',
1799 b'statformat',
1799 b'statformat',
1800 default=b'hotpath',
1800 default=b'hotpath',
1801 )
1801 )
1802 coreconfigitem(
1802 coreconfigitem(
1803 b'profiling',
1803 b'profiling',
1804 b'time-track',
1804 b'time-track',
1805 default=dynamicdefault,
1805 default=dynamicdefault,
1806 )
1806 )
1807 coreconfigitem(
1807 coreconfigitem(
1808 b'profiling',
1808 b'profiling',
1809 b'type',
1809 b'type',
1810 default=b'stat',
1810 default=b'stat',
1811 )
1811 )
1812 coreconfigitem(
1812 coreconfigitem(
1813 b'progress',
1813 b'progress',
1814 b'assume-tty',
1814 b'assume-tty',
1815 default=False,
1815 default=False,
1816 )
1816 )
1817 coreconfigitem(
1817 coreconfigitem(
1818 b'progress',
1818 b'progress',
1819 b'changedelay',
1819 b'changedelay',
1820 default=1,
1820 default=1,
1821 )
1821 )
1822 coreconfigitem(
1822 coreconfigitem(
1823 b'progress',
1823 b'progress',
1824 b'clear-complete',
1824 b'clear-complete',
1825 default=True,
1825 default=True,
1826 )
1826 )
1827 coreconfigitem(
1827 coreconfigitem(
1828 b'progress',
1828 b'progress',
1829 b'debug',
1829 b'debug',
1830 default=False,
1830 default=False,
1831 )
1831 )
1832 coreconfigitem(
1832 coreconfigitem(
1833 b'progress',
1833 b'progress',
1834 b'delay',
1834 b'delay',
1835 default=3,
1835 default=3,
1836 )
1836 )
1837 coreconfigitem(
1837 coreconfigitem(
1838 b'progress',
1838 b'progress',
1839 b'disable',
1839 b'disable',
1840 default=False,
1840 default=False,
1841 )
1841 )
1842 coreconfigitem(
1842 coreconfigitem(
1843 b'progress',
1843 b'progress',
1844 b'estimateinterval',
1844 b'estimateinterval',
1845 default=60.0,
1845 default=60.0,
1846 )
1846 )
1847 coreconfigitem(
1847 coreconfigitem(
1848 b'progress',
1848 b'progress',
1849 b'format',
1849 b'format',
1850 default=lambda: [b'topic', b'bar', b'number', b'estimate'],
1850 default=lambda: [b'topic', b'bar', b'number', b'estimate'],
1851 )
1851 )
1852 coreconfigitem(
1852 coreconfigitem(
1853 b'progress',
1853 b'progress',
1854 b'refresh',
1854 b'refresh',
1855 default=0.1,
1855 default=0.1,
1856 )
1856 )
1857 coreconfigitem(
1857 coreconfigitem(
1858 b'progress',
1858 b'progress',
1859 b'width',
1859 b'width',
1860 default=dynamicdefault,
1860 default=dynamicdefault,
1861 )
1861 )
1862 coreconfigitem(
1862 coreconfigitem(
1863 b'pull',
1863 b'pull',
1864 b'confirm',
1864 b'confirm',
1865 default=False,
1865 default=False,
1866 )
1866 )
1867 coreconfigitem(
1867 coreconfigitem(
1868 b'push',
1868 b'push',
1869 b'pushvars.server',
1869 b'pushvars.server',
1870 default=False,
1870 default=False,
1871 )
1871 )
1872 coreconfigitem(
1872 coreconfigitem(
1873 b'rewrite',
1873 b'rewrite',
1874 b'backup-bundle',
1874 b'backup-bundle',
1875 default=True,
1875 default=True,
1876 alias=[(b'ui', b'history-editing-backup')],
1876 alias=[(b'ui', b'history-editing-backup')],
1877 )
1877 )
1878 coreconfigitem(
1878 coreconfigitem(
1879 b'rewrite',
1879 b'rewrite',
1880 b'update-timestamp',
1880 b'update-timestamp',
1881 default=False,
1881 default=False,
1882 )
1882 )
1883 coreconfigitem(
1883 coreconfigitem(
1884 b'rewrite',
1884 b'rewrite',
1885 b'empty-successor',
1885 b'empty-successor',
1886 default=b'skip',
1886 default=b'skip',
1887 experimental=True,
1887 experimental=True,
1888 )
1888 )
1889 # experimental as long as format.exp-rc-dirstate-v2 is.
1889 # experimental as long as format.exp-rc-dirstate-v2 is.
1890 coreconfigitem(
1890 coreconfigitem(
1891 b'storage',
1891 b'storage',
1892 b'dirstate-v2.slow-path',
1892 b'dirstate-v2.slow-path',
1893 default=b"abort",
1893 default=b"abort",
1894 experimental=True,
1894 experimental=True,
1895 )
1895 )
1896 coreconfigitem(
1896 coreconfigitem(
1897 b'storage',
1897 b'storage',
1898 b'new-repo-backend',
1898 b'new-repo-backend',
1899 default=b'revlogv1',
1899 default=b'revlogv1',
1900 experimental=True,
1900 experimental=True,
1901 )
1901 )
1902 coreconfigitem(
1902 coreconfigitem(
1903 b'storage',
1903 b'storage',
1904 b'revlog.optimize-delta-parent-choice',
1904 b'revlog.optimize-delta-parent-choice',
1905 default=True,
1905 default=True,
1906 alias=[(b'format', b'aggressivemergedeltas')],
1906 alias=[(b'format', b'aggressivemergedeltas')],
1907 )
1907 )
1908 coreconfigitem(
1908 coreconfigitem(
1909 b'storage',
1909 b'storage',
1910 b'revlog.issue6528.fix-incoming',
1910 b'revlog.issue6528.fix-incoming',
1911 default=True,
1911 default=True,
1912 )
1912 )
1913 # experimental as long as rust is experimental (or a C version is implemented)
1913 # experimental as long as rust is experimental (or a C version is implemented)
1914 coreconfigitem(
1914 coreconfigitem(
1915 b'storage',
1915 b'storage',
1916 b'revlog.persistent-nodemap.mmap',
1916 b'revlog.persistent-nodemap.mmap',
1917 default=True,
1917 default=True,
1918 )
1918 )
1919 # experimental as long as format.use-persistent-nodemap is.
1919 # experimental as long as format.use-persistent-nodemap is.
1920 coreconfigitem(
1920 coreconfigitem(
1921 b'storage',
1921 b'storage',
1922 b'revlog.persistent-nodemap.slow-path',
1922 b'revlog.persistent-nodemap.slow-path',
1923 default=b"abort",
1923 default=b"abort",
1924 )
1924 )
1925
1925
1926 coreconfigitem(
1926 coreconfigitem(
1927 b'storage',
1927 b'storage',
1928 b'revlog.reuse-external-delta',
1928 b'revlog.reuse-external-delta',
1929 default=True,
1929 default=True,
1930 )
1930 )
1931 coreconfigitem(
1931 coreconfigitem(
1932 b'storage',
1932 b'storage',
1933 b'revlog.reuse-external-delta-parent',
1933 b'revlog.reuse-external-delta-parent',
1934 default=None,
1934 default=None,
1935 )
1935 )
1936 coreconfigitem(
1936 coreconfigitem(
1937 b'storage',
1937 b'storage',
1938 b'revlog.zlib.level',
1938 b'revlog.zlib.level',
1939 default=None,
1939 default=None,
1940 )
1940 )
1941 coreconfigitem(
1941 coreconfigitem(
1942 b'storage',
1942 b'storage',
1943 b'revlog.zstd.level',
1943 b'revlog.zstd.level',
1944 default=None,
1944 default=None,
1945 )
1945 )
1946 coreconfigitem(
1946 coreconfigitem(
1947 b'server',
1947 b'server',
1948 b'bookmarks-pushkey-compat',
1948 b'bookmarks-pushkey-compat',
1949 default=True,
1949 default=True,
1950 )
1950 )
1951 coreconfigitem(
1951 coreconfigitem(
1952 b'server',
1952 b'server',
1953 b'bundle1',
1953 b'bundle1',
1954 default=True,
1954 default=True,
1955 )
1955 )
1956 coreconfigitem(
1956 coreconfigitem(
1957 b'server',
1957 b'server',
1958 b'bundle1gd',
1958 b'bundle1gd',
1959 default=None,
1959 default=None,
1960 )
1960 )
1961 coreconfigitem(
1961 coreconfigitem(
1962 b'server',
1962 b'server',
1963 b'bundle1.pull',
1963 b'bundle1.pull',
1964 default=None,
1964 default=None,
1965 )
1965 )
1966 coreconfigitem(
1966 coreconfigitem(
1967 b'server',
1967 b'server',
1968 b'bundle1gd.pull',
1968 b'bundle1gd.pull',
1969 default=None,
1969 default=None,
1970 )
1970 )
1971 coreconfigitem(
1971 coreconfigitem(
1972 b'server',
1972 b'server',
1973 b'bundle1.push',
1973 b'bundle1.push',
1974 default=None,
1974 default=None,
1975 )
1975 )
1976 coreconfigitem(
1976 coreconfigitem(
1977 b'server',
1977 b'server',
1978 b'bundle1gd.push',
1978 b'bundle1gd.push',
1979 default=None,
1979 default=None,
1980 )
1980 )
1981 coreconfigitem(
1981 coreconfigitem(
1982 b'server',
1982 b'server',
1983 b'bundle2.stream',
1983 b'bundle2.stream',
1984 default=True,
1984 default=True,
1985 alias=[(b'experimental', b'bundle2.stream')],
1985 alias=[(b'experimental', b'bundle2.stream')],
1986 )
1986 )
1987 coreconfigitem(
1987 coreconfigitem(
1988 b'server',
1988 b'server',
1989 b'compressionengines',
1989 b'compressionengines',
1990 default=list,
1990 default=list,
1991 )
1991 )
1992 coreconfigitem(
1992 coreconfigitem(
1993 b'server',
1993 b'server',
1994 b'concurrent-push-mode',
1994 b'concurrent-push-mode',
1995 default=b'check-related',
1995 default=b'check-related',
1996 )
1996 )
1997 coreconfigitem(
1997 coreconfigitem(
1998 b'server',
1998 b'server',
1999 b'disablefullbundle',
1999 b'disablefullbundle',
2000 default=False,
2000 default=False,
2001 )
2001 )
2002 coreconfigitem(
2002 coreconfigitem(
2003 b'server',
2003 b'server',
2004 b'maxhttpheaderlen',
2004 b'maxhttpheaderlen',
2005 default=1024,
2005 default=1024,
2006 )
2006 )
2007 coreconfigitem(
2007 coreconfigitem(
2008 b'server',
2008 b'server',
2009 b'pullbundle',
2009 b'pullbundle',
2010 default=False,
2010 default=False,
2011 )
2011 )
2012 coreconfigitem(
2012 coreconfigitem(
2013 b'server',
2013 b'server',
2014 b'preferuncompressed',
2014 b'preferuncompressed',
2015 default=False,
2015 default=False,
2016 )
2016 )
2017 coreconfigitem(
2017 coreconfigitem(
2018 b'server',
2018 b'server',
2019 b'streamunbundle',
2019 b'streamunbundle',
2020 default=False,
2020 default=False,
2021 )
2021 )
2022 coreconfigitem(
2022 coreconfigitem(
2023 b'server',
2023 b'server',
2024 b'uncompressed',
2024 b'uncompressed',
2025 default=True,
2025 default=True,
2026 )
2026 )
2027 coreconfigitem(
2027 coreconfigitem(
2028 b'server',
2028 b'server',
2029 b'uncompressedallowsecret',
2029 b'uncompressedallowsecret',
2030 default=False,
2030 default=False,
2031 )
2031 )
2032 coreconfigitem(
2032 coreconfigitem(
2033 b'server',
2033 b'server',
2034 b'view',
2034 b'view',
2035 default=b'served',
2035 default=b'served',
2036 )
2036 )
2037 coreconfigitem(
2037 coreconfigitem(
2038 b'server',
2038 b'server',
2039 b'validate',
2039 b'validate',
2040 default=False,
2040 default=False,
2041 )
2041 )
2042 coreconfigitem(
2042 coreconfigitem(
2043 b'server',
2043 b'server',
2044 b'zliblevel',
2044 b'zliblevel',
2045 default=-1,
2045 default=-1,
2046 )
2046 )
2047 coreconfigitem(
2047 coreconfigitem(
2048 b'server',
2048 b'server',
2049 b'zstdlevel',
2049 b'zstdlevel',
2050 default=3,
2050 default=3,
2051 )
2051 )
2052 coreconfigitem(
2052 coreconfigitem(
2053 b'share',
2053 b'share',
2054 b'pool',
2054 b'pool',
2055 default=None,
2055 default=None,
2056 )
2056 )
2057 coreconfigitem(
2057 coreconfigitem(
2058 b'share',
2058 b'share',
2059 b'poolnaming',
2059 b'poolnaming',
2060 default=b'identity',
2060 default=b'identity',
2061 )
2061 )
2062 coreconfigitem(
2062 coreconfigitem(
2063 b'share',
2063 b'share',
2064 b'safe-mismatch.source-not-safe',
2064 b'safe-mismatch.source-not-safe',
2065 default=b'abort',
2065 default=b'abort',
2066 )
2066 )
2067 coreconfigitem(
2067 coreconfigitem(
2068 b'share',
2068 b'share',
2069 b'safe-mismatch.source-safe',
2069 b'safe-mismatch.source-safe',
2070 default=b'abort',
2070 default=b'abort',
2071 )
2071 )
2072 coreconfigitem(
2072 coreconfigitem(
2073 b'share',
2073 b'share',
2074 b'safe-mismatch.source-not-safe.warn',
2074 b'safe-mismatch.source-not-safe.warn',
2075 default=True,
2075 default=True,
2076 )
2076 )
2077 coreconfigitem(
2077 coreconfigitem(
2078 b'share',
2078 b'share',
2079 b'safe-mismatch.source-safe.warn',
2079 b'safe-mismatch.source-safe.warn',
2080 default=True,
2080 default=True,
2081 )
2081 )
2082 coreconfigitem(
2082 coreconfigitem(
2083 b'shelve',
2083 b'shelve',
2084 b'maxbackups',
2084 b'maxbackups',
2085 default=10,
2085 default=10,
2086 )
2086 )
2087 coreconfigitem(
2087 coreconfigitem(
2088 b'smtp',
2088 b'smtp',
2089 b'host',
2089 b'host',
2090 default=None,
2090 default=None,
2091 )
2091 )
2092 coreconfigitem(
2092 coreconfigitem(
2093 b'smtp',
2093 b'smtp',
2094 b'local_hostname',
2094 b'local_hostname',
2095 default=None,
2095 default=None,
2096 )
2096 )
2097 coreconfigitem(
2097 coreconfigitem(
2098 b'smtp',
2098 b'smtp',
2099 b'password',
2099 b'password',
2100 default=None,
2100 default=None,
2101 )
2101 )
2102 coreconfigitem(
2102 coreconfigitem(
2103 b'smtp',
2103 b'smtp',
2104 b'port',
2104 b'port',
2105 default=dynamicdefault,
2105 default=dynamicdefault,
2106 )
2106 )
2107 coreconfigitem(
2107 coreconfigitem(
2108 b'smtp',
2108 b'smtp',
2109 b'tls',
2109 b'tls',
2110 default=b'none',
2110 default=b'none',
2111 )
2111 )
2112 coreconfigitem(
2112 coreconfigitem(
2113 b'smtp',
2113 b'smtp',
2114 b'username',
2114 b'username',
2115 default=None,
2115 default=None,
2116 )
2116 )
2117 coreconfigitem(
2117 coreconfigitem(
2118 b'sparse',
2118 b'sparse',
2119 b'missingwarning',
2119 b'missingwarning',
2120 default=True,
2120 default=True,
2121 experimental=True,
2121 experimental=True,
2122 )
2122 )
2123 coreconfigitem(
2123 coreconfigitem(
2124 b'subrepos',
2124 b'subrepos',
2125 b'allowed',
2125 b'allowed',
2126 default=dynamicdefault, # to make backporting simpler
2126 default=dynamicdefault, # to make backporting simpler
2127 )
2127 )
2128 coreconfigitem(
2128 coreconfigitem(
2129 b'subrepos',
2129 b'subrepos',
2130 b'hg:allowed',
2130 b'hg:allowed',
2131 default=dynamicdefault,
2131 default=dynamicdefault,
2132 )
2132 )
2133 coreconfigitem(
2133 coreconfigitem(
2134 b'subrepos',
2134 b'subrepos',
2135 b'git:allowed',
2135 b'git:allowed',
2136 default=dynamicdefault,
2136 default=dynamicdefault,
2137 )
2137 )
2138 coreconfigitem(
2138 coreconfigitem(
2139 b'subrepos',
2139 b'subrepos',
2140 b'svn:allowed',
2140 b'svn:allowed',
2141 default=dynamicdefault,
2141 default=dynamicdefault,
2142 )
2142 )
2143 coreconfigitem(
2143 coreconfigitem(
2144 b'templates',
2144 b'templates',
2145 b'.*',
2145 b'.*',
2146 default=None,
2146 default=None,
2147 generic=True,
2147 generic=True,
2148 )
2148 )
2149 coreconfigitem(
2149 coreconfigitem(
2150 b'templateconfig',
2150 b'templateconfig',
2151 b'.*',
2151 b'.*',
2152 default=dynamicdefault,
2152 default=dynamicdefault,
2153 generic=True,
2153 generic=True,
2154 )
2154 )
2155 coreconfigitem(
2155 coreconfigitem(
2156 b'trusted',
2156 b'trusted',
2157 b'groups',
2157 b'groups',
2158 default=list,
2158 default=list,
2159 )
2159 )
2160 coreconfigitem(
2160 coreconfigitem(
2161 b'trusted',
2161 b'trusted',
2162 b'users',
2162 b'users',
2163 default=list,
2163 default=list,
2164 )
2164 )
2165 coreconfigitem(
2165 coreconfigitem(
2166 b'ui',
2166 b'ui',
2167 b'_usedassubrepo',
2167 b'_usedassubrepo',
2168 default=False,
2168 default=False,
2169 )
2169 )
2170 coreconfigitem(
2170 coreconfigitem(
2171 b'ui',
2171 b'ui',
2172 b'allowemptycommit',
2172 b'allowemptycommit',
2173 default=False,
2173 default=False,
2174 )
2174 )
2175 coreconfigitem(
2175 coreconfigitem(
2176 b'ui',
2176 b'ui',
2177 b'archivemeta',
2177 b'archivemeta',
2178 default=True,
2178 default=True,
2179 )
2179 )
2180 coreconfigitem(
2180 coreconfigitem(
2181 b'ui',
2181 b'ui',
2182 b'askusername',
2182 b'askusername',
2183 default=False,
2183 default=False,
2184 )
2184 )
2185 coreconfigitem(
2185 coreconfigitem(
2186 b'ui',
2186 b'ui',
2187 b'available-memory',
2187 b'available-memory',
2188 default=None,
2188 default=None,
2189 )
2189 )
2190
2190
2191 coreconfigitem(
2191 coreconfigitem(
2192 b'ui',
2192 b'ui',
2193 b'clonebundlefallback',
2193 b'clonebundlefallback',
2194 default=False,
2194 default=False,
2195 )
2195 )
2196 coreconfigitem(
2196 coreconfigitem(
2197 b'ui',
2197 b'ui',
2198 b'clonebundleprefers',
2198 b'clonebundleprefers',
2199 default=list,
2199 default=list,
2200 )
2200 )
2201 coreconfigitem(
2201 coreconfigitem(
2202 b'ui',
2202 b'ui',
2203 b'clonebundles',
2203 b'clonebundles',
2204 default=True,
2204 default=True,
2205 )
2205 )
2206 coreconfigitem(
2206 coreconfigitem(
2207 b'ui',
2207 b'ui',
2208 b'color',
2208 b'color',
2209 default=b'auto',
2209 default=b'auto',
2210 )
2210 )
2211 coreconfigitem(
2211 coreconfigitem(
2212 b'ui',
2212 b'ui',
2213 b'commitsubrepos',
2213 b'commitsubrepos',
2214 default=False,
2214 default=False,
2215 )
2215 )
2216 coreconfigitem(
2216 coreconfigitem(
2217 b'ui',
2217 b'ui',
2218 b'debug',
2218 b'debug',
2219 default=False,
2219 default=False,
2220 )
2220 )
2221 coreconfigitem(
2221 coreconfigitem(
2222 b'ui',
2222 b'ui',
2223 b'debugger',
2223 b'debugger',
2224 default=None,
2224 default=None,
2225 )
2225 )
2226 coreconfigitem(
2226 coreconfigitem(
2227 b'ui',
2227 b'ui',
2228 b'editor',
2228 b'editor',
2229 default=dynamicdefault,
2229 default=dynamicdefault,
2230 )
2230 )
2231 coreconfigitem(
2231 coreconfigitem(
2232 b'ui',
2232 b'ui',
2233 b'detailed-exit-code',
2233 b'detailed-exit-code',
2234 default=False,
2234 default=False,
2235 experimental=True,
2235 experimental=True,
2236 )
2236 )
2237 coreconfigitem(
2237 coreconfigitem(
2238 b'ui',
2238 b'ui',
2239 b'fallbackencoding',
2239 b'fallbackencoding',
2240 default=None,
2240 default=None,
2241 )
2241 )
2242 coreconfigitem(
2242 coreconfigitem(
2243 b'ui',
2243 b'ui',
2244 b'forcecwd',
2244 b'forcecwd',
2245 default=None,
2245 default=None,
2246 )
2246 )
2247 coreconfigitem(
2247 coreconfigitem(
2248 b'ui',
2248 b'ui',
2249 b'forcemerge',
2249 b'forcemerge',
2250 default=None,
2250 default=None,
2251 )
2251 )
2252 coreconfigitem(
2252 coreconfigitem(
2253 b'ui',
2253 b'ui',
2254 b'formatdebug',
2254 b'formatdebug',
2255 default=False,
2255 default=False,
2256 )
2256 )
2257 coreconfigitem(
2257 coreconfigitem(
2258 b'ui',
2258 b'ui',
2259 b'formatjson',
2259 b'formatjson',
2260 default=False,
2260 default=False,
2261 )
2261 )
2262 coreconfigitem(
2262 coreconfigitem(
2263 b'ui',
2263 b'ui',
2264 b'formatted',
2264 b'formatted',
2265 default=None,
2265 default=None,
2266 )
2266 )
2267 coreconfigitem(
2267 coreconfigitem(
2268 b'ui',
2268 b'ui',
2269 b'interactive',
2269 b'interactive',
2270 default=None,
2270 default=None,
2271 )
2271 )
2272 coreconfigitem(
2272 coreconfigitem(
2273 b'ui',
2273 b'ui',
2274 b'interface',
2274 b'interface',
2275 default=None,
2275 default=None,
2276 )
2276 )
2277 coreconfigitem(
2277 coreconfigitem(
2278 b'ui',
2278 b'ui',
2279 b'interface.chunkselector',
2279 b'interface.chunkselector',
2280 default=None,
2280 default=None,
2281 )
2281 )
2282 coreconfigitem(
2282 coreconfigitem(
2283 b'ui',
2283 b'ui',
2284 b'large-file-limit',
2284 b'large-file-limit',
2285 default=10000000,
2285 default=10000000,
2286 )
2286 )
2287 coreconfigitem(
2287 coreconfigitem(
2288 b'ui',
2288 b'ui',
2289 b'logblockedtimes',
2289 b'logblockedtimes',
2290 default=False,
2290 default=False,
2291 )
2291 )
2292 coreconfigitem(
2292 coreconfigitem(
2293 b'ui',
2293 b'ui',
2294 b'merge',
2294 b'merge',
2295 default=None,
2295 default=None,
2296 )
2296 )
2297 coreconfigitem(
2297 coreconfigitem(
2298 b'ui',
2298 b'ui',
2299 b'mergemarkers',
2299 b'mergemarkers',
2300 default=b'basic',
2300 default=b'basic',
2301 )
2301 )
2302 coreconfigitem(
2302 coreconfigitem(
2303 b'ui',
2303 b'ui',
2304 b'message-output',
2304 b'message-output',
2305 default=b'stdio',
2305 default=b'stdio',
2306 )
2306 )
2307 coreconfigitem(
2307 coreconfigitem(
2308 b'ui',
2308 b'ui',
2309 b'nontty',
2309 b'nontty',
2310 default=False,
2310 default=False,
2311 )
2311 )
2312 coreconfigitem(
2312 coreconfigitem(
2313 b'ui',
2313 b'ui',
2314 b'origbackuppath',
2314 b'origbackuppath',
2315 default=None,
2315 default=None,
2316 )
2316 )
2317 coreconfigitem(
2317 coreconfigitem(
2318 b'ui',
2318 b'ui',
2319 b'paginate',
2319 b'paginate',
2320 default=True,
2320 default=True,
2321 )
2321 )
2322 coreconfigitem(
2322 coreconfigitem(
2323 b'ui',
2323 b'ui',
2324 b'patch',
2324 b'patch',
2325 default=None,
2325 default=None,
2326 )
2326 )
2327 coreconfigitem(
2327 coreconfigitem(
2328 b'ui',
2328 b'ui',
2329 b'portablefilenames',
2329 b'portablefilenames',
2330 default=b'warn',
2330 default=b'warn',
2331 )
2331 )
2332 coreconfigitem(
2332 coreconfigitem(
2333 b'ui',
2333 b'ui',
2334 b'promptecho',
2334 b'promptecho',
2335 default=False,
2335 default=False,
2336 )
2336 )
2337 coreconfigitem(
2337 coreconfigitem(
2338 b'ui',
2338 b'ui',
2339 b'quiet',
2339 b'quiet',
2340 default=False,
2340 default=False,
2341 )
2341 )
2342 coreconfigitem(
2342 coreconfigitem(
2343 b'ui',
2343 b'ui',
2344 b'quietbookmarkmove',
2344 b'quietbookmarkmove',
2345 default=False,
2345 default=False,
2346 )
2346 )
2347 coreconfigitem(
2347 coreconfigitem(
2348 b'ui',
2348 b'ui',
2349 b'relative-paths',
2349 b'relative-paths',
2350 default=b'legacy',
2350 default=b'legacy',
2351 )
2351 )
2352 coreconfigitem(
2352 coreconfigitem(
2353 b'ui',
2353 b'ui',
2354 b'remotecmd',
2354 b'remotecmd',
2355 default=b'hg',
2355 default=b'hg',
2356 )
2356 )
2357 coreconfigitem(
2357 coreconfigitem(
2358 b'ui',
2358 b'ui',
2359 b'report_untrusted',
2359 b'report_untrusted',
2360 default=True,
2360 default=True,
2361 )
2361 )
2362 coreconfigitem(
2362 coreconfigitem(
2363 b'ui',
2363 b'ui',
2364 b'rollback',
2364 b'rollback',
2365 default=True,
2365 default=True,
2366 )
2366 )
2367 coreconfigitem(
2367 coreconfigitem(
2368 b'ui',
2368 b'ui',
2369 b'signal-safe-lock',
2369 b'signal-safe-lock',
2370 default=True,
2370 default=True,
2371 )
2371 )
2372 coreconfigitem(
2372 coreconfigitem(
2373 b'ui',
2373 b'ui',
2374 b'slash',
2374 b'slash',
2375 default=False,
2375 default=False,
2376 )
2376 )
2377 coreconfigitem(
2377 coreconfigitem(
2378 b'ui',
2378 b'ui',
2379 b'ssh',
2379 b'ssh',
2380 default=b'ssh',
2380 default=b'ssh',
2381 )
2381 )
2382 coreconfigitem(
2382 coreconfigitem(
2383 b'ui',
2383 b'ui',
2384 b'ssherrorhint',
2384 b'ssherrorhint',
2385 default=None,
2385 default=None,
2386 )
2386 )
2387 coreconfigitem(
2387 coreconfigitem(
2388 b'ui',
2388 b'ui',
2389 b'statuscopies',
2389 b'statuscopies',
2390 default=False,
2390 default=False,
2391 )
2391 )
2392 coreconfigitem(
2392 coreconfigitem(
2393 b'ui',
2393 b'ui',
2394 b'strict',
2394 b'strict',
2395 default=False,
2395 default=False,
2396 )
2396 )
2397 coreconfigitem(
2397 coreconfigitem(
2398 b'ui',
2398 b'ui',
2399 b'style',
2399 b'style',
2400 default=b'',
2400 default=b'',
2401 )
2401 )
2402 coreconfigitem(
2402 coreconfigitem(
2403 b'ui',
2403 b'ui',
2404 b'supportcontact',
2404 b'supportcontact',
2405 default=None,
2405 default=None,
2406 )
2406 )
2407 coreconfigitem(
2407 coreconfigitem(
2408 b'ui',
2408 b'ui',
2409 b'textwidth',
2409 b'textwidth',
2410 default=78,
2410 default=78,
2411 )
2411 )
2412 coreconfigitem(
2412 coreconfigitem(
2413 b'ui',
2413 b'ui',
2414 b'timeout',
2414 b'timeout',
2415 default=b'600',
2415 default=b'600',
2416 )
2416 )
2417 coreconfigitem(
2417 coreconfigitem(
2418 b'ui',
2418 b'ui',
2419 b'timeout.warn',
2419 b'timeout.warn',
2420 default=0,
2420 default=0,
2421 )
2421 )
2422 coreconfigitem(
2422 coreconfigitem(
2423 b'ui',
2423 b'ui',
2424 b'timestamp-output',
2424 b'timestamp-output',
2425 default=False,
2425 default=False,
2426 )
2426 )
2427 coreconfigitem(
2427 coreconfigitem(
2428 b'ui',
2428 b'ui',
2429 b'traceback',
2429 b'traceback',
2430 default=False,
2430 default=False,
2431 )
2431 )
2432 coreconfigitem(
2432 coreconfigitem(
2433 b'ui',
2433 b'ui',
2434 b'tweakdefaults',
2434 b'tweakdefaults',
2435 default=False,
2435 default=False,
2436 )
2436 )
2437 coreconfigitem(b'ui', b'username', alias=[(b'ui', b'user')])
2437 coreconfigitem(b'ui', b'username', alias=[(b'ui', b'user')])
2438 coreconfigitem(
2438 coreconfigitem(
2439 b'ui',
2439 b'ui',
2440 b'verbose',
2440 b'verbose',
2441 default=False,
2441 default=False,
2442 )
2442 )
2443 coreconfigitem(
2443 coreconfigitem(
2444 b'verify',
2444 b'verify',
2445 b'skipflags',
2445 b'skipflags',
2446 default=None,
2446 default=None,
2447 )
2447 )
2448 coreconfigitem(
2448 coreconfigitem(
2449 b'web',
2449 b'web',
2450 b'allowbz2',
2450 b'allowbz2',
2451 default=False,
2451 default=False,
2452 )
2452 )
2453 coreconfigitem(
2453 coreconfigitem(
2454 b'web',
2454 b'web',
2455 b'allowgz',
2455 b'allowgz',
2456 default=False,
2456 default=False,
2457 )
2457 )
2458 coreconfigitem(
2458 coreconfigitem(
2459 b'web',
2459 b'web',
2460 b'allow-pull',
2460 b'allow-pull',
2461 alias=[(b'web', b'allowpull')],
2461 alias=[(b'web', b'allowpull')],
2462 default=True,
2462 default=True,
2463 )
2463 )
2464 coreconfigitem(
2464 coreconfigitem(
2465 b'web',
2465 b'web',
2466 b'allow-push',
2466 b'allow-push',
2467 alias=[(b'web', b'allow_push')],
2467 alias=[(b'web', b'allow_push')],
2468 default=list,
2468 default=list,
2469 )
2469 )
2470 coreconfigitem(
2470 coreconfigitem(
2471 b'web',
2471 b'web',
2472 b'allowzip',
2472 b'allowzip',
2473 default=False,
2473 default=False,
2474 )
2474 )
2475 coreconfigitem(
2475 coreconfigitem(
2476 b'web',
2476 b'web',
2477 b'archivesubrepos',
2477 b'archivesubrepos',
2478 default=False,
2478 default=False,
2479 )
2479 )
2480 coreconfigitem(
2480 coreconfigitem(
2481 b'web',
2481 b'web',
2482 b'cache',
2482 b'cache',
2483 default=True,
2483 default=True,
2484 )
2484 )
2485 coreconfigitem(
2485 coreconfigitem(
2486 b'web',
2486 b'web',
2487 b'comparisoncontext',
2487 b'comparisoncontext',
2488 default=5,
2488 default=5,
2489 )
2489 )
2490 coreconfigitem(
2490 coreconfigitem(
2491 b'web',
2491 b'web',
2492 b'contact',
2492 b'contact',
2493 default=None,
2493 default=None,
2494 )
2494 )
2495 coreconfigitem(
2495 coreconfigitem(
2496 b'web',
2496 b'web',
2497 b'deny_push',
2497 b'deny_push',
2498 default=list,
2498 default=list,
2499 )
2499 )
2500 coreconfigitem(
2500 coreconfigitem(
2501 b'web',
2501 b'web',
2502 b'guessmime',
2502 b'guessmime',
2503 default=False,
2503 default=False,
2504 )
2504 )
2505 coreconfigitem(
2505 coreconfigitem(
2506 b'web',
2506 b'web',
2507 b'hidden',
2507 b'hidden',
2508 default=False,
2508 default=False,
2509 )
2509 )
2510 coreconfigitem(
2510 coreconfigitem(
2511 b'web',
2511 b'web',
2512 b'labels',
2512 b'labels',
2513 default=list,
2513 default=list,
2514 )
2514 )
2515 coreconfigitem(
2515 coreconfigitem(
2516 b'web',
2516 b'web',
2517 b'logoimg',
2517 b'logoimg',
2518 default=b'hglogo.png',
2518 default=b'hglogo.png',
2519 )
2519 )
2520 coreconfigitem(
2520 coreconfigitem(
2521 b'web',
2521 b'web',
2522 b'logourl',
2522 b'logourl',
2523 default=b'https://mercurial-scm.org/',
2523 default=b'https://mercurial-scm.org/',
2524 )
2524 )
2525 coreconfigitem(
2525 coreconfigitem(
2526 b'web',
2526 b'web',
2527 b'accesslog',
2527 b'accesslog',
2528 default=b'-',
2528 default=b'-',
2529 )
2529 )
2530 coreconfigitem(
2530 coreconfigitem(
2531 b'web',
2531 b'web',
2532 b'address',
2532 b'address',
2533 default=b'',
2533 default=b'',
2534 )
2534 )
2535 coreconfigitem(
2535 coreconfigitem(
2536 b'web',
2536 b'web',
2537 b'allow-archive',
2537 b'allow-archive',
2538 alias=[(b'web', b'allow_archive')],
2538 alias=[(b'web', b'allow_archive')],
2539 default=list,
2539 default=list,
2540 )
2540 )
2541 coreconfigitem(
2541 coreconfigitem(
2542 b'web',
2542 b'web',
2543 b'allow_read',
2543 b'allow_read',
2544 default=list,
2544 default=list,
2545 )
2545 )
2546 coreconfigitem(
2546 coreconfigitem(
2547 b'web',
2547 b'web',
2548 b'baseurl',
2548 b'baseurl',
2549 default=None,
2549 default=None,
2550 )
2550 )
2551 coreconfigitem(
2551 coreconfigitem(
2552 b'web',
2552 b'web',
2553 b'cacerts',
2553 b'cacerts',
2554 default=None,
2554 default=None,
2555 )
2555 )
2556 coreconfigitem(
2556 coreconfigitem(
2557 b'web',
2557 b'web',
2558 b'certificate',
2558 b'certificate',
2559 default=None,
2559 default=None,
2560 )
2560 )
2561 coreconfigitem(
2561 coreconfigitem(
2562 b'web',
2562 b'web',
2563 b'collapse',
2563 b'collapse',
2564 default=False,
2564 default=False,
2565 )
2565 )
2566 coreconfigitem(
2566 coreconfigitem(
2567 b'web',
2567 b'web',
2568 b'csp',
2568 b'csp',
2569 default=None,
2569 default=None,
2570 )
2570 )
2571 coreconfigitem(
2571 coreconfigitem(
2572 b'web',
2572 b'web',
2573 b'deny_read',
2573 b'deny_read',
2574 default=list,
2574 default=list,
2575 )
2575 )
2576 coreconfigitem(
2576 coreconfigitem(
2577 b'web',
2577 b'web',
2578 b'descend',
2578 b'descend',
2579 default=True,
2579 default=True,
2580 )
2580 )
2581 coreconfigitem(
2581 coreconfigitem(
2582 b'web',
2582 b'web',
2583 b'description',
2583 b'description',
2584 default=b"",
2584 default=b"",
2585 )
2585 )
2586 coreconfigitem(
2586 coreconfigitem(
2587 b'web',
2587 b'web',
2588 b'encoding',
2588 b'encoding',
2589 default=lambda: encoding.encoding,
2589 default=lambda: encoding.encoding,
2590 )
2590 )
2591 coreconfigitem(
2591 coreconfigitem(
2592 b'web',
2592 b'web',
2593 b'errorlog',
2593 b'errorlog',
2594 default=b'-',
2594 default=b'-',
2595 )
2595 )
2596 coreconfigitem(
2596 coreconfigitem(
2597 b'web',
2597 b'web',
2598 b'ipv6',
2598 b'ipv6',
2599 default=False,
2599 default=False,
2600 )
2600 )
2601 coreconfigitem(
2601 coreconfigitem(
2602 b'web',
2602 b'web',
2603 b'maxchanges',
2603 b'maxchanges',
2604 default=10,
2604 default=10,
2605 )
2605 )
2606 coreconfigitem(
2606 coreconfigitem(
2607 b'web',
2607 b'web',
2608 b'maxfiles',
2608 b'maxfiles',
2609 default=10,
2609 default=10,
2610 )
2610 )
2611 coreconfigitem(
2611 coreconfigitem(
2612 b'web',
2612 b'web',
2613 b'maxshortchanges',
2613 b'maxshortchanges',
2614 default=60,
2614 default=60,
2615 )
2615 )
2616 coreconfigitem(
2616 coreconfigitem(
2617 b'web',
2617 b'web',
2618 b'motd',
2618 b'motd',
2619 default=b'',
2619 default=b'',
2620 )
2620 )
2621 coreconfigitem(
2621 coreconfigitem(
2622 b'web',
2622 b'web',
2623 b'name',
2623 b'name',
2624 default=dynamicdefault,
2624 default=dynamicdefault,
2625 )
2625 )
2626 coreconfigitem(
2626 coreconfigitem(
2627 b'web',
2627 b'web',
2628 b'port',
2628 b'port',
2629 default=8000,
2629 default=8000,
2630 )
2630 )
2631 coreconfigitem(
2631 coreconfigitem(
2632 b'web',
2632 b'web',
2633 b'prefix',
2633 b'prefix',
2634 default=b'',
2634 default=b'',
2635 )
2635 )
2636 coreconfigitem(
2636 coreconfigitem(
2637 b'web',
2637 b'web',
2638 b'push_ssl',
2638 b'push_ssl',
2639 default=True,
2639 default=True,
2640 )
2640 )
2641 coreconfigitem(
2641 coreconfigitem(
2642 b'web',
2642 b'web',
2643 b'refreshinterval',
2643 b'refreshinterval',
2644 default=20,
2644 default=20,
2645 )
2645 )
2646 coreconfigitem(
2646 coreconfigitem(
2647 b'web',
2647 b'web',
2648 b'server-header',
2648 b'server-header',
2649 default=None,
2649 default=None,
2650 )
2650 )
2651 coreconfigitem(
2651 coreconfigitem(
2652 b'web',
2652 b'web',
2653 b'static',
2653 b'static',
2654 default=None,
2654 default=None,
2655 )
2655 )
2656 coreconfigitem(
2656 coreconfigitem(
2657 b'web',
2657 b'web',
2658 b'staticurl',
2658 b'staticurl',
2659 default=None,
2659 default=None,
2660 )
2660 )
2661 coreconfigitem(
2661 coreconfigitem(
2662 b'web',
2662 b'web',
2663 b'stripes',
2663 b'stripes',
2664 default=1,
2664 default=1,
2665 )
2665 )
2666 coreconfigitem(
2666 coreconfigitem(
2667 b'web',
2667 b'web',
2668 b'style',
2668 b'style',
2669 default=b'paper',
2669 default=b'paper',
2670 )
2670 )
2671 coreconfigitem(
2671 coreconfigitem(
2672 b'web',
2672 b'web',
2673 b'templates',
2673 b'templates',
2674 default=None,
2674 default=None,
2675 )
2675 )
2676 coreconfigitem(
2676 coreconfigitem(
2677 b'web',
2677 b'web',
2678 b'view',
2678 b'view',
2679 default=b'served',
2679 default=b'served',
2680 experimental=True,
2680 experimental=True,
2681 )
2681 )
2682 coreconfigitem(
2682 coreconfigitem(
2683 b'worker',
2683 b'worker',
2684 b'backgroundclose',
2684 b'backgroundclose',
2685 default=dynamicdefault,
2685 default=dynamicdefault,
2686 )
2686 )
2687 # Windows defaults to a limit of 512 open files. A buffer of 128
2687 # Windows defaults to a limit of 512 open files. A buffer of 128
2688 # should give us enough headway.
2688 # should give us enough headway.
2689 coreconfigitem(
2689 coreconfigitem(
2690 b'worker',
2690 b'worker',
2691 b'backgroundclosemaxqueue',
2691 b'backgroundclosemaxqueue',
2692 default=384,
2692 default=384,
2693 )
2693 )
2694 coreconfigitem(
2694 coreconfigitem(
2695 b'worker',
2695 b'worker',
2696 b'backgroundcloseminfilecount',
2696 b'backgroundcloseminfilecount',
2697 default=2048,
2697 default=2048,
2698 )
2698 )
2699 coreconfigitem(
2699 coreconfigitem(
2700 b'worker',
2700 b'worker',
2701 b'backgroundclosethreadcount',
2701 b'backgroundclosethreadcount',
2702 default=4,
2702 default=4,
2703 )
2703 )
2704 coreconfigitem(
2704 coreconfigitem(
2705 b'worker',
2705 b'worker',
2706 b'enabled',
2706 b'enabled',
2707 default=True,
2707 default=True,
2708 )
2708 )
2709 coreconfigitem(
2709 coreconfigitem(
2710 b'worker',
2710 b'worker',
2711 b'numcpus',
2711 b'numcpus',
2712 default=None,
2712 default=None,
2713 )
2713 )
2714
2714
2715 # Rebase related configuration moved to core because other extension are doing
2715 # Rebase related configuration moved to core because other extension are doing
2716 # strange things. For example, shelve import the extensions to reuse some bit
2716 # strange things. For example, shelve import the extensions to reuse some bit
2717 # without formally loading it.
2717 # without formally loading it.
2718 coreconfigitem(
2718 coreconfigitem(
2719 b'commands',
2719 b'commands',
2720 b'rebase.requiredest',
2720 b'rebase.requiredest',
2721 default=False,
2721 default=False,
2722 )
2722 )
2723 coreconfigitem(
2723 coreconfigitem(
2724 b'experimental',
2724 b'experimental',
2725 b'rebaseskipobsolete',
2725 b'rebaseskipobsolete',
2726 default=True,
2726 default=True,
2727 )
2727 )
2728 coreconfigitem(
2728 coreconfigitem(
2729 b'rebase',
2729 b'rebase',
2730 b'singletransaction',
2730 b'singletransaction',
2731 default=False,
2731 default=False,
2732 )
2732 )
2733 coreconfigitem(
2733 coreconfigitem(
2734 b'rebase',
2734 b'rebase',
2735 b'experimental.inmemory',
2735 b'experimental.inmemory',
2736 default=False,
2736 default=False,
2737 )
2737 )
@@ -1,969 +1,976 b''
1 # parsers.py - Python implementation of parsers.c
1 # parsers.py - Python implementation of parsers.c
2 #
2 #
3 # Copyright 2009 Olivia Mackall <olivia@selenic.com> and others
3 # Copyright 2009 Olivia Mackall <olivia@selenic.com> and others
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 stat
10 import stat
11 import struct
11 import struct
12 import zlib
12 import zlib
13
13
14 from ..node import (
14 from ..node import (
15 nullrev,
15 nullrev,
16 sha1nodeconstants,
16 sha1nodeconstants,
17 )
17 )
18 from ..thirdparty import attr
18 from ..thirdparty import attr
19 from .. import (
19 from .. import (
20 error,
20 error,
21 pycompat,
21 pycompat,
22 revlogutils,
22 revlogutils,
23 util,
23 util,
24 )
24 )
25
25
26 from ..revlogutils import nodemap as nodemaputil
26 from ..revlogutils import nodemap as nodemaputil
27 from ..revlogutils import constants as revlog_constants
27 from ..revlogutils import constants as revlog_constants
28
28
29 stringio = pycompat.bytesio
29 stringio = pycompat.bytesio
30
30
31
31
32 _pack = struct.pack
32 _pack = struct.pack
33 _unpack = struct.unpack
33 _unpack = struct.unpack
34 _compress = zlib.compress
34 _compress = zlib.compress
35 _decompress = zlib.decompress
35 _decompress = zlib.decompress
36
36
37
37
38 # a special value used internally for `size` if the file come from the other parent
38 # a special value used internally for `size` if the file come from the other parent
39 FROM_P2 = -2
39 FROM_P2 = -2
40
40
41 # a special value used internally for `size` if the file is modified/merged/added
41 # a special value used internally for `size` if the file is modified/merged/added
42 NONNORMAL = -1
42 NONNORMAL = -1
43
43
44 # a special value used internally for `time` if the time is ambigeous
44 # a special value used internally for `time` if the time is ambigeous
45 AMBIGUOUS_TIME = -1
45 AMBIGUOUS_TIME = -1
46
46
47 # Bits of the `flags` byte inside a node in the file format
47 # Bits of the `flags` byte inside a node in the file format
48 DIRSTATE_V2_WDIR_TRACKED = 1 << 0
48 DIRSTATE_V2_WDIR_TRACKED = 1 << 0
49 DIRSTATE_V2_P1_TRACKED = 1 << 1
49 DIRSTATE_V2_P1_TRACKED = 1 << 1
50 DIRSTATE_V2_P2_INFO = 1 << 2
50 DIRSTATE_V2_P2_INFO = 1 << 2
51 DIRSTATE_V2_MODE_EXEC_PERM = 1 << 3
51 DIRSTATE_V2_MODE_EXEC_PERM = 1 << 3
52 DIRSTATE_V2_MODE_IS_SYMLINK = 1 << 4
52 DIRSTATE_V2_MODE_IS_SYMLINK = 1 << 4
53 DIRSTATE_V2_HAS_FALLBACK_EXEC = 1 << 5
53 DIRSTATE_V2_HAS_FALLBACK_EXEC = 1 << 5
54 DIRSTATE_V2_FALLBACK_EXEC = 1 << 6
54 DIRSTATE_V2_FALLBACK_EXEC = 1 << 6
55 DIRSTATE_V2_HAS_FALLBACK_SYMLINK = 1 << 7
55 DIRSTATE_V2_HAS_FALLBACK_SYMLINK = 1 << 7
56 DIRSTATE_V2_FALLBACK_SYMLINK = 1 << 8
56 DIRSTATE_V2_FALLBACK_SYMLINK = 1 << 8
57 DIRSTATE_V2_EXPECTED_STATE_IS_MODIFIED = 1 << 9
57 DIRSTATE_V2_EXPECTED_STATE_IS_MODIFIED = 1 << 9
58 DIRSTATE_V2_HAS_MODE_AND_SIZE = 1 << 10
58 DIRSTATE_V2_HAS_MODE_AND_SIZE = 1 << 10
59 DIRSTATE_V2_HAS_MTIME = 1 << 11
59 DIRSTATE_V2_HAS_MTIME = 1 << 11
60 DIRSTATE_V2_MTIME_SECOND_AMBIGUOUS = 1 << 12
60 DIRSTATE_V2_MTIME_SECOND_AMBIGUOUS = 1 << 12
61 DIRSTATE_V2_DIRECTORY = 1 << 13
61 DIRSTATE_V2_DIRECTORY = 1 << 13
62 DIRSTATE_V2_ALL_UNKNOWN_RECORDED = 1 << 14
62 DIRSTATE_V2_ALL_UNKNOWN_RECORDED = 1 << 14
63 DIRSTATE_V2_ALL_IGNORED_RECORDED = 1 << 15
63 DIRSTATE_V2_ALL_IGNORED_RECORDED = 1 << 15
64
64
65
65
66 @attr.s(slots=True, init=False)
66 @attr.s(slots=True, init=False)
67 class DirstateItem(object):
67 class DirstateItem(object):
68 """represent a dirstate entry
68 """represent a dirstate entry
69
69
70 It hold multiple attributes
70 It hold multiple attributes
71
71
72 # about file tracking
72 # about file tracking
73 - wc_tracked: is the file tracked by the working copy
73 - wc_tracked: is the file tracked by the working copy
74 - p1_tracked: is the file tracked in working copy first parent
74 - p1_tracked: is the file tracked in working copy first parent
75 - p2_info: the file has been involved in some merge operation. Either
75 - p2_info: the file has been involved in some merge operation. Either
76 because it was actually merged, or because the p2 version was
76 because it was actually merged, or because the p2 version was
77 ahead, or because some rename moved it there. In either case
77 ahead, or because some rename moved it there. In either case
78 `hg status` will want it displayed as modified.
78 `hg status` will want it displayed as modified.
79
79
80 # about the file state expected from p1 manifest:
80 # about the file state expected from p1 manifest:
81 - mode: the file mode in p1
81 - mode: the file mode in p1
82 - size: the file size in p1
82 - size: the file size in p1
83
83
84 These value can be set to None, which mean we don't have a meaningful value
84 These value can be set to None, which mean we don't have a meaningful value
85 to compare with. Either because we don't really care about them as there
85 to compare with. Either because we don't really care about them as there
86 `status` is known without having to look at the disk or because we don't
86 `status` is known without having to look at the disk or because we don't
87 know these right now and a full comparison will be needed to find out if
87 know these right now and a full comparison will be needed to find out if
88 the file is clean.
88 the file is clean.
89
89
90 # about the file state on disk last time we saw it:
90 # about the file state on disk last time we saw it:
91 - mtime: the last known clean mtime for the file.
91 - mtime: the last known clean mtime for the file.
92
92
93 This value can be set to None if no cachable state exist. Either because we
93 This value can be set to None if no cachable state exist. Either because we
94 do not care (see previous section) or because we could not cache something
94 do not care (see previous section) or because we could not cache something
95 yet.
95 yet.
96 """
96 """
97
97
98 _wc_tracked = attr.ib()
98 _wc_tracked = attr.ib()
99 _p1_tracked = attr.ib()
99 _p1_tracked = attr.ib()
100 _p2_info = attr.ib()
100 _p2_info = attr.ib()
101 _mode = attr.ib()
101 _mode = attr.ib()
102 _size = attr.ib()
102 _size = attr.ib()
103 _mtime_s = attr.ib()
103 _mtime_s = attr.ib()
104 _mtime_ns = attr.ib()
104 _mtime_ns = attr.ib()
105 _fallback_exec = attr.ib()
105 _fallback_exec = attr.ib()
106 _fallback_symlink = attr.ib()
106 _fallback_symlink = attr.ib()
107 _mtime_second_ambiguous = attr.ib()
107 _mtime_second_ambiguous = attr.ib()
108
108
109 def __init__(
109 def __init__(
110 self,
110 self,
111 wc_tracked=False,
111 wc_tracked=False,
112 p1_tracked=False,
112 p1_tracked=False,
113 p2_info=False,
113 p2_info=False,
114 has_meaningful_data=True,
114 has_meaningful_data=True,
115 has_meaningful_mtime=True,
115 has_meaningful_mtime=True,
116 parentfiledata=None,
116 parentfiledata=None,
117 fallback_exec=None,
117 fallback_exec=None,
118 fallback_symlink=None,
118 fallback_symlink=None,
119 ):
119 ):
120 self._wc_tracked = wc_tracked
120 self._wc_tracked = wc_tracked
121 self._p1_tracked = p1_tracked
121 self._p1_tracked = p1_tracked
122 self._p2_info = p2_info
122 self._p2_info = p2_info
123
123
124 self._fallback_exec = fallback_exec
124 self._fallback_exec = fallback_exec
125 self._fallback_symlink = fallback_symlink
125 self._fallback_symlink = fallback_symlink
126
126
127 self._mode = None
127 self._mode = None
128 self._size = None
128 self._size = None
129 self._mtime_s = None
129 self._mtime_s = None
130 self._mtime_ns = None
130 self._mtime_ns = None
131 self._mtime_second_ambiguous = False
131 self._mtime_second_ambiguous = False
132 if parentfiledata is None:
132 if parentfiledata is None:
133 has_meaningful_mtime = False
133 has_meaningful_mtime = False
134 has_meaningful_data = False
134 has_meaningful_data = False
135 elif parentfiledata[2] is None:
135 elif parentfiledata[2] is None:
136 has_meaningful_mtime = False
136 has_meaningful_mtime = False
137 if has_meaningful_data:
137 if has_meaningful_data:
138 self._mode = parentfiledata[0]
138 self._mode = parentfiledata[0]
139 self._size = parentfiledata[1]
139 self._size = parentfiledata[1]
140 if has_meaningful_mtime:
140 if has_meaningful_mtime:
141 (
141 (
142 self._mtime_s,
142 self._mtime_s,
143 self._mtime_ns,
143 self._mtime_ns,
144 self._mtime_second_ambiguous,
144 self._mtime_second_ambiguous,
145 ) = parentfiledata[2]
145 ) = parentfiledata[2]
146
146
147 @classmethod
147 @classmethod
148 def from_v2_data(cls, flags, size, mtime_s, mtime_ns):
148 def from_v2_data(cls, flags, size, mtime_s, mtime_ns):
149 """Build a new DirstateItem object from V2 data"""
149 """Build a new DirstateItem object from V2 data"""
150 has_mode_size = bool(flags & DIRSTATE_V2_HAS_MODE_AND_SIZE)
150 has_mode_size = bool(flags & DIRSTATE_V2_HAS_MODE_AND_SIZE)
151 has_meaningful_mtime = bool(flags & DIRSTATE_V2_HAS_MTIME)
151 has_meaningful_mtime = bool(flags & DIRSTATE_V2_HAS_MTIME)
152 mode = None
152 mode = None
153
153
154 if flags & +DIRSTATE_V2_EXPECTED_STATE_IS_MODIFIED:
154 if flags & +DIRSTATE_V2_EXPECTED_STATE_IS_MODIFIED:
155 # we do not have support for this flag in the code yet,
155 # we do not have support for this flag in the code yet,
156 # force a lookup for this file.
156 # force a lookup for this file.
157 has_mode_size = False
157 has_mode_size = False
158 has_meaningful_mtime = False
158 has_meaningful_mtime = False
159
159
160 fallback_exec = None
160 fallback_exec = None
161 if flags & DIRSTATE_V2_HAS_FALLBACK_EXEC:
161 if flags & DIRSTATE_V2_HAS_FALLBACK_EXEC:
162 fallback_exec = flags & DIRSTATE_V2_FALLBACK_EXEC
162 fallback_exec = flags & DIRSTATE_V2_FALLBACK_EXEC
163
163
164 fallback_symlink = None
164 fallback_symlink = None
165 if flags & DIRSTATE_V2_HAS_FALLBACK_SYMLINK:
165 if flags & DIRSTATE_V2_HAS_FALLBACK_SYMLINK:
166 fallback_symlink = flags & DIRSTATE_V2_FALLBACK_SYMLINK
166 fallback_symlink = flags & DIRSTATE_V2_FALLBACK_SYMLINK
167
167
168 if has_mode_size:
168 if has_mode_size:
169 assert stat.S_IXUSR == 0o100
169 assert stat.S_IXUSR == 0o100
170 if flags & DIRSTATE_V2_MODE_EXEC_PERM:
170 if flags & DIRSTATE_V2_MODE_EXEC_PERM:
171 mode = 0o755
171 mode = 0o755
172 else:
172 else:
173 mode = 0o644
173 mode = 0o644
174 if flags & DIRSTATE_V2_MODE_IS_SYMLINK:
174 if flags & DIRSTATE_V2_MODE_IS_SYMLINK:
175 mode |= stat.S_IFLNK
175 mode |= stat.S_IFLNK
176 else:
176 else:
177 mode |= stat.S_IFREG
177 mode |= stat.S_IFREG
178
178
179 second_ambiguous = flags & DIRSTATE_V2_MTIME_SECOND_AMBIGUOUS
179 second_ambiguous = flags & DIRSTATE_V2_MTIME_SECOND_AMBIGUOUS
180 return cls(
180 return cls(
181 wc_tracked=bool(flags & DIRSTATE_V2_WDIR_TRACKED),
181 wc_tracked=bool(flags & DIRSTATE_V2_WDIR_TRACKED),
182 p1_tracked=bool(flags & DIRSTATE_V2_P1_TRACKED),
182 p1_tracked=bool(flags & DIRSTATE_V2_P1_TRACKED),
183 p2_info=bool(flags & DIRSTATE_V2_P2_INFO),
183 p2_info=bool(flags & DIRSTATE_V2_P2_INFO),
184 has_meaningful_data=has_mode_size,
184 has_meaningful_data=has_mode_size,
185 has_meaningful_mtime=has_meaningful_mtime,
185 has_meaningful_mtime=has_meaningful_mtime,
186 parentfiledata=(mode, size, (mtime_s, mtime_ns, second_ambiguous)),
186 parentfiledata=(mode, size, (mtime_s, mtime_ns, second_ambiguous)),
187 fallback_exec=fallback_exec,
187 fallback_exec=fallback_exec,
188 fallback_symlink=fallback_symlink,
188 fallback_symlink=fallback_symlink,
189 )
189 )
190
190
191 @classmethod
191 @classmethod
192 def from_v1_data(cls, state, mode, size, mtime):
192 def from_v1_data(cls, state, mode, size, mtime):
193 """Build a new DirstateItem object from V1 data
193 """Build a new DirstateItem object from V1 data
194
194
195 Since the dirstate-v1 format is frozen, the signature of this function
195 Since the dirstate-v1 format is frozen, the signature of this function
196 is not expected to change, unlike the __init__ one.
196 is not expected to change, unlike the __init__ one.
197 """
197 """
198 if state == b'm':
198 if state == b'm':
199 return cls(wc_tracked=True, p1_tracked=True, p2_info=True)
199 return cls(wc_tracked=True, p1_tracked=True, p2_info=True)
200 elif state == b'a':
200 elif state == b'a':
201 return cls(wc_tracked=True)
201 return cls(wc_tracked=True)
202 elif state == b'r':
202 elif state == b'r':
203 if size == NONNORMAL:
203 if size == NONNORMAL:
204 p1_tracked = True
204 p1_tracked = True
205 p2_info = True
205 p2_info = True
206 elif size == FROM_P2:
206 elif size == FROM_P2:
207 p1_tracked = False
207 p1_tracked = False
208 p2_info = True
208 p2_info = True
209 else:
209 else:
210 p1_tracked = True
210 p1_tracked = True
211 p2_info = False
211 p2_info = False
212 return cls(p1_tracked=p1_tracked, p2_info=p2_info)
212 return cls(p1_tracked=p1_tracked, p2_info=p2_info)
213 elif state == b'n':
213 elif state == b'n':
214 if size == FROM_P2:
214 if size == FROM_P2:
215 return cls(wc_tracked=True, p2_info=True)
215 return cls(wc_tracked=True, p2_info=True)
216 elif size == NONNORMAL:
216 elif size == NONNORMAL:
217 return cls(wc_tracked=True, p1_tracked=True)
217 return cls(wc_tracked=True, p1_tracked=True)
218 elif mtime == AMBIGUOUS_TIME:
218 elif mtime == AMBIGUOUS_TIME:
219 return cls(
219 return cls(
220 wc_tracked=True,
220 wc_tracked=True,
221 p1_tracked=True,
221 p1_tracked=True,
222 has_meaningful_mtime=False,
222 has_meaningful_mtime=False,
223 parentfiledata=(mode, size, (42, 0, False)),
223 parentfiledata=(mode, size, (42, 0, False)),
224 )
224 )
225 else:
225 else:
226 return cls(
226 return cls(
227 wc_tracked=True,
227 wc_tracked=True,
228 p1_tracked=True,
228 p1_tracked=True,
229 parentfiledata=(mode, size, (mtime, 0, False)),
229 parentfiledata=(mode, size, (mtime, 0, False)),
230 )
230 )
231 else:
231 else:
232 raise RuntimeError(b'unknown state: %s' % state)
232 raise RuntimeError(b'unknown state: %s' % state)
233
233
234 def set_possibly_dirty(self):
234 def set_possibly_dirty(self):
235 """Mark a file as "possibly dirty"
235 """Mark a file as "possibly dirty"
236
236
237 This means the next status call will have to actually check its content
237 This means the next status call will have to actually check its content
238 to make sure it is correct.
238 to make sure it is correct.
239 """
239 """
240 self._mtime_s = None
240 self._mtime_s = None
241 self._mtime_ns = None
241 self._mtime_ns = None
242
242
243 def set_clean(self, mode, size, mtime):
243 def set_clean(self, mode, size, mtime):
244 """mark a file as "clean" cancelling potential "possibly dirty call"
244 """mark a file as "clean" cancelling potential "possibly dirty call"
245
245
246 Note: this function is a descendant of `dirstate.normal` and is
246 Note: this function is a descendant of `dirstate.normal` and is
247 currently expected to be call on "normal" entry only. There are not
247 currently expected to be call on "normal" entry only. There are not
248 reason for this to not change in the future as long as the ccode is
248 reason for this to not change in the future as long as the ccode is
249 updated to preserve the proper state of the non-normal files.
249 updated to preserve the proper state of the non-normal files.
250 """
250 """
251 self._wc_tracked = True
251 self._wc_tracked = True
252 self._p1_tracked = True
252 self._p1_tracked = True
253 self._mode = mode
253 self._mode = mode
254 self._size = size
254 self._size = size
255 self._mtime_s, self._mtime_ns, self._mtime_second_ambiguous = mtime
255 self._mtime_s, self._mtime_ns, self._mtime_second_ambiguous = mtime
256
256
257 def set_tracked(self):
257 def set_tracked(self):
258 """mark a file as tracked in the working copy
258 """mark a file as tracked in the working copy
259
259
260 This will ultimately be called by command like `hg add`.
260 This will ultimately be called by command like `hg add`.
261 """
261 """
262 self._wc_tracked = True
262 self._wc_tracked = True
263 # `set_tracked` is replacing various `normallookup` call. So we mark
263 # `set_tracked` is replacing various `normallookup` call. So we mark
264 # the files as needing lookup
264 # the files as needing lookup
265 #
265 #
266 # Consider dropping this in the future in favor of something less broad.
266 # Consider dropping this in the future in favor of something less broad.
267 self._mtime_s = None
267 self._mtime_s = None
268 self._mtime_ns = None
268 self._mtime_ns = None
269
269
270 def set_untracked(self):
270 def set_untracked(self):
271 """mark a file as untracked in the working copy
271 """mark a file as untracked in the working copy
272
272
273 This will ultimately be called by command like `hg remove`.
273 This will ultimately be called by command like `hg remove`.
274 """
274 """
275 self._wc_tracked = False
275 self._wc_tracked = False
276 self._mode = None
276 self._mode = None
277 self._size = None
277 self._size = None
278 self._mtime_s = None
278 self._mtime_s = None
279 self._mtime_ns = None
279 self._mtime_ns = None
280
280
281 def drop_merge_data(self):
281 def drop_merge_data(self):
282 """remove all "merge-only" from a DirstateItem
282 """remove all "merge-only" from a DirstateItem
283
283
284 This is to be call by the dirstatemap code when the second parent is dropped
284 This is to be call by the dirstatemap code when the second parent is dropped
285 """
285 """
286 if self._p2_info:
286 if self._p2_info:
287 self._p2_info = False
287 self._p2_info = False
288 self._mode = None
288 self._mode = None
289 self._size = None
289 self._size = None
290 self._mtime_s = None
290 self._mtime_s = None
291 self._mtime_ns = None
291 self._mtime_ns = None
292
292
293 @property
293 @property
294 def mode(self):
294 def mode(self):
295 return self.v1_mode()
295 return self.v1_mode()
296
296
297 @property
297 @property
298 def size(self):
298 def size(self):
299 return self.v1_size()
299 return self.v1_size()
300
300
301 @property
301 @property
302 def mtime(self):
302 def mtime(self):
303 return self.v1_mtime()
303 return self.v1_mtime()
304
304
305 def mtime_likely_equal_to(self, other_mtime):
305 def mtime_likely_equal_to(self, other_mtime):
306 self_sec = self._mtime_s
306 self_sec = self._mtime_s
307 if self_sec is None:
307 if self_sec is None:
308 return False
308 return False
309 self_ns = self._mtime_ns
309 self_ns = self._mtime_ns
310 other_sec, other_ns, second_ambiguous = other_mtime
310 other_sec, other_ns, second_ambiguous = other_mtime
311 if self_sec != other_sec:
311 if self_sec != other_sec:
312 # seconds are different theses mtime are definitly not equal
312 # seconds are different theses mtime are definitly not equal
313 return False
313 return False
314 elif other_ns == 0 or self_ns == 0:
314 elif other_ns == 0 or self_ns == 0:
315 # at least one side as no nano-seconds information
315 # at least one side as no nano-seconds information
316
316
317 if self._mtime_second_ambiguous:
317 if self._mtime_second_ambiguous:
318 # We cannot trust the mtime in this case
318 # We cannot trust the mtime in this case
319 return False
319 return False
320 else:
320 else:
321 # the "seconds" value was reliable on its own. We are good to go.
321 # the "seconds" value was reliable on its own. We are good to go.
322 return True
322 return True
323 else:
323 else:
324 # We have nano second information, let us use them !
324 # We have nano second information, let us use them !
325 return self_ns == other_ns
325 return self_ns == other_ns
326
326
327 @property
327 @property
328 def state(self):
328 def state(self):
329 """
329 """
330 States are:
330 States are:
331 n normal
331 n normal
332 m needs merging
332 m needs merging
333 r marked for removal
333 r marked for removal
334 a marked for addition
334 a marked for addition
335
335
336 XXX This "state" is a bit obscure and mostly a direct expression of the
336 XXX This "state" is a bit obscure and mostly a direct expression of the
337 dirstatev1 format. It would make sense to ultimately deprecate it in
337 dirstatev1 format. It would make sense to ultimately deprecate it in
338 favor of the more "semantic" attributes.
338 favor of the more "semantic" attributes.
339 """
339 """
340 if not self.any_tracked:
340 if not self.any_tracked:
341 return b'?'
341 return b'?'
342 return self.v1_state()
342 return self.v1_state()
343
343
344 @property
344 @property
345 def has_fallback_exec(self):
345 def has_fallback_exec(self):
346 """True if "fallback" information are available for the "exec" bit
346 """True if "fallback" information are available for the "exec" bit
347
347
348 Fallback information can be stored in the dirstate to keep track of
348 Fallback information can be stored in the dirstate to keep track of
349 filesystem attribute tracked by Mercurial when the underlying file
349 filesystem attribute tracked by Mercurial when the underlying file
350 system or operating system does not support that property, (e.g.
350 system or operating system does not support that property, (e.g.
351 Windows).
351 Windows).
352
352
353 Not all version of the dirstate on-disk storage support preserving this
353 Not all version of the dirstate on-disk storage support preserving this
354 information.
354 information.
355 """
355 """
356 return self._fallback_exec is not None
356 return self._fallback_exec is not None
357
357
358 @property
358 @property
359 def fallback_exec(self):
359 def fallback_exec(self):
360 """ "fallback" information for the executable bit
360 """ "fallback" information for the executable bit
361
361
362 True if the file should be considered executable when we cannot get
362 True if the file should be considered executable when we cannot get
363 this information from the files system. False if it should be
363 this information from the files system. False if it should be
364 considered non-executable.
364 considered non-executable.
365
365
366 See has_fallback_exec for details."""
366 See has_fallback_exec for details."""
367 return self._fallback_exec
367 return self._fallback_exec
368
368
369 @fallback_exec.setter
369 @fallback_exec.setter
370 def set_fallback_exec(self, value):
370 def set_fallback_exec(self, value):
371 """control "fallback" executable bit
371 """control "fallback" executable bit
372
372
373 Set to:
373 Set to:
374 - True if the file should be considered executable,
374 - True if the file should be considered executable,
375 - False if the file should be considered non-executable,
375 - False if the file should be considered non-executable,
376 - None if we do not have valid fallback data.
376 - None if we do not have valid fallback data.
377
377
378 See has_fallback_exec for details."""
378 See has_fallback_exec for details."""
379 if value is None:
379 if value is None:
380 self._fallback_exec = None
380 self._fallback_exec = None
381 else:
381 else:
382 self._fallback_exec = bool(value)
382 self._fallback_exec = bool(value)
383
383
384 @property
384 @property
385 def has_fallback_symlink(self):
385 def has_fallback_symlink(self):
386 """True if "fallback" information are available for symlink status
386 """True if "fallback" information are available for symlink status
387
387
388 Fallback information can be stored in the dirstate to keep track of
388 Fallback information can be stored in the dirstate to keep track of
389 filesystem attribute tracked by Mercurial when the underlying file
389 filesystem attribute tracked by Mercurial when the underlying file
390 system or operating system does not support that property, (e.g.
390 system or operating system does not support that property, (e.g.
391 Windows).
391 Windows).
392
392
393 Not all version of the dirstate on-disk storage support preserving this
393 Not all version of the dirstate on-disk storage support preserving this
394 information."""
394 information."""
395 return self._fallback_symlink is not None
395 return self._fallback_symlink is not None
396
396
397 @property
397 @property
398 def fallback_symlink(self):
398 def fallback_symlink(self):
399 """ "fallback" information for symlink status
399 """ "fallback" information for symlink status
400
400
401 True if the file should be considered executable when we cannot get
401 True if the file should be considered executable when we cannot get
402 this information from the files system. False if it should be
402 this information from the files system. False if it should be
403 considered non-executable.
403 considered non-executable.
404
404
405 See has_fallback_exec for details."""
405 See has_fallback_exec for details."""
406 return self._fallback_symlink
406 return self._fallback_symlink
407
407
408 @fallback_symlink.setter
408 @fallback_symlink.setter
409 def set_fallback_symlink(self, value):
409 def set_fallback_symlink(self, value):
410 """control "fallback" symlink status
410 """control "fallback" symlink status
411
411
412 Set to:
412 Set to:
413 - True if the file should be considered a symlink,
413 - True if the file should be considered a symlink,
414 - False if the file should be considered not a symlink,
414 - False if the file should be considered not a symlink,
415 - None if we do not have valid fallback data.
415 - None if we do not have valid fallback data.
416
416
417 See has_fallback_symlink for details."""
417 See has_fallback_symlink for details."""
418 if value is None:
418 if value is None:
419 self._fallback_symlink = None
419 self._fallback_symlink = None
420 else:
420 else:
421 self._fallback_symlink = bool(value)
421 self._fallback_symlink = bool(value)
422
422
423 @property
423 @property
424 def tracked(self):
424 def tracked(self):
425 """True is the file is tracked in the working copy"""
425 """True is the file is tracked in the working copy"""
426 return self._wc_tracked
426 return self._wc_tracked
427
427
428 @property
428 @property
429 def any_tracked(self):
429 def any_tracked(self):
430 """True is the file is tracked anywhere (wc or parents)"""
430 """True is the file is tracked anywhere (wc or parents)"""
431 return self._wc_tracked or self._p1_tracked or self._p2_info
431 return self._wc_tracked or self._p1_tracked or self._p2_info
432
432
433 @property
433 @property
434 def added(self):
434 def added(self):
435 """True if the file has been added"""
435 """True if the file has been added"""
436 return self._wc_tracked and not (self._p1_tracked or self._p2_info)
436 return self._wc_tracked and not (self._p1_tracked or self._p2_info)
437
437
438 @property
438 @property
439 def maybe_clean(self):
439 def maybe_clean(self):
440 """True if the file has a chance to be in the "clean" state"""
440 """True if the file has a chance to be in the "clean" state"""
441 if not self._wc_tracked:
441 if not self._wc_tracked:
442 return False
442 return False
443 elif not self._p1_tracked:
443 elif not self._p1_tracked:
444 return False
444 return False
445 elif self._p2_info:
445 elif self._p2_info:
446 return False
446 return False
447 return True
447 return True
448
448
449 @property
449 @property
450 def p1_tracked(self):
450 def p1_tracked(self):
451 """True if the file is tracked in the first parent manifest"""
451 """True if the file is tracked in the first parent manifest"""
452 return self._p1_tracked
452 return self._p1_tracked
453
453
454 @property
454 @property
455 def p2_info(self):
455 def p2_info(self):
456 """True if the file needed to merge or apply any input from p2
456 """True if the file needed to merge or apply any input from p2
457
457
458 See the class documentation for details.
458 See the class documentation for details.
459 """
459 """
460 return self._wc_tracked and self._p2_info
460 return self._wc_tracked and self._p2_info
461
461
462 @property
462 @property
463 def removed(self):
463 def removed(self):
464 """True if the file has been removed"""
464 """True if the file has been removed"""
465 return not self._wc_tracked and (self._p1_tracked or self._p2_info)
465 return not self._wc_tracked and (self._p1_tracked or self._p2_info)
466
466
467 def v2_data(self):
467 def v2_data(self):
468 """Returns (flags, mode, size, mtime) for v2 serialization"""
468 """Returns (flags, mode, size, mtime) for v2 serialization"""
469 flags = 0
469 flags = 0
470 if self._wc_tracked:
470 if self._wc_tracked:
471 flags |= DIRSTATE_V2_WDIR_TRACKED
471 flags |= DIRSTATE_V2_WDIR_TRACKED
472 if self._p1_tracked:
472 if self._p1_tracked:
473 flags |= DIRSTATE_V2_P1_TRACKED
473 flags |= DIRSTATE_V2_P1_TRACKED
474 if self._p2_info:
474 if self._p2_info:
475 flags |= DIRSTATE_V2_P2_INFO
475 flags |= DIRSTATE_V2_P2_INFO
476 if self._mode is not None and self._size is not None:
476 if self._mode is not None and self._size is not None:
477 flags |= DIRSTATE_V2_HAS_MODE_AND_SIZE
477 flags |= DIRSTATE_V2_HAS_MODE_AND_SIZE
478 if self.mode & stat.S_IXUSR:
478 if self.mode & stat.S_IXUSR:
479 flags |= DIRSTATE_V2_MODE_EXEC_PERM
479 flags |= DIRSTATE_V2_MODE_EXEC_PERM
480 if stat.S_ISLNK(self.mode):
480 if stat.S_ISLNK(self.mode):
481 flags |= DIRSTATE_V2_MODE_IS_SYMLINK
481 flags |= DIRSTATE_V2_MODE_IS_SYMLINK
482 if self._mtime_s is not None:
482 if self._mtime_s is not None:
483 flags |= DIRSTATE_V2_HAS_MTIME
483 flags |= DIRSTATE_V2_HAS_MTIME
484 if self._mtime_second_ambiguous:
484 if self._mtime_second_ambiguous:
485 flags |= DIRSTATE_V2_MTIME_SECOND_AMBIGUOUS
485 flags |= DIRSTATE_V2_MTIME_SECOND_AMBIGUOUS
486
486
487 if self._fallback_exec is not None:
487 if self._fallback_exec is not None:
488 flags |= DIRSTATE_V2_HAS_FALLBACK_EXEC
488 flags |= DIRSTATE_V2_HAS_FALLBACK_EXEC
489 if self._fallback_exec:
489 if self._fallback_exec:
490 flags |= DIRSTATE_V2_FALLBACK_EXEC
490 flags |= DIRSTATE_V2_FALLBACK_EXEC
491
491
492 if self._fallback_symlink is not None:
492 if self._fallback_symlink is not None:
493 flags |= DIRSTATE_V2_HAS_FALLBACK_SYMLINK
493 flags |= DIRSTATE_V2_HAS_FALLBACK_SYMLINK
494 if self._fallback_symlink:
494 if self._fallback_symlink:
495 flags |= DIRSTATE_V2_FALLBACK_SYMLINK
495 flags |= DIRSTATE_V2_FALLBACK_SYMLINK
496
496
497 # Note: we do not need to do anything regarding
497 # Note: we do not need to do anything regarding
498 # DIRSTATE_V2_ALL_UNKNOWN_RECORDED and DIRSTATE_V2_ALL_IGNORED_RECORDED
498 # DIRSTATE_V2_ALL_UNKNOWN_RECORDED and DIRSTATE_V2_ALL_IGNORED_RECORDED
499 # since we never set _DIRSTATE_V2_HAS_DIRCTORY_MTIME
499 # since we never set _DIRSTATE_V2_HAS_DIRCTORY_MTIME
500 return (flags, self._size or 0, self._mtime_s or 0, self._mtime_ns or 0)
500 return (flags, self._size or 0, self._mtime_s or 0, self._mtime_ns or 0)
501
501
502 def v1_state(self):
502 def v1_state(self):
503 """return a "state" suitable for v1 serialization"""
503 """return a "state" suitable for v1 serialization"""
504 if not self.any_tracked:
504 if not self.any_tracked:
505 # the object has no state to record, this is -currently-
505 # the object has no state to record, this is -currently-
506 # unsupported
506 # unsupported
507 raise RuntimeError('untracked item')
507 raise RuntimeError('untracked item')
508 elif self.removed:
508 elif self.removed:
509 return b'r'
509 return b'r'
510 elif self._p1_tracked and self._p2_info:
510 elif self._p1_tracked and self._p2_info:
511 return b'm'
511 return b'm'
512 elif self.added:
512 elif self.added:
513 return b'a'
513 return b'a'
514 else:
514 else:
515 return b'n'
515 return b'n'
516
516
517 def v1_mode(self):
517 def v1_mode(self):
518 """return a "mode" suitable for v1 serialization"""
518 """return a "mode" suitable for v1 serialization"""
519 return self._mode if self._mode is not None else 0
519 return self._mode if self._mode is not None else 0
520
520
521 def v1_size(self):
521 def v1_size(self):
522 """return a "size" suitable for v1 serialization"""
522 """return a "size" suitable for v1 serialization"""
523 if not self.any_tracked:
523 if not self.any_tracked:
524 # the object has no state to record, this is -currently-
524 # the object has no state to record, this is -currently-
525 # unsupported
525 # unsupported
526 raise RuntimeError('untracked item')
526 raise RuntimeError('untracked item')
527 elif self.removed and self._p1_tracked and self._p2_info:
527 elif self.removed and self._p1_tracked and self._p2_info:
528 return NONNORMAL
528 return NONNORMAL
529 elif self._p2_info:
529 elif self._p2_info:
530 return FROM_P2
530 return FROM_P2
531 elif self.removed:
531 elif self.removed:
532 return 0
532 return 0
533 elif self.added:
533 elif self.added:
534 return NONNORMAL
534 return NONNORMAL
535 elif self._size is None:
535 elif self._size is None:
536 return NONNORMAL
536 return NONNORMAL
537 else:
537 else:
538 return self._size
538 return self._size
539
539
540 def v1_mtime(self):
540 def v1_mtime(self):
541 """return a "mtime" suitable for v1 serialization"""
541 """return a "mtime" suitable for v1 serialization"""
542 if not self.any_tracked:
542 if not self.any_tracked:
543 # the object has no state to record, this is -currently-
543 # the object has no state to record, this is -currently-
544 # unsupported
544 # unsupported
545 raise RuntimeError('untracked item')
545 raise RuntimeError('untracked item')
546 elif self.removed:
546 elif self.removed:
547 return 0
547 return 0
548 elif self._mtime_s is None:
548 elif self._mtime_s is None:
549 return AMBIGUOUS_TIME
549 return AMBIGUOUS_TIME
550 elif self._p2_info:
550 elif self._p2_info:
551 return AMBIGUOUS_TIME
551 return AMBIGUOUS_TIME
552 elif not self._p1_tracked:
552 elif not self._p1_tracked:
553 return AMBIGUOUS_TIME
553 return AMBIGUOUS_TIME
554 elif self._mtime_second_ambiguous:
554 elif self._mtime_second_ambiguous:
555 return AMBIGUOUS_TIME
555 return AMBIGUOUS_TIME
556 else:
556 else:
557 return self._mtime_s
557 return self._mtime_s
558
558
559
559
560 def gettype(q):
560 def gettype(q):
561 return int(q & 0xFFFF)
561 return int(q & 0xFFFF)
562
562
563
563
564 class BaseIndexObject(object):
564 class BaseIndexObject(object):
565 # Can I be passed to an algorithme implemented in Rust ?
565 # Can I be passed to an algorithme implemented in Rust ?
566 rust_ext_compat = 0
566 rust_ext_compat = 0
567 # Format of an index entry according to Python's `struct` language
567 # Format of an index entry according to Python's `struct` language
568 index_format = revlog_constants.INDEX_ENTRY_V1
568 index_format = revlog_constants.INDEX_ENTRY_V1
569 # Size of a C unsigned long long int, platform independent
569 # Size of a C unsigned long long int, platform independent
570 big_int_size = struct.calcsize(b'>Q')
570 big_int_size = struct.calcsize(b'>Q')
571 # Size of a C long int, platform independent
571 # Size of a C long int, platform independent
572 int_size = struct.calcsize(b'>i')
572 int_size = struct.calcsize(b'>i')
573 # An empty index entry, used as a default value to be overridden, or nullrev
573 # An empty index entry, used as a default value to be overridden, or nullrev
574 null_item = (
574 null_item = (
575 0,
575 0,
576 0,
576 0,
577 0,
577 0,
578 -1,
578 -1,
579 -1,
579 -1,
580 -1,
580 -1,
581 -1,
581 -1,
582 sha1nodeconstants.nullid,
582 sha1nodeconstants.nullid,
583 0,
583 0,
584 0,
584 0,
585 revlog_constants.COMP_MODE_INLINE,
585 revlog_constants.COMP_MODE_INLINE,
586 revlog_constants.COMP_MODE_INLINE,
586 revlog_constants.COMP_MODE_INLINE,
587 revlog_constants.RANK_UNKNOWN,
587 revlog_constants.RANK_UNKNOWN,
588 )
588 )
589
589
590 @util.propertycache
590 @util.propertycache
591 def entry_size(self):
591 def entry_size(self):
592 return self.index_format.size
592 return self.index_format.size
593
593
594 @property
594 @property
595 def nodemap(self):
595 def nodemap(self):
596 msg = b"index.nodemap is deprecated, use index.[has_node|rev|get_rev]"
596 msg = b"index.nodemap is deprecated, use index.[has_node|rev|get_rev]"
597 util.nouideprecwarn(msg, b'5.3', stacklevel=2)
597 util.nouideprecwarn(msg, b'5.3', stacklevel=2)
598 return self._nodemap
598 return self._nodemap
599
599
600 @util.propertycache
600 @util.propertycache
601 def _nodemap(self):
601 def _nodemap(self):
602 nodemap = nodemaputil.NodeMap({sha1nodeconstants.nullid: nullrev})
602 nodemap = nodemaputil.NodeMap({sha1nodeconstants.nullid: nullrev})
603 for r in range(0, len(self)):
603 for r in range(0, len(self)):
604 n = self[r][7]
604 n = self[r][7]
605 nodemap[n] = r
605 nodemap[n] = r
606 return nodemap
606 return nodemap
607
607
608 def has_node(self, node):
608 def has_node(self, node):
609 """return True if the node exist in the index"""
609 """return True if the node exist in the index"""
610 return node in self._nodemap
610 return node in self._nodemap
611
611
612 def rev(self, node):
612 def rev(self, node):
613 """return a revision for a node
613 """return a revision for a node
614
614
615 If the node is unknown, raise a RevlogError"""
615 If the node is unknown, raise a RevlogError"""
616 return self._nodemap[node]
616 return self._nodemap[node]
617
617
618 def get_rev(self, node):
618 def get_rev(self, node):
619 """return a revision for a node
619 """return a revision for a node
620
620
621 If the node is unknown, return None"""
621 If the node is unknown, return None"""
622 return self._nodemap.get(node)
622 return self._nodemap.get(node)
623
623
624 def _stripnodes(self, start):
624 def _stripnodes(self, start):
625 if '_nodemap' in vars(self):
625 if '_nodemap' in vars(self):
626 for r in range(start, len(self)):
626 for r in range(start, len(self)):
627 n = self[r][7]
627 n = self[r][7]
628 del self._nodemap[n]
628 del self._nodemap[n]
629
629
630 def clearcaches(self):
630 def clearcaches(self):
631 self.__dict__.pop('_nodemap', None)
631 self.__dict__.pop('_nodemap', None)
632
632
633 def __len__(self):
633 def __len__(self):
634 return self._lgt + len(self._extra)
634 return self._lgt + len(self._extra)
635
635
636 def append(self, tup):
636 def append(self, tup):
637 if '_nodemap' in vars(self):
637 if '_nodemap' in vars(self):
638 self._nodemap[tup[7]] = len(self)
638 self._nodemap[tup[7]] = len(self)
639 data = self._pack_entry(len(self), tup)
639 data = self._pack_entry(len(self), tup)
640 self._extra.append(data)
640 self._extra.append(data)
641
641
642 def _pack_entry(self, rev, entry):
642 def _pack_entry(self, rev, entry):
643 assert entry[8] == 0
643 assert entry[8] == 0
644 assert entry[9] == 0
644 assert entry[9] == 0
645 return self.index_format.pack(*entry[:8])
645 return self.index_format.pack(*entry[:8])
646
646
647 def _check_index(self, i):
647 def _check_index(self, i):
648 if not isinstance(i, int):
648 if not isinstance(i, int):
649 raise TypeError(b"expecting int indexes")
649 raise TypeError(b"expecting int indexes")
650 if i < 0 or i >= len(self):
650 if i < 0 or i >= len(self):
651 raise IndexError(i)
651 raise IndexError(i)
652
652
653 def __getitem__(self, i):
653 def __getitem__(self, i):
654 if i == -1:
654 if i == -1:
655 return self.null_item
655 return self.null_item
656 self._check_index(i)
656 self._check_index(i)
657 if i >= self._lgt:
657 if i >= self._lgt:
658 data = self._extra[i - self._lgt]
658 data = self._extra[i - self._lgt]
659 else:
659 else:
660 index = self._calculate_index(i)
660 index = self._calculate_index(i)
661 data = self._data[index : index + self.entry_size]
661 data = self._data[index : index + self.entry_size]
662 r = self._unpack_entry(i, data)
662 r = self._unpack_entry(i, data)
663 if self._lgt and i == 0:
663 if self._lgt and i == 0:
664 offset = revlogutils.offset_type(0, gettype(r[0]))
664 offset = revlogutils.offset_type(0, gettype(r[0]))
665 r = (offset,) + r[1:]
665 r = (offset,) + r[1:]
666 return r
666 return r
667
667
668 def _unpack_entry(self, rev, data):
668 def _unpack_entry(self, rev, data):
669 r = self.index_format.unpack(data)
669 r = self.index_format.unpack(data)
670 r = r + (
670 r = r + (
671 0,
671 0,
672 0,
672 0,
673 revlog_constants.COMP_MODE_INLINE,
673 revlog_constants.COMP_MODE_INLINE,
674 revlog_constants.COMP_MODE_INLINE,
674 revlog_constants.COMP_MODE_INLINE,
675 revlog_constants.RANK_UNKNOWN,
675 revlog_constants.RANK_UNKNOWN,
676 )
676 )
677 return r
677 return r
678
678
679 def pack_header(self, header):
679 def pack_header(self, header):
680 """pack header information as binary"""
680 """pack header information as binary"""
681 v_fmt = revlog_constants.INDEX_HEADER
681 v_fmt = revlog_constants.INDEX_HEADER
682 return v_fmt.pack(header)
682 return v_fmt.pack(header)
683
683
684 def entry_binary(self, rev):
684 def entry_binary(self, rev):
685 """return the raw binary string representing a revision"""
685 """return the raw binary string representing a revision"""
686 entry = self[rev]
686 entry = self[rev]
687 p = revlog_constants.INDEX_ENTRY_V1.pack(*entry[:8])
687 p = revlog_constants.INDEX_ENTRY_V1.pack(*entry[:8])
688 if rev == 0:
688 if rev == 0:
689 p = p[revlog_constants.INDEX_HEADER.size :]
689 p = p[revlog_constants.INDEX_HEADER.size :]
690 return p
690 return p
691
691
692
692
693 class IndexObject(BaseIndexObject):
693 class IndexObject(BaseIndexObject):
694 def __init__(self, data):
694 def __init__(self, data):
695 assert len(data) % self.entry_size == 0, (
695 assert len(data) % self.entry_size == 0, (
696 len(data),
696 len(data),
697 self.entry_size,
697 self.entry_size,
698 len(data) % self.entry_size,
698 len(data) % self.entry_size,
699 )
699 )
700 self._data = data
700 self._data = data
701 self._lgt = len(data) // self.entry_size
701 self._lgt = len(data) // self.entry_size
702 self._extra = []
702 self._extra = []
703
703
704 def _calculate_index(self, i):
704 def _calculate_index(self, i):
705 return i * self.entry_size
705 return i * self.entry_size
706
706
707 def __delitem__(self, i):
707 def __delitem__(self, i):
708 if not isinstance(i, slice) or not i.stop == -1 or i.step is not None:
708 if not isinstance(i, slice) or not i.stop == -1 or i.step is not None:
709 raise ValueError(b"deleting slices only supports a:-1 with step 1")
709 raise ValueError(b"deleting slices only supports a:-1 with step 1")
710 i = i.start
710 i = i.start
711 self._check_index(i)
711 self._check_index(i)
712 self._stripnodes(i)
712 self._stripnodes(i)
713 if i < self._lgt:
713 if i < self._lgt:
714 self._data = self._data[: i * self.entry_size]
714 self._data = self._data[: i * self.entry_size]
715 self._lgt = i
715 self._lgt = i
716 self._extra = []
716 self._extra = []
717 else:
717 else:
718 self._extra = self._extra[: i - self._lgt]
718 self._extra = self._extra[: i - self._lgt]
719
719
720
720
721 class PersistentNodeMapIndexObject(IndexObject):
721 class PersistentNodeMapIndexObject(IndexObject):
722 """a Debug oriented class to test persistent nodemap
722 """a Debug oriented class to test persistent nodemap
723
723
724 We need a simple python object to test API and higher level behavior. See
724 We need a simple python object to test API and higher level behavior. See
725 the Rust implementation for more serious usage. This should be used only
725 the Rust implementation for more serious usage. This should be used only
726 through the dedicated `devel.persistent-nodemap` config.
726 through the dedicated `devel.persistent-nodemap` config.
727 """
727 """
728
728
729 def nodemap_data_all(self):
729 def nodemap_data_all(self):
730 """Return bytes containing a full serialization of a nodemap
730 """Return bytes containing a full serialization of a nodemap
731
731
732 The nodemap should be valid for the full set of revisions in the
732 The nodemap should be valid for the full set of revisions in the
733 index."""
733 index."""
734 return nodemaputil.persistent_data(self)
734 return nodemaputil.persistent_data(self)
735
735
736 def nodemap_data_incremental(self):
736 def nodemap_data_incremental(self):
737 """Return bytes containing a incremental update to persistent nodemap
737 """Return bytes containing a incremental update to persistent nodemap
738
738
739 This containst the data for an append-only update of the data provided
739 This containst the data for an append-only update of the data provided
740 in the last call to `update_nodemap_data`.
740 in the last call to `update_nodemap_data`.
741 """
741 """
742 if self._nm_root is None:
742 if self._nm_root is None:
743 return None
743 return None
744 docket = self._nm_docket
744 docket = self._nm_docket
745 changed, data = nodemaputil.update_persistent_data(
745 changed, data = nodemaputil.update_persistent_data(
746 self, self._nm_root, self._nm_max_idx, self._nm_docket.tip_rev
746 self, self._nm_root, self._nm_max_idx, self._nm_docket.tip_rev
747 )
747 )
748
748
749 self._nm_root = self._nm_max_idx = self._nm_docket = None
749 self._nm_root = self._nm_max_idx = self._nm_docket = None
750 return docket, changed, data
750 return docket, changed, data
751
751
752 def update_nodemap_data(self, docket, nm_data):
752 def update_nodemap_data(self, docket, nm_data):
753 """provide full block of persisted binary data for a nodemap
753 """provide full block of persisted binary data for a nodemap
754
754
755 The data are expected to come from disk. See `nodemap_data_all` for a
755 The data are expected to come from disk. See `nodemap_data_all` for a
756 produceur of such data."""
756 produceur of such data."""
757 if nm_data is not None:
757 if nm_data is not None:
758 self._nm_root, self._nm_max_idx = nodemaputil.parse_data(nm_data)
758 self._nm_root, self._nm_max_idx = nodemaputil.parse_data(nm_data)
759 if self._nm_root:
759 if self._nm_root:
760 self._nm_docket = docket
760 self._nm_docket = docket
761 else:
761 else:
762 self._nm_root = self._nm_max_idx = self._nm_docket = None
762 self._nm_root = self._nm_max_idx = self._nm_docket = None
763
763
764
764
765 class InlinedIndexObject(BaseIndexObject):
765 class InlinedIndexObject(BaseIndexObject):
766 def __init__(self, data, inline=0):
766 def __init__(self, data, inline=0):
767 self._data = data
767 self._data = data
768 self._lgt = self._inline_scan(None)
768 self._lgt = self._inline_scan(None)
769 self._inline_scan(self._lgt)
769 self._inline_scan(self._lgt)
770 self._extra = []
770 self._extra = []
771
771
772 def _inline_scan(self, lgt):
772 def _inline_scan(self, lgt):
773 off = 0
773 off = 0
774 if lgt is not None:
774 if lgt is not None:
775 self._offsets = [0] * lgt
775 self._offsets = [0] * lgt
776 count = 0
776 count = 0
777 while off <= len(self._data) - self.entry_size:
777 while off <= len(self._data) - self.entry_size:
778 start = off + self.big_int_size
778 start = off + self.big_int_size
779 (s,) = struct.unpack(
779 (s,) = struct.unpack(
780 b'>i',
780 b'>i',
781 self._data[start : start + self.int_size],
781 self._data[start : start + self.int_size],
782 )
782 )
783 if lgt is not None:
783 if lgt is not None:
784 self._offsets[count] = off
784 self._offsets[count] = off
785 count += 1
785 count += 1
786 off += self.entry_size + s
786 off += self.entry_size + s
787 if off != len(self._data):
787 if off != len(self._data):
788 raise ValueError(b"corrupted data")
788 raise ValueError(b"corrupted data")
789 return count
789 return count
790
790
791 def __delitem__(self, i):
791 def __delitem__(self, i):
792 if not isinstance(i, slice) or not i.stop == -1 or i.step is not None:
792 if not isinstance(i, slice) or not i.stop == -1 or i.step is not None:
793 raise ValueError(b"deleting slices only supports a:-1 with step 1")
793 raise ValueError(b"deleting slices only supports a:-1 with step 1")
794 i = i.start
794 i = i.start
795 self._check_index(i)
795 self._check_index(i)
796 self._stripnodes(i)
796 self._stripnodes(i)
797 if i < self._lgt:
797 if i < self._lgt:
798 self._offsets = self._offsets[:i]
798 self._offsets = self._offsets[:i]
799 self._lgt = i
799 self._lgt = i
800 self._extra = []
800 self._extra = []
801 else:
801 else:
802 self._extra = self._extra[: i - self._lgt]
802 self._extra = self._extra[: i - self._lgt]
803
803
804 def _calculate_index(self, i):
804 def _calculate_index(self, i):
805 return self._offsets[i]
805 return self._offsets[i]
806
806
807
807
808 def parse_index2(data, inline, revlogv2=False):
808 def parse_index2(data, inline, revlogv2=False):
809 if not inline:
809 if not inline:
810 cls = IndexObject2 if revlogv2 else IndexObject
810 cls = IndexObject2 if revlogv2 else IndexObject
811 return cls(data), None
811 return cls(data), None
812 cls = InlinedIndexObject
812 cls = InlinedIndexObject
813 return cls(data, inline), (0, data)
813 return cls(data, inline), (0, data)
814
814
815
815
816 def parse_index_cl_v2(data):
816 def parse_index_cl_v2(data):
817 return IndexChangelogV2(data), None
817 return IndexChangelogV2(data), None
818
818
819
819
820 class IndexObject2(IndexObject):
820 class IndexObject2(IndexObject):
821 index_format = revlog_constants.INDEX_ENTRY_V2
821 index_format = revlog_constants.INDEX_ENTRY_V2
822
822
823 def replace_sidedata_info(
823 def replace_sidedata_info(
824 self,
824 self,
825 rev,
825 rev,
826 sidedata_offset,
826 sidedata_offset,
827 sidedata_length,
827 sidedata_length,
828 offset_flags,
828 offset_flags,
829 compression_mode,
829 compression_mode,
830 ):
830 ):
831 """
831 """
832 Replace an existing index entry's sidedata offset and length with new
832 Replace an existing index entry's sidedata offset and length with new
833 ones.
833 ones.
834 This cannot be used outside of the context of sidedata rewriting,
834 This cannot be used outside of the context of sidedata rewriting,
835 inside the transaction that creates the revision `rev`.
835 inside the transaction that creates the revision `rev`.
836 """
836 """
837 if rev < 0:
837 if rev < 0:
838 raise KeyError
838 raise KeyError
839 self._check_index(rev)
839 self._check_index(rev)
840 if rev < self._lgt:
840 if rev < self._lgt:
841 msg = b"cannot rewrite entries outside of this transaction"
841 msg = b"cannot rewrite entries outside of this transaction"
842 raise KeyError(msg)
842 raise KeyError(msg)
843 else:
843 else:
844 entry = list(self[rev])
844 entry = list(self[rev])
845 entry[0] = offset_flags
845 entry[0] = offset_flags
846 entry[8] = sidedata_offset
846 entry[8] = sidedata_offset
847 entry[9] = sidedata_length
847 entry[9] = sidedata_length
848 entry[11] = compression_mode
848 entry[11] = compression_mode
849 entry = tuple(entry)
849 entry = tuple(entry)
850 new = self._pack_entry(rev, entry)
850 new = self._pack_entry(rev, entry)
851 self._extra[rev - self._lgt] = new
851 self._extra[rev - self._lgt] = new
852
852
853 def _unpack_entry(self, rev, data):
853 def _unpack_entry(self, rev, data):
854 data = self.index_format.unpack(data)
854 data = self.index_format.unpack(data)
855 entry = data[:10]
855 entry = data[:10]
856 data_comp = data[10] & 3
856 data_comp = data[10] & 3
857 sidedata_comp = (data[10] & (3 << 2)) >> 2
857 sidedata_comp = (data[10] & (3 << 2)) >> 2
858 return entry + (data_comp, sidedata_comp, revlog_constants.RANK_UNKNOWN)
858 return entry + (data_comp, sidedata_comp, revlog_constants.RANK_UNKNOWN)
859
859
860 def _pack_entry(self, rev, entry):
860 def _pack_entry(self, rev, entry):
861 data = entry[:10]
861 data = entry[:10]
862 data_comp = entry[10] & 3
862 data_comp = entry[10] & 3
863 sidedata_comp = (entry[11] & 3) << 2
863 sidedata_comp = (entry[11] & 3) << 2
864 data += (data_comp | sidedata_comp,)
864 data += (data_comp | sidedata_comp,)
865
865
866 return self.index_format.pack(*data)
866 return self.index_format.pack(*data)
867
867
868 def entry_binary(self, rev):
868 def entry_binary(self, rev):
869 """return the raw binary string representing a revision"""
869 """return the raw binary string representing a revision"""
870 entry = self[rev]
870 entry = self[rev]
871 return self._pack_entry(rev, entry)
871 return self._pack_entry(rev, entry)
872
872
873 def pack_header(self, header):
873 def pack_header(self, header):
874 """pack header information as binary"""
874 """pack header information as binary"""
875 msg = 'version header should go in the docket, not the index: %d'
875 msg = 'version header should go in the docket, not the index: %d'
876 msg %= header
876 msg %= header
877 raise error.ProgrammingError(msg)
877 raise error.ProgrammingError(msg)
878
878
879
879
880 class IndexChangelogV2(IndexObject2):
880 class IndexChangelogV2(IndexObject2):
881 index_format = revlog_constants.INDEX_ENTRY_CL_V2
881 index_format = revlog_constants.INDEX_ENTRY_CL_V2
882
882
883 null_item = (
884 IndexObject2.null_item[: revlog_constants.ENTRY_RANK]
885 + (0,) # rank of null is 0
886 + IndexObject2.null_item[revlog_constants.ENTRY_RANK :]
887 )
888
883 def _unpack_entry(self, rev, data, r=True):
889 def _unpack_entry(self, rev, data, r=True):
884 items = self.index_format.unpack(data)
890 items = self.index_format.unpack(data)
885 return (
891 return (
886 items[revlog_constants.INDEX_ENTRY_V2_IDX_OFFSET],
892 items[revlog_constants.INDEX_ENTRY_V2_IDX_OFFSET],
887 items[revlog_constants.INDEX_ENTRY_V2_IDX_COMPRESSED_LENGTH],
893 items[revlog_constants.INDEX_ENTRY_V2_IDX_COMPRESSED_LENGTH],
888 items[revlog_constants.INDEX_ENTRY_V2_IDX_UNCOMPRESSED_LENGTH],
894 items[revlog_constants.INDEX_ENTRY_V2_IDX_UNCOMPRESSED_LENGTH],
889 rev,
895 rev,
890 rev,
896 rev,
891 items[revlog_constants.INDEX_ENTRY_V2_IDX_PARENT_1],
897 items[revlog_constants.INDEX_ENTRY_V2_IDX_PARENT_1],
892 items[revlog_constants.INDEX_ENTRY_V2_IDX_PARENT_2],
898 items[revlog_constants.INDEX_ENTRY_V2_IDX_PARENT_2],
893 items[revlog_constants.INDEX_ENTRY_V2_IDX_NODEID],
899 items[revlog_constants.INDEX_ENTRY_V2_IDX_NODEID],
894 items[revlog_constants.INDEX_ENTRY_V2_IDX_SIDEDATA_OFFSET],
900 items[revlog_constants.INDEX_ENTRY_V2_IDX_SIDEDATA_OFFSET],
895 items[
901 items[
896 revlog_constants.INDEX_ENTRY_V2_IDX_SIDEDATA_COMPRESSED_LENGTH
902 revlog_constants.INDEX_ENTRY_V2_IDX_SIDEDATA_COMPRESSED_LENGTH
897 ],
903 ],
898 items[revlog_constants.INDEX_ENTRY_V2_IDX_COMPRESSION_MODE] & 3,
904 items[revlog_constants.INDEX_ENTRY_V2_IDX_COMPRESSION_MODE] & 3,
899 (items[revlog_constants.INDEX_ENTRY_V2_IDX_COMPRESSION_MODE] >> 2)
905 (items[revlog_constants.INDEX_ENTRY_V2_IDX_COMPRESSION_MODE] >> 2)
900 & 3,
906 & 3,
901 revlog_constants.RANK_UNKNOWN,
907 items[revlog_constants.INDEX_ENTRY_V2_IDX_RANK],
902 )
908 )
903
909
904 def _pack_entry(self, rev, entry):
910 def _pack_entry(self, rev, entry):
905
911
906 base = entry[revlog_constants.ENTRY_DELTA_BASE]
912 base = entry[revlog_constants.ENTRY_DELTA_BASE]
907 link_rev = entry[revlog_constants.ENTRY_LINK_REV]
913 link_rev = entry[revlog_constants.ENTRY_LINK_REV]
908 assert base == rev, (base, rev)
914 assert base == rev, (base, rev)
909 assert link_rev == rev, (link_rev, rev)
915 assert link_rev == rev, (link_rev, rev)
910 data = (
916 data = (
911 entry[revlog_constants.ENTRY_DATA_OFFSET],
917 entry[revlog_constants.ENTRY_DATA_OFFSET],
912 entry[revlog_constants.ENTRY_DATA_COMPRESSED_LENGTH],
918 entry[revlog_constants.ENTRY_DATA_COMPRESSED_LENGTH],
913 entry[revlog_constants.ENTRY_DATA_UNCOMPRESSED_LENGTH],
919 entry[revlog_constants.ENTRY_DATA_UNCOMPRESSED_LENGTH],
914 entry[revlog_constants.ENTRY_PARENT_1],
920 entry[revlog_constants.ENTRY_PARENT_1],
915 entry[revlog_constants.ENTRY_PARENT_2],
921 entry[revlog_constants.ENTRY_PARENT_2],
916 entry[revlog_constants.ENTRY_NODE_ID],
922 entry[revlog_constants.ENTRY_NODE_ID],
917 entry[revlog_constants.ENTRY_SIDEDATA_OFFSET],
923 entry[revlog_constants.ENTRY_SIDEDATA_OFFSET],
918 entry[revlog_constants.ENTRY_SIDEDATA_COMPRESSED_LENGTH],
924 entry[revlog_constants.ENTRY_SIDEDATA_COMPRESSED_LENGTH],
919 entry[revlog_constants.ENTRY_DATA_COMPRESSION_MODE] & 3
925 entry[revlog_constants.ENTRY_DATA_COMPRESSION_MODE] & 3
920 | (entry[revlog_constants.ENTRY_SIDEDATA_COMPRESSION_MODE] & 3)
926 | (entry[revlog_constants.ENTRY_SIDEDATA_COMPRESSION_MODE] & 3)
921 << 2,
927 << 2,
928 entry[revlog_constants.ENTRY_RANK],
922 )
929 )
923 return self.index_format.pack(*data)
930 return self.index_format.pack(*data)
924
931
925
932
926 def parse_index_devel_nodemap(data, inline):
933 def parse_index_devel_nodemap(data, inline):
927 """like parse_index2, but alway return a PersistentNodeMapIndexObject"""
934 """like parse_index2, but alway return a PersistentNodeMapIndexObject"""
928 return PersistentNodeMapIndexObject(data), None
935 return PersistentNodeMapIndexObject(data), None
929
936
930
937
931 def parse_dirstate(dmap, copymap, st):
938 def parse_dirstate(dmap, copymap, st):
932 parents = [st[:20], st[20:40]]
939 parents = [st[:20], st[20:40]]
933 # dereference fields so they will be local in loop
940 # dereference fields so they will be local in loop
934 format = b">cllll"
941 format = b">cllll"
935 e_size = struct.calcsize(format)
942 e_size = struct.calcsize(format)
936 pos1 = 40
943 pos1 = 40
937 l = len(st)
944 l = len(st)
938
945
939 # the inner loop
946 # the inner loop
940 while pos1 < l:
947 while pos1 < l:
941 pos2 = pos1 + e_size
948 pos2 = pos1 + e_size
942 e = _unpack(b">cllll", st[pos1:pos2]) # a literal here is faster
949 e = _unpack(b">cllll", st[pos1:pos2]) # a literal here is faster
943 pos1 = pos2 + e[4]
950 pos1 = pos2 + e[4]
944 f = st[pos2:pos1]
951 f = st[pos2:pos1]
945 if b'\0' in f:
952 if b'\0' in f:
946 f, c = f.split(b'\0')
953 f, c = f.split(b'\0')
947 copymap[f] = c
954 copymap[f] = c
948 dmap[f] = DirstateItem.from_v1_data(*e[:4])
955 dmap[f] = DirstateItem.from_v1_data(*e[:4])
949 return parents
956 return parents
950
957
951
958
952 def pack_dirstate(dmap, copymap, pl):
959 def pack_dirstate(dmap, copymap, pl):
953 cs = stringio()
960 cs = stringio()
954 write = cs.write
961 write = cs.write
955 write(b"".join(pl))
962 write(b"".join(pl))
956 for f, e in pycompat.iteritems(dmap):
963 for f, e in pycompat.iteritems(dmap):
957 if f in copymap:
964 if f in copymap:
958 f = b"%s\0%s" % (f, copymap[f])
965 f = b"%s\0%s" % (f, copymap[f])
959 e = _pack(
966 e = _pack(
960 b">cllll",
967 b">cllll",
961 e.v1_state(),
968 e.v1_state(),
962 e.v1_mode(),
969 e.v1_mode(),
963 e.v1_size(),
970 e.v1_size(),
964 e.v1_mtime(),
971 e.v1_mtime(),
965 len(f),
972 len(f),
966 )
973 )
967 write(e)
974 write(e)
968 write(f)
975 write(f)
969 return cs.getvalue()
976 return cs.getvalue()
@@ -1,302 +1,304 b''
1 # revlogdeltas.py - constant used for revlog logic.
1 # revlogdeltas.py - constant used for revlog logic.
2 #
2 #
3 # Copyright 2005-2007 Olivia Mackall <olivia@selenic.com>
3 # Copyright 2005-2007 Olivia Mackall <olivia@selenic.com>
4 # Copyright 2018 Octobus <contact@octobus.net>
4 # Copyright 2018 Octobus <contact@octobus.net>
5 #
5 #
6 # This software may be used and distributed according to the terms of the
6 # This software may be used and distributed according to the terms of the
7 # GNU General Public License version 2 or any later version.
7 # GNU General Public License version 2 or any later version.
8 """Helper class to compute deltas stored inside revlogs"""
8 """Helper class to compute deltas stored inside revlogs"""
9
9
10 from __future__ import absolute_import
10 from __future__ import absolute_import
11
11
12 import struct
12 import struct
13
13
14 from ..interfaces import repository
14 from ..interfaces import repository
15 from .. import revlogutils
15 from .. import revlogutils
16
16
17 ### Internal utily constants
17 ### Internal utily constants
18
18
19 KIND_CHANGELOG = 1001 # over 256 to not be comparable with a bytes
19 KIND_CHANGELOG = 1001 # over 256 to not be comparable with a bytes
20 KIND_MANIFESTLOG = 1002
20 KIND_MANIFESTLOG = 1002
21 KIND_FILELOG = 1003
21 KIND_FILELOG = 1003
22 KIND_OTHER = 1004
22 KIND_OTHER = 1004
23
23
24 ALL_KINDS = {
24 ALL_KINDS = {
25 KIND_CHANGELOG,
25 KIND_CHANGELOG,
26 KIND_MANIFESTLOG,
26 KIND_MANIFESTLOG,
27 KIND_FILELOG,
27 KIND_FILELOG,
28 KIND_OTHER,
28 KIND_OTHER,
29 }
29 }
30
30
31 ### Index entry key
31 ### Index entry key
32 #
32 #
33 #
33 #
34 # Internal details
34 # Internal details
35 # ----------------
35 # ----------------
36 #
36 #
37 # A large part of the revlog logic deals with revisions' "index entries", tuple
37 # A large part of the revlog logic deals with revisions' "index entries", tuple
38 # objects that contains the same "items" whatever the revlog version.
38 # objects that contains the same "items" whatever the revlog version.
39 # Different versions will have different ways of storing these items (sometimes
39 # Different versions will have different ways of storing these items (sometimes
40 # not having them at all), but the tuple will always be the same. New fields
40 # not having them at all), but the tuple will always be the same. New fields
41 # are usually added at the end to avoid breaking existing code that relies
41 # are usually added at the end to avoid breaking existing code that relies
42 # on the existing order. The field are defined as follows:
42 # on the existing order. The field are defined as follows:
43
43
44 # [0] offset:
44 # [0] offset:
45 # The byte index of the start of revision data chunk.
45 # The byte index of the start of revision data chunk.
46 # That value is shifted up by 16 bits. use "offset = field >> 16" to
46 # That value is shifted up by 16 bits. use "offset = field >> 16" to
47 # retrieve it.
47 # retrieve it.
48 #
48 #
49 # flags:
49 # flags:
50 # A flag field that carries special information or changes the behavior
50 # A flag field that carries special information or changes the behavior
51 # of the revision. (see `REVIDX_*` constants for details)
51 # of the revision. (see `REVIDX_*` constants for details)
52 # The flag field only occupies the first 16 bits of this field,
52 # The flag field only occupies the first 16 bits of this field,
53 # use "flags = field & 0xFFFF" to retrieve the value.
53 # use "flags = field & 0xFFFF" to retrieve the value.
54 ENTRY_DATA_OFFSET = 0
54 ENTRY_DATA_OFFSET = 0
55
55
56 # [1] compressed length:
56 # [1] compressed length:
57 # The size, in bytes, of the chunk on disk
57 # The size, in bytes, of the chunk on disk
58 ENTRY_DATA_COMPRESSED_LENGTH = 1
58 ENTRY_DATA_COMPRESSED_LENGTH = 1
59
59
60 # [2] uncompressed length:
60 # [2] uncompressed length:
61 # The size, in bytes, of the full revision once reconstructed.
61 # The size, in bytes, of the full revision once reconstructed.
62 ENTRY_DATA_UNCOMPRESSED_LENGTH = 2
62 ENTRY_DATA_UNCOMPRESSED_LENGTH = 2
63
63
64 # [3] base rev:
64 # [3] base rev:
65 # Either the base of the revision delta chain (without general
65 # Either the base of the revision delta chain (without general
66 # delta), or the base of the delta (stored in the data chunk)
66 # delta), or the base of the delta (stored in the data chunk)
67 # with general delta.
67 # with general delta.
68 ENTRY_DELTA_BASE = 3
68 ENTRY_DELTA_BASE = 3
69
69
70 # [4] link rev:
70 # [4] link rev:
71 # Changelog revision number of the changeset introducing this
71 # Changelog revision number of the changeset introducing this
72 # revision.
72 # revision.
73 ENTRY_LINK_REV = 4
73 ENTRY_LINK_REV = 4
74
74
75 # [5] parent 1 rev:
75 # [5] parent 1 rev:
76 # Revision number of the first parent
76 # Revision number of the first parent
77 ENTRY_PARENT_1 = 5
77 ENTRY_PARENT_1 = 5
78
78
79 # [6] parent 2 rev:
79 # [6] parent 2 rev:
80 # Revision number of the second parent
80 # Revision number of the second parent
81 ENTRY_PARENT_2 = 6
81 ENTRY_PARENT_2 = 6
82
82
83 # [7] node id:
83 # [7] node id:
84 # The node id of the current revision
84 # The node id of the current revision
85 ENTRY_NODE_ID = 7
85 ENTRY_NODE_ID = 7
86
86
87 # [8] sidedata offset:
87 # [8] sidedata offset:
88 # The byte index of the start of the revision's side-data chunk.
88 # The byte index of the start of the revision's side-data chunk.
89 ENTRY_SIDEDATA_OFFSET = 8
89 ENTRY_SIDEDATA_OFFSET = 8
90
90
91 # [9] sidedata chunk length:
91 # [9] sidedata chunk length:
92 # The size, in bytes, of the revision's side-data chunk.
92 # The size, in bytes, of the revision's side-data chunk.
93 ENTRY_SIDEDATA_COMPRESSED_LENGTH = 9
93 ENTRY_SIDEDATA_COMPRESSED_LENGTH = 9
94
94
95 # [10] data compression mode:
95 # [10] data compression mode:
96 # two bits that detail the way the data chunk is compressed on disk.
96 # two bits that detail the way the data chunk is compressed on disk.
97 # (see "COMP_MODE_*" constants for details). For revlog version 0 and
97 # (see "COMP_MODE_*" constants for details). For revlog version 0 and
98 # 1 this will always be COMP_MODE_INLINE.
98 # 1 this will always be COMP_MODE_INLINE.
99 ENTRY_DATA_COMPRESSION_MODE = 10
99 ENTRY_DATA_COMPRESSION_MODE = 10
100
100
101 # [11] side-data compression mode:
101 # [11] side-data compression mode:
102 # two bits that detail the way the sidedata chunk is compressed on disk.
102 # two bits that detail the way the sidedata chunk is compressed on disk.
103 # (see "COMP_MODE_*" constants for details)
103 # (see "COMP_MODE_*" constants for details)
104 ENTRY_SIDEDATA_COMPRESSION_MODE = 11
104 ENTRY_SIDEDATA_COMPRESSION_MODE = 11
105
105
106 # [12] Revision rank:
106 # [12] Revision rank:
107 # The number of revision under this one.
107 # The number of revision under this one.
108 #
108 #
109 # Formally this is defined as : rank(X) = len(ancestors(X) + X)
109 # Formally this is defined as : rank(X) = len(ancestors(X) + X)
110 #
110 #
111 # If rank == -1; then we do not have this information available.
111 # If rank == -1; then we do not have this information available.
112 # Only `null` has a rank of 0.
112 # Only `null` has a rank of 0.
113 ENTRY_RANK = 12
113 ENTRY_RANK = 12
114
114
115 RANK_UNKNOWN = -1
115 RANK_UNKNOWN = -1
116
116
117 ### main revlog header
117 ### main revlog header
118
118
119 # We cannot rely on Struct.format is inconsistent for python <=3.6 versus above
119 # We cannot rely on Struct.format is inconsistent for python <=3.6 versus above
120 INDEX_HEADER_FMT = b">I"
120 INDEX_HEADER_FMT = b">I"
121 INDEX_HEADER = struct.Struct(INDEX_HEADER_FMT)
121 INDEX_HEADER = struct.Struct(INDEX_HEADER_FMT)
122
122
123 ## revlog version
123 ## revlog version
124 REVLOGV0 = 0
124 REVLOGV0 = 0
125 REVLOGV1 = 1
125 REVLOGV1 = 1
126 # Dummy value until file format is finalized.
126 # Dummy value until file format is finalized.
127 REVLOGV2 = 0xDEAD
127 REVLOGV2 = 0xDEAD
128 # Dummy value until file format is finalized.
128 # Dummy value until file format is finalized.
129 CHANGELOGV2 = 0xD34D
129 CHANGELOGV2 = 0xD34D
130
130
131 ## global revlog header flags
131 ## global revlog header flags
132 # Shared across v1 and v2.
132 # Shared across v1 and v2.
133 FLAG_INLINE_DATA = 1 << 16
133 FLAG_INLINE_DATA = 1 << 16
134 # Only used by v1, implied by v2.
134 # Only used by v1, implied by v2.
135 FLAG_GENERALDELTA = 1 << 17
135 FLAG_GENERALDELTA = 1 << 17
136 REVLOG_DEFAULT_FLAGS = FLAG_INLINE_DATA
136 REVLOG_DEFAULT_FLAGS = FLAG_INLINE_DATA
137 REVLOG_DEFAULT_FORMAT = REVLOGV1
137 REVLOG_DEFAULT_FORMAT = REVLOGV1
138 REVLOG_DEFAULT_VERSION = REVLOG_DEFAULT_FORMAT | REVLOG_DEFAULT_FLAGS
138 REVLOG_DEFAULT_VERSION = REVLOG_DEFAULT_FORMAT | REVLOG_DEFAULT_FLAGS
139 REVLOGV0_FLAGS = 0
139 REVLOGV0_FLAGS = 0
140 REVLOGV1_FLAGS = FLAG_INLINE_DATA | FLAG_GENERALDELTA
140 REVLOGV1_FLAGS = FLAG_INLINE_DATA | FLAG_GENERALDELTA
141 REVLOGV2_FLAGS = FLAG_INLINE_DATA
141 REVLOGV2_FLAGS = FLAG_INLINE_DATA
142 CHANGELOGV2_FLAGS = 0
142 CHANGELOGV2_FLAGS = 0
143
143
144 ### individual entry
144 ### individual entry
145
145
146 ## index v0:
146 ## index v0:
147 # 4 bytes: offset
147 # 4 bytes: offset
148 # 4 bytes: compressed length
148 # 4 bytes: compressed length
149 # 4 bytes: base rev
149 # 4 bytes: base rev
150 # 4 bytes: link rev
150 # 4 bytes: link rev
151 # 20 bytes: parent 1 nodeid
151 # 20 bytes: parent 1 nodeid
152 # 20 bytes: parent 2 nodeid
152 # 20 bytes: parent 2 nodeid
153 # 20 bytes: nodeid
153 # 20 bytes: nodeid
154 INDEX_ENTRY_V0 = struct.Struct(b">4l20s20s20s")
154 INDEX_ENTRY_V0 = struct.Struct(b">4l20s20s20s")
155
155
156 ## index v1
156 ## index v1
157 # 6 bytes: offset
157 # 6 bytes: offset
158 # 2 bytes: flags
158 # 2 bytes: flags
159 # 4 bytes: compressed length
159 # 4 bytes: compressed length
160 # 4 bytes: uncompressed length
160 # 4 bytes: uncompressed length
161 # 4 bytes: base rev
161 # 4 bytes: base rev
162 # 4 bytes: link rev
162 # 4 bytes: link rev
163 # 4 bytes: parent 1 rev
163 # 4 bytes: parent 1 rev
164 # 4 bytes: parent 2 rev
164 # 4 bytes: parent 2 rev
165 # 32 bytes: nodeid
165 # 32 bytes: nodeid
166 INDEX_ENTRY_V1 = struct.Struct(b">Qiiiiii20s12x")
166 INDEX_ENTRY_V1 = struct.Struct(b">Qiiiiii20s12x")
167 assert INDEX_ENTRY_V1.size == 32 * 2
167 assert INDEX_ENTRY_V1.size == 32 * 2
168
168
169 # 6 bytes: offset
169 # 6 bytes: offset
170 # 2 bytes: flags
170 # 2 bytes: flags
171 # 4 bytes: compressed length
171 # 4 bytes: compressed length
172 # 4 bytes: uncompressed length
172 # 4 bytes: uncompressed length
173 # 4 bytes: base rev
173 # 4 bytes: base rev
174 # 4 bytes: link rev
174 # 4 bytes: link rev
175 # 4 bytes: parent 1 rev
175 # 4 bytes: parent 1 rev
176 # 4 bytes: parent 2 rev
176 # 4 bytes: parent 2 rev
177 # 32 bytes: nodeid
177 # 32 bytes: nodeid
178 # 8 bytes: sidedata offset
178 # 8 bytes: sidedata offset
179 # 4 bytes: sidedata compressed length
179 # 4 bytes: sidedata compressed length
180 # 1 bytes: compression mode (2 lower bit are data_compression_mode)
180 # 1 bytes: compression mode (2 lower bit are data_compression_mode)
181 # 19 bytes: Padding to align to 96 bytes (see RevlogV2Plan wiki page)
181 # 19 bytes: Padding to align to 96 bytes (see RevlogV2Plan wiki page)
182 INDEX_ENTRY_V2 = struct.Struct(b">Qiiiiii20s12xQiB19x")
182 INDEX_ENTRY_V2 = struct.Struct(b">Qiiiiii20s12xQiB19x")
183 assert INDEX_ENTRY_V2.size == 32 * 3, INDEX_ENTRY_V2.size
183 assert INDEX_ENTRY_V2.size == 32 * 3, INDEX_ENTRY_V2.size
184
184
185 # 6 bytes: offset
185 # 6 bytes: offset
186 # 2 bytes: flags
186 # 2 bytes: flags
187 # 4 bytes: compressed length
187 # 4 bytes: compressed length
188 # 4 bytes: uncompressed length
188 # 4 bytes: uncompressed length
189 # 4 bytes: parent 1 rev
189 # 4 bytes: parent 1 rev
190 # 4 bytes: parent 2 rev
190 # 4 bytes: parent 2 rev
191 # 32 bytes: nodeid
191 # 32 bytes: nodeid
192 # 8 bytes: sidedata offset
192 # 8 bytes: sidedata offset
193 # 4 bytes: sidedata compressed length
193 # 4 bytes: sidedata compressed length
194 # 1 bytes: compression mode (2 lower bit are data_compression_mode)
194 # 1 bytes: compression mode (2 lower bit are data_compression_mode)
195 # 27 bytes: Padding to align to 96 bytes (see RevlogV2Plan wiki page)
195 # 4 bytes: changeset rank (i.e. `len(::REV)`)
196 INDEX_ENTRY_CL_V2 = struct.Struct(b">Qiiii20s12xQiB27x")
196 # 23 bytes: Padding to align to 96 bytes (see RevlogV2Plan wiki page)
197 INDEX_ENTRY_CL_V2 = struct.Struct(b">Qiiii20s12xQiBi23x")
197 assert INDEX_ENTRY_CL_V2.size == 32 * 3, INDEX_ENTRY_CL_V2.size
198 assert INDEX_ENTRY_CL_V2.size == 32 * 3, INDEX_ENTRY_CL_V2.size
198 INDEX_ENTRY_V2_IDX_OFFSET = 0
199 INDEX_ENTRY_V2_IDX_OFFSET = 0
199 INDEX_ENTRY_V2_IDX_COMPRESSED_LENGTH = 1
200 INDEX_ENTRY_V2_IDX_COMPRESSED_LENGTH = 1
200 INDEX_ENTRY_V2_IDX_UNCOMPRESSED_LENGTH = 2
201 INDEX_ENTRY_V2_IDX_UNCOMPRESSED_LENGTH = 2
201 INDEX_ENTRY_V2_IDX_PARENT_1 = 3
202 INDEX_ENTRY_V2_IDX_PARENT_1 = 3
202 INDEX_ENTRY_V2_IDX_PARENT_2 = 4
203 INDEX_ENTRY_V2_IDX_PARENT_2 = 4
203 INDEX_ENTRY_V2_IDX_NODEID = 5
204 INDEX_ENTRY_V2_IDX_NODEID = 5
204 INDEX_ENTRY_V2_IDX_SIDEDATA_OFFSET = 6
205 INDEX_ENTRY_V2_IDX_SIDEDATA_OFFSET = 6
205 INDEX_ENTRY_V2_IDX_SIDEDATA_COMPRESSED_LENGTH = 7
206 INDEX_ENTRY_V2_IDX_SIDEDATA_COMPRESSED_LENGTH = 7
206 INDEX_ENTRY_V2_IDX_COMPRESSION_MODE = 8
207 INDEX_ENTRY_V2_IDX_COMPRESSION_MODE = 8
208 INDEX_ENTRY_V2_IDX_RANK = 9
207
209
208 # revlog index flags
210 # revlog index flags
209
211
210 # For historical reasons, revlog's internal flags were exposed via the
212 # For historical reasons, revlog's internal flags were exposed via the
211 # wire protocol and are even exposed in parts of the storage APIs.
213 # wire protocol and are even exposed in parts of the storage APIs.
212
214
213 # revision has censor metadata, must be verified
215 # revision has censor metadata, must be verified
214 REVIDX_ISCENSORED = repository.REVISION_FLAG_CENSORED
216 REVIDX_ISCENSORED = repository.REVISION_FLAG_CENSORED
215 # revision hash does not match data (narrowhg)
217 # revision hash does not match data (narrowhg)
216 REVIDX_ELLIPSIS = repository.REVISION_FLAG_ELLIPSIS
218 REVIDX_ELLIPSIS = repository.REVISION_FLAG_ELLIPSIS
217 # revision data is stored externally
219 # revision data is stored externally
218 REVIDX_EXTSTORED = repository.REVISION_FLAG_EXTSTORED
220 REVIDX_EXTSTORED = repository.REVISION_FLAG_EXTSTORED
219 # revision changes files in a way that could affect copy tracing.
221 # revision changes files in a way that could affect copy tracing.
220 REVIDX_HASCOPIESINFO = repository.REVISION_FLAG_HASCOPIESINFO
222 REVIDX_HASCOPIESINFO = repository.REVISION_FLAG_HASCOPIESINFO
221 REVIDX_DEFAULT_FLAGS = 0
223 REVIDX_DEFAULT_FLAGS = 0
222 # stable order in which flags need to be processed and their processors applied
224 # stable order in which flags need to be processed and their processors applied
223 REVIDX_FLAGS_ORDER = [
225 REVIDX_FLAGS_ORDER = [
224 REVIDX_ISCENSORED,
226 REVIDX_ISCENSORED,
225 REVIDX_ELLIPSIS,
227 REVIDX_ELLIPSIS,
226 REVIDX_EXTSTORED,
228 REVIDX_EXTSTORED,
227 REVIDX_HASCOPIESINFO,
229 REVIDX_HASCOPIESINFO,
228 ]
230 ]
229
231
230 # bitmark for flags that could cause rawdata content change
232 # bitmark for flags that could cause rawdata content change
231 REVIDX_RAWTEXT_CHANGING_FLAGS = REVIDX_ISCENSORED | REVIDX_EXTSTORED
233 REVIDX_RAWTEXT_CHANGING_FLAGS = REVIDX_ISCENSORED | REVIDX_EXTSTORED
232
234
233 ## chunk compression mode constants:
235 ## chunk compression mode constants:
234 # These constants are used in revlog version >=2 to denote the compression used
236 # These constants are used in revlog version >=2 to denote the compression used
235 # for a chunk.
237 # for a chunk.
236
238
237 # Chunk use no compression, the data stored on disk can be directly use as
239 # Chunk use no compression, the data stored on disk can be directly use as
238 # chunk value. Without any header information prefixed.
240 # chunk value. Without any header information prefixed.
239 COMP_MODE_PLAIN = 0
241 COMP_MODE_PLAIN = 0
240
242
241 # Chunk use the "default compression" for the revlog (usually defined in the
243 # Chunk use the "default compression" for the revlog (usually defined in the
242 # revlog docket). A header is still used.
244 # revlog docket). A header is still used.
243 #
245 #
244 # XXX: keeping a header is probably not useful and we should probably drop it.
246 # XXX: keeping a header is probably not useful and we should probably drop it.
245 #
247 #
246 # XXX: The value of allow mixed type of compression in the revlog is unclear
248 # XXX: The value of allow mixed type of compression in the revlog is unclear
247 # and we should consider making PLAIN/DEFAULT the only available mode for
249 # and we should consider making PLAIN/DEFAULT the only available mode for
248 # revlog v2, disallowing INLINE mode.
250 # revlog v2, disallowing INLINE mode.
249 COMP_MODE_DEFAULT = 1
251 COMP_MODE_DEFAULT = 1
250
252
251 # Chunk use a compression mode stored "inline" at the start of the chunk
253 # Chunk use a compression mode stored "inline" at the start of the chunk
252 # itself. This is the mode always used for revlog version "0" and "1"
254 # itself. This is the mode always used for revlog version "0" and "1"
253 COMP_MODE_INLINE = revlogutils.COMP_MODE_INLINE
255 COMP_MODE_INLINE = revlogutils.COMP_MODE_INLINE
254
256
255 SUPPORTED_FLAGS = {
257 SUPPORTED_FLAGS = {
256 REVLOGV0: REVLOGV0_FLAGS,
258 REVLOGV0: REVLOGV0_FLAGS,
257 REVLOGV1: REVLOGV1_FLAGS,
259 REVLOGV1: REVLOGV1_FLAGS,
258 REVLOGV2: REVLOGV2_FLAGS,
260 REVLOGV2: REVLOGV2_FLAGS,
259 CHANGELOGV2: CHANGELOGV2_FLAGS,
261 CHANGELOGV2: CHANGELOGV2_FLAGS,
260 }
262 }
261
263
262 _no = lambda flags: False
264 _no = lambda flags: False
263 _yes = lambda flags: True
265 _yes = lambda flags: True
264
266
265
267
266 def _from_flag(flag):
268 def _from_flag(flag):
267 return lambda flags: bool(flags & flag)
269 return lambda flags: bool(flags & flag)
268
270
269
271
270 FEATURES_BY_VERSION = {
272 FEATURES_BY_VERSION = {
271 REVLOGV0: {
273 REVLOGV0: {
272 b'inline': _no,
274 b'inline': _no,
273 b'generaldelta': _no,
275 b'generaldelta': _no,
274 b'sidedata': False,
276 b'sidedata': False,
275 b'docket': False,
277 b'docket': False,
276 },
278 },
277 REVLOGV1: {
279 REVLOGV1: {
278 b'inline': _from_flag(FLAG_INLINE_DATA),
280 b'inline': _from_flag(FLAG_INLINE_DATA),
279 b'generaldelta': _from_flag(FLAG_GENERALDELTA),
281 b'generaldelta': _from_flag(FLAG_GENERALDELTA),
280 b'sidedata': False,
282 b'sidedata': False,
281 b'docket': False,
283 b'docket': False,
282 },
284 },
283 REVLOGV2: {
285 REVLOGV2: {
284 # The point of inline-revlog is to reduce the number of files used in
286 # The point of inline-revlog is to reduce the number of files used in
285 # the store. Using a docket defeat this purpose. So we needs other
287 # the store. Using a docket defeat this purpose. So we needs other
286 # means to reduce the number of files for revlogv2.
288 # means to reduce the number of files for revlogv2.
287 b'inline': _no,
289 b'inline': _no,
288 b'generaldelta': _yes,
290 b'generaldelta': _yes,
289 b'sidedata': True,
291 b'sidedata': True,
290 b'docket': True,
292 b'docket': True,
291 },
293 },
292 CHANGELOGV2: {
294 CHANGELOGV2: {
293 b'inline': _no,
295 b'inline': _no,
294 # General delta is useless for changelog since we don't do any delta
296 # General delta is useless for changelog since we don't do any delta
295 b'generaldelta': _no,
297 b'generaldelta': _no,
296 b'sidedata': True,
298 b'sidedata': True,
297 b'docket': True,
299 b'docket': True,
298 },
300 },
299 }
301 }
300
302
301
303
302 SPARSE_REVLOG_MAX_CHAIN_LENGTH = 1000
304 SPARSE_REVLOG_MAX_CHAIN_LENGTH = 1000
General Comments 0
You need to be logged in to leave comments. Login now