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