##// END OF EJS Templates
profiling: show actual time spent in hotpath display...
Valentin Gatien-Baron -
r42615:0ae593e7 default
parent child Browse files
Show More
@@ -1,1493 +1,1496
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 def loadconfigtable(ui, extname, configtable):
19 19 """update config item known to the ui with the extension ones"""
20 20 for section, items in sorted(configtable.items()):
21 21 knownitems = ui._knownconfig.setdefault(section, itemregister())
22 22 knownkeys = set(knownitems)
23 23 newkeys = set(items)
24 24 for key in sorted(knownkeys & newkeys):
25 25 msg = "extension '%s' overwrite config item '%s.%s'"
26 26 msg %= (extname, section, key)
27 27 ui.develwarn(msg, config='warn-config')
28 28
29 29 knownitems.update(items)
30 30
31 31 class configitem(object):
32 32 """represent a known config item
33 33
34 34 :section: the official config section where to find this item,
35 35 :name: the official name within the section,
36 36 :default: default value for this item,
37 37 :alias: optional list of tuples as alternatives,
38 38 :generic: this is a generic definition, match name using regular expression.
39 39 """
40 40
41 41 def __init__(self, section, name, default=None, alias=(),
42 42 generic=False, priority=0):
43 43 self.section = section
44 44 self.name = name
45 45 self.default = default
46 46 self.alias = list(alias)
47 47 self.generic = generic
48 48 self.priority = priority
49 49 self._re = None
50 50 if generic:
51 51 self._re = re.compile(self.name)
52 52
53 53 class itemregister(dict):
54 54 """A specialized dictionary that can handle wild-card selection"""
55 55
56 56 def __init__(self):
57 57 super(itemregister, self).__init__()
58 58 self._generics = set()
59 59
60 60 def update(self, other):
61 61 super(itemregister, self).update(other)
62 62 self._generics.update(other._generics)
63 63
64 64 def __setitem__(self, key, item):
65 65 super(itemregister, self).__setitem__(key, item)
66 66 if item.generic:
67 67 self._generics.add(item)
68 68
69 69 def get(self, key):
70 70 baseitem = super(itemregister, self).get(key)
71 71 if baseitem is not None and not baseitem.generic:
72 72 return baseitem
73 73
74 74 # search for a matching generic item
75 75 generics = sorted(self._generics, key=(lambda x: (x.priority, x.name)))
76 76 for item in generics:
77 77 # we use 'match' instead of 'search' to make the matching simpler
78 78 # for people unfamiliar with regular expression. Having the match
79 79 # rooted to the start of the string will produce less surprising
80 80 # result for user writing simple regex for sub-attribute.
81 81 #
82 82 # For example using "color\..*" match produces an unsurprising
83 83 # result, while using search could suddenly match apparently
84 84 # unrelated configuration that happens to contains "color."
85 85 # anywhere. This is a tradeoff where we favor requiring ".*" on
86 86 # some match to avoid the need to prefix most pattern with "^".
87 87 # The "^" seems more error prone.
88 88 if item._re.match(key):
89 89 return item
90 90
91 91 return None
92 92
93 93 coreitems = {}
94 94
95 95 def _register(configtable, *args, **kwargs):
96 96 item = configitem(*args, **kwargs)
97 97 section = configtable.setdefault(item.section, itemregister())
98 98 if item.name in section:
99 99 msg = "duplicated config item registration for '%s.%s'"
100 100 raise error.ProgrammingError(msg % (item.section, item.name))
101 101 section[item.name] = item
102 102
103 103 # special value for case where the default is derived from other values
104 104 dynamicdefault = object()
105 105
106 106 # Registering actual config items
107 107
108 108 def getitemregister(configtable):
109 109 f = functools.partial(_register, configtable)
110 110 # export pseudo enum as configitem.*
111 111 f.dynamicdefault = dynamicdefault
112 112 return f
113 113
114 114 coreconfigitem = getitemregister(coreitems)
115 115
116 116 def _registerdiffopts(section, configprefix=''):
117 117 coreconfigitem(section, configprefix + 'nodates',
118 118 default=False,
119 119 )
120 120 coreconfigitem(section, configprefix + 'showfunc',
121 121 default=False,
122 122 )
123 123 coreconfigitem(section, configprefix + 'unified',
124 124 default=None,
125 125 )
126 126 coreconfigitem(section, configprefix + 'git',
127 127 default=False,
128 128 )
129 129 coreconfigitem(section, configprefix + 'ignorews',
130 130 default=False,
131 131 )
132 132 coreconfigitem(section, configprefix + 'ignorewsamount',
133 133 default=False,
134 134 )
135 135 coreconfigitem(section, configprefix + 'ignoreblanklines',
136 136 default=False,
137 137 )
138 138 coreconfigitem(section, configprefix + 'ignorewseol',
139 139 default=False,
140 140 )
141 141 coreconfigitem(section, configprefix + 'nobinary',
142 142 default=False,
143 143 )
144 144 coreconfigitem(section, configprefix + 'noprefix',
145 145 default=False,
146 146 )
147 147 coreconfigitem(section, configprefix + 'word-diff',
148 148 default=False,
149 149 )
150 150
151 151 coreconfigitem('alias', '.*',
152 152 default=dynamicdefault,
153 153 generic=True,
154 154 )
155 155 coreconfigitem('auth', 'cookiefile',
156 156 default=None,
157 157 )
158 158 _registerdiffopts(section='annotate')
159 159 # bookmarks.pushing: internal hack for discovery
160 160 coreconfigitem('bookmarks', 'pushing',
161 161 default=list,
162 162 )
163 163 # bundle.mainreporoot: internal hack for bundlerepo
164 164 coreconfigitem('bundle', 'mainreporoot',
165 165 default='',
166 166 )
167 167 coreconfigitem('censor', 'policy',
168 168 default='abort',
169 169 )
170 170 coreconfigitem('chgserver', 'idletimeout',
171 171 default=3600,
172 172 )
173 173 coreconfigitem('chgserver', 'skiphash',
174 174 default=False,
175 175 )
176 176 coreconfigitem('cmdserver', 'log',
177 177 default=None,
178 178 )
179 179 coreconfigitem('cmdserver', 'max-log-files',
180 180 default=7,
181 181 )
182 182 coreconfigitem('cmdserver', 'max-log-size',
183 183 default='1 MB',
184 184 )
185 185 coreconfigitem('cmdserver', 'max-repo-cache',
186 186 default=0,
187 187 )
188 188 coreconfigitem('cmdserver', 'message-encodings',
189 189 default=list,
190 190 )
191 191 coreconfigitem('cmdserver', 'track-log',
192 192 default=lambda: ['chgserver', 'cmdserver', 'repocache'],
193 193 )
194 194 coreconfigitem('color', '.*',
195 195 default=None,
196 196 generic=True,
197 197 )
198 198 coreconfigitem('color', 'mode',
199 199 default='auto',
200 200 )
201 201 coreconfigitem('color', 'pagermode',
202 202 default=dynamicdefault,
203 203 )
204 204 _registerdiffopts(section='commands', configprefix='commit.interactive.')
205 205 coreconfigitem('commands', 'commit.post-status',
206 206 default=False,
207 207 )
208 208 coreconfigitem('commands', 'grep.all-files',
209 209 default=False,
210 210 )
211 211 coreconfigitem('commands', 'resolve.confirm',
212 212 default=False,
213 213 )
214 214 coreconfigitem('commands', 'resolve.explicit-re-merge',
215 215 default=False,
216 216 )
217 217 coreconfigitem('commands', 'resolve.mark-check',
218 218 default='none',
219 219 )
220 220 _registerdiffopts(section='commands', configprefix='revert.interactive.')
221 221 coreconfigitem('commands', 'show.aliasprefix',
222 222 default=list,
223 223 )
224 224 coreconfigitem('commands', 'status.relative',
225 225 default=False,
226 226 )
227 227 coreconfigitem('commands', 'status.skipstates',
228 228 default=[],
229 229 )
230 230 coreconfigitem('commands', 'status.terse',
231 231 default='',
232 232 )
233 233 coreconfigitem('commands', 'status.verbose',
234 234 default=False,
235 235 )
236 236 coreconfigitem('commands', 'update.check',
237 237 default=None,
238 238 )
239 239 coreconfigitem('commands', 'update.requiredest',
240 240 default=False,
241 241 )
242 242 coreconfigitem('committemplate', '.*',
243 243 default=None,
244 244 generic=True,
245 245 )
246 246 coreconfigitem('convert', 'bzr.saverev',
247 247 default=True,
248 248 )
249 249 coreconfigitem('convert', 'cvsps.cache',
250 250 default=True,
251 251 )
252 252 coreconfigitem('convert', 'cvsps.fuzz',
253 253 default=60,
254 254 )
255 255 coreconfigitem('convert', 'cvsps.logencoding',
256 256 default=None,
257 257 )
258 258 coreconfigitem('convert', 'cvsps.mergefrom',
259 259 default=None,
260 260 )
261 261 coreconfigitem('convert', 'cvsps.mergeto',
262 262 default=None,
263 263 )
264 264 coreconfigitem('convert', 'git.committeractions',
265 265 default=lambda: ['messagedifferent'],
266 266 )
267 267 coreconfigitem('convert', 'git.extrakeys',
268 268 default=list,
269 269 )
270 270 coreconfigitem('convert', 'git.findcopiesharder',
271 271 default=False,
272 272 )
273 273 coreconfigitem('convert', 'git.remoteprefix',
274 274 default='remote',
275 275 )
276 276 coreconfigitem('convert', 'git.renamelimit',
277 277 default=400,
278 278 )
279 279 coreconfigitem('convert', 'git.saverev',
280 280 default=True,
281 281 )
282 282 coreconfigitem('convert', 'git.similarity',
283 283 default=50,
284 284 )
285 285 coreconfigitem('convert', 'git.skipsubmodules',
286 286 default=False,
287 287 )
288 288 coreconfigitem('convert', 'hg.clonebranches',
289 289 default=False,
290 290 )
291 291 coreconfigitem('convert', 'hg.ignoreerrors',
292 292 default=False,
293 293 )
294 294 coreconfigitem('convert', 'hg.revs',
295 295 default=None,
296 296 )
297 297 coreconfigitem('convert', 'hg.saverev',
298 298 default=False,
299 299 )
300 300 coreconfigitem('convert', 'hg.sourcename',
301 301 default=None,
302 302 )
303 303 coreconfigitem('convert', 'hg.startrev',
304 304 default=None,
305 305 )
306 306 coreconfigitem('convert', 'hg.tagsbranch',
307 307 default='default',
308 308 )
309 309 coreconfigitem('convert', 'hg.usebranchnames',
310 310 default=True,
311 311 )
312 312 coreconfigitem('convert', 'ignoreancestorcheck',
313 313 default=False,
314 314 )
315 315 coreconfigitem('convert', 'localtimezone',
316 316 default=False,
317 317 )
318 318 coreconfigitem('convert', 'p4.encoding',
319 319 default=dynamicdefault,
320 320 )
321 321 coreconfigitem('convert', 'p4.startrev',
322 322 default=0,
323 323 )
324 324 coreconfigitem('convert', 'skiptags',
325 325 default=False,
326 326 )
327 327 coreconfigitem('convert', 'svn.debugsvnlog',
328 328 default=True,
329 329 )
330 330 coreconfigitem('convert', 'svn.trunk',
331 331 default=None,
332 332 )
333 333 coreconfigitem('convert', 'svn.tags',
334 334 default=None,
335 335 )
336 336 coreconfigitem('convert', 'svn.branches',
337 337 default=None,
338 338 )
339 339 coreconfigitem('convert', 'svn.startrev',
340 340 default=0,
341 341 )
342 342 coreconfigitem('debug', 'dirstate.delaywrite',
343 343 default=0,
344 344 )
345 345 coreconfigitem('defaults', '.*',
346 346 default=None,
347 347 generic=True,
348 348 )
349 349 coreconfigitem('devel', 'all-warnings',
350 350 default=False,
351 351 )
352 352 coreconfigitem('devel', 'bundle2.debug',
353 353 default=False,
354 354 )
355 355 coreconfigitem('devel', 'bundle.delta',
356 356 default='',
357 357 )
358 358 coreconfigitem('devel', 'cache-vfs',
359 359 default=None,
360 360 )
361 361 coreconfigitem('devel', 'check-locks',
362 362 default=False,
363 363 )
364 364 coreconfigitem('devel', 'check-relroot',
365 365 default=False,
366 366 )
367 367 coreconfigitem('devel', 'default-date',
368 368 default=None,
369 369 )
370 370 coreconfigitem('devel', 'deprec-warn',
371 371 default=False,
372 372 )
373 373 coreconfigitem('devel', 'disableloaddefaultcerts',
374 374 default=False,
375 375 )
376 376 coreconfigitem('devel', 'warn-empty-changegroup',
377 377 default=False,
378 378 )
379 379 coreconfigitem('devel', 'legacy.exchange',
380 380 default=list,
381 381 )
382 382 coreconfigitem('devel', 'servercafile',
383 383 default='',
384 384 )
385 385 coreconfigitem('devel', 'serverexactprotocol',
386 386 default='',
387 387 )
388 388 coreconfigitem('devel', 'serverrequirecert',
389 389 default=False,
390 390 )
391 391 coreconfigitem('devel', 'strip-obsmarkers',
392 392 default=True,
393 393 )
394 394 coreconfigitem('devel', 'warn-config',
395 395 default=None,
396 396 )
397 397 coreconfigitem('devel', 'warn-config-default',
398 398 default=None,
399 399 )
400 400 coreconfigitem('devel', 'user.obsmarker',
401 401 default=None,
402 402 )
403 403 coreconfigitem('devel', 'warn-config-unknown',
404 404 default=None,
405 405 )
406 406 coreconfigitem('devel', 'debug.copies',
407 407 default=False,
408 408 )
409 409 coreconfigitem('devel', 'debug.extensions',
410 410 default=False,
411 411 )
412 412 coreconfigitem('devel', 'debug.peer-request',
413 413 default=False,
414 414 )
415 415 _registerdiffopts(section='diff')
416 416 coreconfigitem('email', 'bcc',
417 417 default=None,
418 418 )
419 419 coreconfigitem('email', 'cc',
420 420 default=None,
421 421 )
422 422 coreconfigitem('email', 'charsets',
423 423 default=list,
424 424 )
425 425 coreconfigitem('email', 'from',
426 426 default=None,
427 427 )
428 428 coreconfigitem('email', 'method',
429 429 default='smtp',
430 430 )
431 431 coreconfigitem('email', 'reply-to',
432 432 default=None,
433 433 )
434 434 coreconfigitem('email', 'to',
435 435 default=None,
436 436 )
437 437 coreconfigitem('experimental', 'archivemetatemplate',
438 438 default=dynamicdefault,
439 439 )
440 440 coreconfigitem('experimental', 'auto-publish',
441 441 default='publish',
442 442 )
443 443 coreconfigitem('experimental', 'bundle-phases',
444 444 default=False,
445 445 )
446 446 coreconfigitem('experimental', 'bundle2-advertise',
447 447 default=True,
448 448 )
449 449 coreconfigitem('experimental', 'bundle2-output-capture',
450 450 default=False,
451 451 )
452 452 coreconfigitem('experimental', 'bundle2.pushback',
453 453 default=False,
454 454 )
455 455 coreconfigitem('experimental', 'bundle2lazylocking',
456 456 default=False,
457 457 )
458 458 coreconfigitem('experimental', 'bundlecomplevel',
459 459 default=None,
460 460 )
461 461 coreconfigitem('experimental', 'bundlecomplevel.bzip2',
462 462 default=None,
463 463 )
464 464 coreconfigitem('experimental', 'bundlecomplevel.gzip',
465 465 default=None,
466 466 )
467 467 coreconfigitem('experimental', 'bundlecomplevel.none',
468 468 default=None,
469 469 )
470 470 coreconfigitem('experimental', 'bundlecomplevel.zstd',
471 471 default=None,
472 472 )
473 473 coreconfigitem('experimental', 'changegroup3',
474 474 default=False,
475 475 )
476 476 coreconfigitem('experimental', 'cleanup-as-archived',
477 477 default=False,
478 478 )
479 479 coreconfigitem('experimental', 'clientcompressionengines',
480 480 default=list,
481 481 )
482 482 coreconfigitem('experimental', 'copytrace',
483 483 default='on',
484 484 )
485 485 coreconfigitem('experimental', 'copytrace.movecandidateslimit',
486 486 default=100,
487 487 )
488 488 coreconfigitem('experimental', 'copytrace.sourcecommitlimit',
489 489 default=100,
490 490 )
491 491 coreconfigitem('experimental', 'copies.read-from',
492 492 default="filelog-only",
493 493 )
494 494 coreconfigitem('experimental', 'copies.write-to',
495 495 default='filelog-only',
496 496 )
497 497 coreconfigitem('experimental', 'crecordtest',
498 498 default=None,
499 499 )
500 500 coreconfigitem('experimental', 'directaccess',
501 501 default=False,
502 502 )
503 503 coreconfigitem('experimental', 'directaccess.revnums',
504 504 default=False,
505 505 )
506 506 coreconfigitem('experimental', 'editortmpinhg',
507 507 default=False,
508 508 )
509 509 coreconfigitem('experimental', 'evolution',
510 510 default=list,
511 511 )
512 512 coreconfigitem('experimental', 'evolution.allowdivergence',
513 513 default=False,
514 514 alias=[('experimental', 'allowdivergence')]
515 515 )
516 516 coreconfigitem('experimental', 'evolution.allowunstable',
517 517 default=None,
518 518 )
519 519 coreconfigitem('experimental', 'evolution.createmarkers',
520 520 default=None,
521 521 )
522 522 coreconfigitem('experimental', 'evolution.effect-flags',
523 523 default=True,
524 524 alias=[('experimental', 'effect-flags')]
525 525 )
526 526 coreconfigitem('experimental', 'evolution.exchange',
527 527 default=None,
528 528 )
529 529 coreconfigitem('experimental', 'evolution.bundle-obsmarker',
530 530 default=False,
531 531 )
532 532 coreconfigitem('experimental', 'log.topo',
533 533 default=False,
534 534 )
535 535 coreconfigitem('experimental', 'evolution.report-instabilities',
536 536 default=True,
537 537 )
538 538 coreconfigitem('experimental', 'evolution.track-operation',
539 539 default=True,
540 540 )
541 541 # repo-level config to exclude a revset visibility
542 542 #
543 543 # The target use case is to use `share` to expose different subset of the same
544 544 # repository, especially server side. See also `server.view`.
545 545 coreconfigitem('experimental', 'extra-filter-revs',
546 546 default=None,
547 547 )
548 548 coreconfigitem('experimental', 'maxdeltachainspan',
549 549 default=-1,
550 550 )
551 551 coreconfigitem('experimental', 'mergetempdirprefix',
552 552 default=None,
553 553 )
554 554 coreconfigitem('experimental', 'mmapindexthreshold',
555 555 default=None,
556 556 )
557 557 coreconfigitem('experimental', 'narrow',
558 558 default=False,
559 559 )
560 560 coreconfigitem('experimental', 'nonnormalparanoidcheck',
561 561 default=False,
562 562 )
563 563 coreconfigitem('experimental', 'exportableenviron',
564 564 default=list,
565 565 )
566 566 coreconfigitem('experimental', 'extendedheader.index',
567 567 default=None,
568 568 )
569 569 coreconfigitem('experimental', 'extendedheader.similarity',
570 570 default=False,
571 571 )
572 572 coreconfigitem('experimental', 'graphshorten',
573 573 default=False,
574 574 )
575 575 coreconfigitem('experimental', 'graphstyle.parent',
576 576 default=dynamicdefault,
577 577 )
578 578 coreconfigitem('experimental', 'graphstyle.missing',
579 579 default=dynamicdefault,
580 580 )
581 581 coreconfigitem('experimental', 'graphstyle.grandparent',
582 582 default=dynamicdefault,
583 583 )
584 584 coreconfigitem('experimental', 'hook-track-tags',
585 585 default=False,
586 586 )
587 587 coreconfigitem('experimental', 'httppeer.advertise-v2',
588 588 default=False,
589 589 )
590 590 coreconfigitem('experimental', 'httppeer.v2-encoder-order',
591 591 default=None,
592 592 )
593 593 coreconfigitem('experimental', 'httppostargs',
594 594 default=False,
595 595 )
596 596 coreconfigitem('experimental', 'mergedriver',
597 597 default=None,
598 598 )
599 599 coreconfigitem('experimental', 'nointerrupt', default=False)
600 600 coreconfigitem('experimental', 'nointerrupt-interactiveonly', default=True)
601 601
602 602 coreconfigitem('experimental', 'obsmarkers-exchange-debug',
603 603 default=False,
604 604 )
605 605 coreconfigitem('experimental', 'remotenames',
606 606 default=False,
607 607 )
608 608 coreconfigitem('experimental', 'removeemptydirs',
609 609 default=True,
610 610 )
611 611 coreconfigitem('experimental', 'revert.interactive.select-to-keep',
612 612 default=False,
613 613 )
614 614 coreconfigitem('experimental', 'revisions.prefixhexnode',
615 615 default=False,
616 616 )
617 617 coreconfigitem('experimental', 'revlogv2',
618 618 default=None,
619 619 )
620 620 coreconfigitem('experimental', 'revisions.disambiguatewithin',
621 621 default=None,
622 622 )
623 623 coreconfigitem('experimental', 'server.filesdata.recommended-batch-size',
624 624 default=50000,
625 625 )
626 626 coreconfigitem('experimental', 'server.manifestdata.recommended-batch-size',
627 627 default=100000,
628 628 )
629 629 coreconfigitem('experimental', 'server.stream-narrow-clones',
630 630 default=False,
631 631 )
632 632 coreconfigitem('experimental', 'single-head-per-branch',
633 633 default=False,
634 634 )
635 635 coreconfigitem('experimental', 'sshserver.support-v2',
636 636 default=False,
637 637 )
638 638 coreconfigitem('experimental', 'sparse-read',
639 639 default=False,
640 640 )
641 641 coreconfigitem('experimental', 'sparse-read.density-threshold',
642 642 default=0.50,
643 643 )
644 644 coreconfigitem('experimental', 'sparse-read.min-gap-size',
645 645 default='65K',
646 646 )
647 647 coreconfigitem('experimental', 'treemanifest',
648 648 default=False,
649 649 )
650 650 coreconfigitem('experimental', 'update.atomic-file',
651 651 default=False,
652 652 )
653 653 coreconfigitem('experimental', 'sshpeer.advertise-v2',
654 654 default=False,
655 655 )
656 656 coreconfigitem('experimental', 'web.apiserver',
657 657 default=False,
658 658 )
659 659 coreconfigitem('experimental', 'web.api.http-v2',
660 660 default=False,
661 661 )
662 662 coreconfigitem('experimental', 'web.api.debugreflect',
663 663 default=False,
664 664 )
665 665 coreconfigitem('experimental', 'worker.wdir-get-thread-safe',
666 666 default=False,
667 667 )
668 668 coreconfigitem('experimental', 'xdiff',
669 669 default=False,
670 670 )
671 671 coreconfigitem('extensions', '.*',
672 672 default=None,
673 673 generic=True,
674 674 )
675 675 coreconfigitem('extdata', '.*',
676 676 default=None,
677 677 generic=True,
678 678 )
679 679 coreconfigitem('format', 'bookmarks-in-store',
680 680 default=False,
681 681 )
682 682 coreconfigitem('format', 'chunkcachesize',
683 683 default=None,
684 684 )
685 685 coreconfigitem('format', 'dotencode',
686 686 default=True,
687 687 )
688 688 coreconfigitem('format', 'generaldelta',
689 689 default=False,
690 690 )
691 691 coreconfigitem('format', 'manifestcachesize',
692 692 default=None,
693 693 )
694 694 coreconfigitem('format', 'maxchainlen',
695 695 default=dynamicdefault,
696 696 )
697 697 coreconfigitem('format', 'obsstore-version',
698 698 default=None,
699 699 )
700 700 coreconfigitem('format', 'sparse-revlog',
701 701 default=True,
702 702 )
703 703 coreconfigitem('format', 'revlog-compression',
704 704 default='zlib',
705 705 alias=[('experimental', 'format.compression')]
706 706 )
707 707 coreconfigitem('format', 'usefncache',
708 708 default=True,
709 709 )
710 710 coreconfigitem('format', 'usegeneraldelta',
711 711 default=True,
712 712 )
713 713 coreconfigitem('format', 'usestore',
714 714 default=True,
715 715 )
716 716 coreconfigitem('format', 'internal-phase',
717 717 default=False,
718 718 )
719 719 coreconfigitem('fsmonitor', 'warn_when_unused',
720 720 default=True,
721 721 )
722 722 coreconfigitem('fsmonitor', 'warn_update_file_count',
723 723 default=50000,
724 724 )
725 725 coreconfigitem('help', br'hidden-command\..*',
726 726 default=False,
727 727 generic=True,
728 728 )
729 729 coreconfigitem('help', br'hidden-topic\..*',
730 730 default=False,
731 731 generic=True,
732 732 )
733 733 coreconfigitem('hooks', '.*',
734 734 default=dynamicdefault,
735 735 generic=True,
736 736 )
737 737 coreconfigitem('hgweb-paths', '.*',
738 738 default=list,
739 739 generic=True,
740 740 )
741 741 coreconfigitem('hostfingerprints', '.*',
742 742 default=list,
743 743 generic=True,
744 744 )
745 745 coreconfigitem('hostsecurity', 'ciphers',
746 746 default=None,
747 747 )
748 748 coreconfigitem('hostsecurity', 'disabletls10warning',
749 749 default=False,
750 750 )
751 751 coreconfigitem('hostsecurity', 'minimumprotocol',
752 752 default=dynamicdefault,
753 753 )
754 754 coreconfigitem('hostsecurity', '.*:minimumprotocol$',
755 755 default=dynamicdefault,
756 756 generic=True,
757 757 )
758 758 coreconfigitem('hostsecurity', '.*:ciphers$',
759 759 default=dynamicdefault,
760 760 generic=True,
761 761 )
762 762 coreconfigitem('hostsecurity', '.*:fingerprints$',
763 763 default=list,
764 764 generic=True,
765 765 )
766 766 coreconfigitem('hostsecurity', '.*:verifycertsfile$',
767 767 default=None,
768 768 generic=True,
769 769 )
770 770
771 771 coreconfigitem('http_proxy', 'always',
772 772 default=False,
773 773 )
774 774 coreconfigitem('http_proxy', 'host',
775 775 default=None,
776 776 )
777 777 coreconfigitem('http_proxy', 'no',
778 778 default=list,
779 779 )
780 780 coreconfigitem('http_proxy', 'passwd',
781 781 default=None,
782 782 )
783 783 coreconfigitem('http_proxy', 'user',
784 784 default=None,
785 785 )
786 786
787 787 coreconfigitem('http', 'timeout',
788 788 default=None,
789 789 )
790 790
791 791 coreconfigitem('logtoprocess', 'commandexception',
792 792 default=None,
793 793 )
794 794 coreconfigitem('logtoprocess', 'commandfinish',
795 795 default=None,
796 796 )
797 797 coreconfigitem('logtoprocess', 'command',
798 798 default=None,
799 799 )
800 800 coreconfigitem('logtoprocess', 'develwarn',
801 801 default=None,
802 802 )
803 803 coreconfigitem('logtoprocess', 'uiblocked',
804 804 default=None,
805 805 )
806 806 coreconfigitem('merge', 'checkunknown',
807 807 default='abort',
808 808 )
809 809 coreconfigitem('merge', 'checkignored',
810 810 default='abort',
811 811 )
812 812 coreconfigitem('experimental', 'merge.checkpathconflicts',
813 813 default=False,
814 814 )
815 815 coreconfigitem('merge', 'followcopies',
816 816 default=True,
817 817 )
818 818 coreconfigitem('merge', 'on-failure',
819 819 default='continue',
820 820 )
821 821 coreconfigitem('merge', 'preferancestor',
822 822 default=lambda: ['*'],
823 823 )
824 824 coreconfigitem('merge', 'strict-capability-check',
825 825 default=False,
826 826 )
827 827 coreconfigitem('merge-tools', '.*',
828 828 default=None,
829 829 generic=True,
830 830 )
831 831 coreconfigitem('merge-tools', br'.*\.args$',
832 832 default="$local $base $other",
833 833 generic=True,
834 834 priority=-1,
835 835 )
836 836 coreconfigitem('merge-tools', br'.*\.binary$',
837 837 default=False,
838 838 generic=True,
839 839 priority=-1,
840 840 )
841 841 coreconfigitem('merge-tools', br'.*\.check$',
842 842 default=list,
843 843 generic=True,
844 844 priority=-1,
845 845 )
846 846 coreconfigitem('merge-tools', br'.*\.checkchanged$',
847 847 default=False,
848 848 generic=True,
849 849 priority=-1,
850 850 )
851 851 coreconfigitem('merge-tools', br'.*\.executable$',
852 852 default=dynamicdefault,
853 853 generic=True,
854 854 priority=-1,
855 855 )
856 856 coreconfigitem('merge-tools', br'.*\.fixeol$',
857 857 default=False,
858 858 generic=True,
859 859 priority=-1,
860 860 )
861 861 coreconfigitem('merge-tools', br'.*\.gui$',
862 862 default=False,
863 863 generic=True,
864 864 priority=-1,
865 865 )
866 866 coreconfigitem('merge-tools', br'.*\.mergemarkers$',
867 867 default='basic',
868 868 generic=True,
869 869 priority=-1,
870 870 )
871 871 coreconfigitem('merge-tools', br'.*\.mergemarkertemplate$',
872 872 default=dynamicdefault, # take from ui.mergemarkertemplate
873 873 generic=True,
874 874 priority=-1,
875 875 )
876 876 coreconfigitem('merge-tools', br'.*\.priority$',
877 877 default=0,
878 878 generic=True,
879 879 priority=-1,
880 880 )
881 881 coreconfigitem('merge-tools', br'.*\.premerge$',
882 882 default=dynamicdefault,
883 883 generic=True,
884 884 priority=-1,
885 885 )
886 886 coreconfigitem('merge-tools', br'.*\.symlink$',
887 887 default=False,
888 888 generic=True,
889 889 priority=-1,
890 890 )
891 891 coreconfigitem('pager', 'attend-.*',
892 892 default=dynamicdefault,
893 893 generic=True,
894 894 )
895 895 coreconfigitem('pager', 'ignore',
896 896 default=list,
897 897 )
898 898 coreconfigitem('pager', 'pager',
899 899 default=dynamicdefault,
900 900 )
901 901 coreconfigitem('patch', 'eol',
902 902 default='strict',
903 903 )
904 904 coreconfigitem('patch', 'fuzz',
905 905 default=2,
906 906 )
907 907 coreconfigitem('paths', 'default',
908 908 default=None,
909 909 )
910 910 coreconfigitem('paths', 'default-push',
911 911 default=None,
912 912 )
913 913 coreconfigitem('paths', '.*',
914 914 default=None,
915 915 generic=True,
916 916 )
917 917 coreconfigitem('phases', 'checksubrepos',
918 918 default='follow',
919 919 )
920 920 coreconfigitem('phases', 'new-commit',
921 921 default='draft',
922 922 )
923 923 coreconfigitem('phases', 'publish',
924 924 default=True,
925 925 )
926 926 coreconfigitem('profiling', 'enabled',
927 927 default=False,
928 928 )
929 929 coreconfigitem('profiling', 'format',
930 930 default='text',
931 931 )
932 932 coreconfigitem('profiling', 'freq',
933 933 default=1000,
934 934 )
935 935 coreconfigitem('profiling', 'limit',
936 936 default=30,
937 937 )
938 938 coreconfigitem('profiling', 'nested',
939 939 default=0,
940 940 )
941 941 coreconfigitem('profiling', 'output',
942 942 default=None,
943 943 )
944 944 coreconfigitem('profiling', 'showmax',
945 945 default=0.999,
946 946 )
947 947 coreconfigitem('profiling', 'showmin',
948 948 default=dynamicdefault,
949 949 )
950 coreconfigitem('profiling', 'showtime',
951 default=True,
952 )
950 953 coreconfigitem('profiling', 'sort',
951 954 default='inlinetime',
952 955 )
953 956 coreconfigitem('profiling', 'statformat',
954 957 default='hotpath',
955 958 )
956 959 coreconfigitem('profiling', 'time-track',
957 960 default=dynamicdefault,
958 961 )
959 962 coreconfigitem('profiling', 'type',
960 963 default='stat',
961 964 )
962 965 coreconfigitem('progress', 'assume-tty',
963 966 default=False,
964 967 )
965 968 coreconfigitem('progress', 'changedelay',
966 969 default=1,
967 970 )
968 971 coreconfigitem('progress', 'clear-complete',
969 972 default=True,
970 973 )
971 974 coreconfigitem('progress', 'debug',
972 975 default=False,
973 976 )
974 977 coreconfigitem('progress', 'delay',
975 978 default=3,
976 979 )
977 980 coreconfigitem('progress', 'disable',
978 981 default=False,
979 982 )
980 983 coreconfigitem('progress', 'estimateinterval',
981 984 default=60.0,
982 985 )
983 986 coreconfigitem('progress', 'format',
984 987 default=lambda: ['topic', 'bar', 'number', 'estimate'],
985 988 )
986 989 coreconfigitem('progress', 'refresh',
987 990 default=0.1,
988 991 )
989 992 coreconfigitem('progress', 'width',
990 993 default=dynamicdefault,
991 994 )
992 995 coreconfigitem('push', 'pushvars.server',
993 996 default=False,
994 997 )
995 998 coreconfigitem('rewrite', 'backup-bundle',
996 999 default=True,
997 1000 alias=[('ui', 'history-editing-backup')],
998 1001 )
999 1002 coreconfigitem('rewrite', 'update-timestamp',
1000 1003 default=False,
1001 1004 )
1002 1005 coreconfigitem('storage', 'new-repo-backend',
1003 1006 default='revlogv1',
1004 1007 )
1005 1008 coreconfigitem('storage', 'revlog.optimize-delta-parent-choice',
1006 1009 default=True,
1007 1010 alias=[('format', 'aggressivemergedeltas')],
1008 1011 )
1009 1012 coreconfigitem('storage', 'revlog.reuse-external-delta',
1010 1013 default=True,
1011 1014 )
1012 1015 coreconfigitem('storage', 'revlog.reuse-external-delta-parent',
1013 1016 default=None,
1014 1017 )
1015 1018 coreconfigitem('storage', 'revlog.zlib.level',
1016 1019 default=None,
1017 1020 )
1018 1021 coreconfigitem('storage', 'revlog.zstd.level',
1019 1022 default=None,
1020 1023 )
1021 1024 coreconfigitem('server', 'bookmarks-pushkey-compat',
1022 1025 default=True,
1023 1026 )
1024 1027 coreconfigitem('server', 'bundle1',
1025 1028 default=True,
1026 1029 )
1027 1030 coreconfigitem('server', 'bundle1gd',
1028 1031 default=None,
1029 1032 )
1030 1033 coreconfigitem('server', 'bundle1.pull',
1031 1034 default=None,
1032 1035 )
1033 1036 coreconfigitem('server', 'bundle1gd.pull',
1034 1037 default=None,
1035 1038 )
1036 1039 coreconfigitem('server', 'bundle1.push',
1037 1040 default=None,
1038 1041 )
1039 1042 coreconfigitem('server', 'bundle1gd.push',
1040 1043 default=None,
1041 1044 )
1042 1045 coreconfigitem('server', 'bundle2.stream',
1043 1046 default=True,
1044 1047 alias=[('experimental', 'bundle2.stream')]
1045 1048 )
1046 1049 coreconfigitem('server', 'compressionengines',
1047 1050 default=list,
1048 1051 )
1049 1052 coreconfigitem('server', 'concurrent-push-mode',
1050 1053 default='strict',
1051 1054 )
1052 1055 coreconfigitem('server', 'disablefullbundle',
1053 1056 default=False,
1054 1057 )
1055 1058 coreconfigitem('server', 'maxhttpheaderlen',
1056 1059 default=1024,
1057 1060 )
1058 1061 coreconfigitem('server', 'pullbundle',
1059 1062 default=False,
1060 1063 )
1061 1064 coreconfigitem('server', 'preferuncompressed',
1062 1065 default=False,
1063 1066 )
1064 1067 coreconfigitem('server', 'streamunbundle',
1065 1068 default=False,
1066 1069 )
1067 1070 coreconfigitem('server', 'uncompressed',
1068 1071 default=True,
1069 1072 )
1070 1073 coreconfigitem('server', 'uncompressedallowsecret',
1071 1074 default=False,
1072 1075 )
1073 1076 coreconfigitem('server', 'view',
1074 1077 default='served',
1075 1078 )
1076 1079 coreconfigitem('server', 'validate',
1077 1080 default=False,
1078 1081 )
1079 1082 coreconfigitem('server', 'zliblevel',
1080 1083 default=-1,
1081 1084 )
1082 1085 coreconfigitem('server', 'zstdlevel',
1083 1086 default=3,
1084 1087 )
1085 1088 coreconfigitem('share', 'pool',
1086 1089 default=None,
1087 1090 )
1088 1091 coreconfigitem('share', 'poolnaming',
1089 1092 default='identity',
1090 1093 )
1091 1094 coreconfigitem('smtp', 'host',
1092 1095 default=None,
1093 1096 )
1094 1097 coreconfigitem('smtp', 'local_hostname',
1095 1098 default=None,
1096 1099 )
1097 1100 coreconfigitem('smtp', 'password',
1098 1101 default=None,
1099 1102 )
1100 1103 coreconfigitem('smtp', 'port',
1101 1104 default=dynamicdefault,
1102 1105 )
1103 1106 coreconfigitem('smtp', 'tls',
1104 1107 default='none',
1105 1108 )
1106 1109 coreconfigitem('smtp', 'username',
1107 1110 default=None,
1108 1111 )
1109 1112 coreconfigitem('sparse', 'missingwarning',
1110 1113 default=True,
1111 1114 )
1112 1115 coreconfigitem('subrepos', 'allowed',
1113 1116 default=dynamicdefault, # to make backporting simpler
1114 1117 )
1115 1118 coreconfigitem('subrepos', 'hg:allowed',
1116 1119 default=dynamicdefault,
1117 1120 )
1118 1121 coreconfigitem('subrepos', 'git:allowed',
1119 1122 default=dynamicdefault,
1120 1123 )
1121 1124 coreconfigitem('subrepos', 'svn:allowed',
1122 1125 default=dynamicdefault,
1123 1126 )
1124 1127 coreconfigitem('templates', '.*',
1125 1128 default=None,
1126 1129 generic=True,
1127 1130 )
1128 1131 coreconfigitem('templateconfig', '.*',
1129 1132 default=dynamicdefault,
1130 1133 generic=True,
1131 1134 )
1132 1135 coreconfigitem('trusted', 'groups',
1133 1136 default=list,
1134 1137 )
1135 1138 coreconfigitem('trusted', 'users',
1136 1139 default=list,
1137 1140 )
1138 1141 coreconfigitem('ui', '_usedassubrepo',
1139 1142 default=False,
1140 1143 )
1141 1144 coreconfigitem('ui', 'allowemptycommit',
1142 1145 default=False,
1143 1146 )
1144 1147 coreconfigitem('ui', 'archivemeta',
1145 1148 default=True,
1146 1149 )
1147 1150 coreconfigitem('ui', 'askusername',
1148 1151 default=False,
1149 1152 )
1150 1153 coreconfigitem('ui', 'clonebundlefallback',
1151 1154 default=False,
1152 1155 )
1153 1156 coreconfigitem('ui', 'clonebundleprefers',
1154 1157 default=list,
1155 1158 )
1156 1159 coreconfigitem('ui', 'clonebundles',
1157 1160 default=True,
1158 1161 )
1159 1162 coreconfigitem('ui', 'color',
1160 1163 default='auto',
1161 1164 )
1162 1165 coreconfigitem('ui', 'commitsubrepos',
1163 1166 default=False,
1164 1167 )
1165 1168 coreconfigitem('ui', 'debug',
1166 1169 default=False,
1167 1170 )
1168 1171 coreconfigitem('ui', 'debugger',
1169 1172 default=None,
1170 1173 )
1171 1174 coreconfigitem('ui', 'editor',
1172 1175 default=dynamicdefault,
1173 1176 )
1174 1177 coreconfigitem('ui', 'fallbackencoding',
1175 1178 default=None,
1176 1179 )
1177 1180 coreconfigitem('ui', 'forcecwd',
1178 1181 default=None,
1179 1182 )
1180 1183 coreconfigitem('ui', 'forcemerge',
1181 1184 default=None,
1182 1185 )
1183 1186 coreconfigitem('ui', 'formatdebug',
1184 1187 default=False,
1185 1188 )
1186 1189 coreconfigitem('ui', 'formatjson',
1187 1190 default=False,
1188 1191 )
1189 1192 coreconfigitem('ui', 'formatted',
1190 1193 default=None,
1191 1194 )
1192 1195 coreconfigitem('ui', 'graphnodetemplate',
1193 1196 default=None,
1194 1197 )
1195 1198 coreconfigitem('ui', 'interactive',
1196 1199 default=None,
1197 1200 )
1198 1201 coreconfigitem('ui', 'interface',
1199 1202 default=None,
1200 1203 )
1201 1204 coreconfigitem('ui', 'interface.chunkselector',
1202 1205 default=None,
1203 1206 )
1204 1207 coreconfigitem('ui', 'large-file-limit',
1205 1208 default=10000000,
1206 1209 )
1207 1210 coreconfigitem('ui', 'logblockedtimes',
1208 1211 default=False,
1209 1212 )
1210 1213 coreconfigitem('ui', 'logtemplate',
1211 1214 default=None,
1212 1215 )
1213 1216 coreconfigitem('ui', 'merge',
1214 1217 default=None,
1215 1218 )
1216 1219 coreconfigitem('ui', 'mergemarkers',
1217 1220 default='basic',
1218 1221 )
1219 1222 coreconfigitem('ui', 'mergemarkertemplate',
1220 1223 default=('{node|short} '
1221 1224 '{ifeq(tags, "tip", "", '
1222 1225 'ifeq(tags, "", "", "{tags} "))}'
1223 1226 '{if(bookmarks, "{bookmarks} ")}'
1224 1227 '{ifeq(branch, "default", "", "{branch} ")}'
1225 1228 '- {author|user}: {desc|firstline}')
1226 1229 )
1227 1230 coreconfigitem('ui', 'message-output',
1228 1231 default='stdio',
1229 1232 )
1230 1233 coreconfigitem('ui', 'nontty',
1231 1234 default=False,
1232 1235 )
1233 1236 coreconfigitem('ui', 'origbackuppath',
1234 1237 default=None,
1235 1238 )
1236 1239 coreconfigitem('ui', 'paginate',
1237 1240 default=True,
1238 1241 )
1239 1242 coreconfigitem('ui', 'patch',
1240 1243 default=None,
1241 1244 )
1242 1245 coreconfigitem('ui', 'pre-merge-tool-output-template',
1243 1246 default=None,
1244 1247 )
1245 1248 coreconfigitem('ui', 'portablefilenames',
1246 1249 default='warn',
1247 1250 )
1248 1251 coreconfigitem('ui', 'promptecho',
1249 1252 default=False,
1250 1253 )
1251 1254 coreconfigitem('ui', 'quiet',
1252 1255 default=False,
1253 1256 )
1254 1257 coreconfigitem('ui', 'quietbookmarkmove',
1255 1258 default=False,
1256 1259 )
1257 1260 coreconfigitem('ui', 'relative-paths',
1258 1261 default='legacy',
1259 1262 )
1260 1263 coreconfigitem('ui', 'remotecmd',
1261 1264 default='hg',
1262 1265 )
1263 1266 coreconfigitem('ui', 'report_untrusted',
1264 1267 default=True,
1265 1268 )
1266 1269 coreconfigitem('ui', 'rollback',
1267 1270 default=True,
1268 1271 )
1269 1272 coreconfigitem('ui', 'signal-safe-lock',
1270 1273 default=True,
1271 1274 )
1272 1275 coreconfigitem('ui', 'slash',
1273 1276 default=False,
1274 1277 )
1275 1278 coreconfigitem('ui', 'ssh',
1276 1279 default='ssh',
1277 1280 )
1278 1281 coreconfigitem('ui', 'ssherrorhint',
1279 1282 default=None,
1280 1283 )
1281 1284 coreconfigitem('ui', 'statuscopies',
1282 1285 default=False,
1283 1286 )
1284 1287 coreconfigitem('ui', 'strict',
1285 1288 default=False,
1286 1289 )
1287 1290 coreconfigitem('ui', 'style',
1288 1291 default='',
1289 1292 )
1290 1293 coreconfigitem('ui', 'supportcontact',
1291 1294 default=None,
1292 1295 )
1293 1296 coreconfigitem('ui', 'textwidth',
1294 1297 default=78,
1295 1298 )
1296 1299 coreconfigitem('ui', 'timeout',
1297 1300 default='600',
1298 1301 )
1299 1302 coreconfigitem('ui', 'timeout.warn',
1300 1303 default=0,
1301 1304 )
1302 1305 coreconfigitem('ui', 'traceback',
1303 1306 default=False,
1304 1307 )
1305 1308 coreconfigitem('ui', 'tweakdefaults',
1306 1309 default=False,
1307 1310 )
1308 1311 coreconfigitem('ui', 'username',
1309 1312 alias=[('ui', 'user')]
1310 1313 )
1311 1314 coreconfigitem('ui', 'verbose',
1312 1315 default=False,
1313 1316 )
1314 1317 coreconfigitem('verify', 'skipflags',
1315 1318 default=None,
1316 1319 )
1317 1320 coreconfigitem('web', 'allowbz2',
1318 1321 default=False,
1319 1322 )
1320 1323 coreconfigitem('web', 'allowgz',
1321 1324 default=False,
1322 1325 )
1323 1326 coreconfigitem('web', 'allow-pull',
1324 1327 alias=[('web', 'allowpull')],
1325 1328 default=True,
1326 1329 )
1327 1330 coreconfigitem('web', 'allow-push',
1328 1331 alias=[('web', 'allow_push')],
1329 1332 default=list,
1330 1333 )
1331 1334 coreconfigitem('web', 'allowzip',
1332 1335 default=False,
1333 1336 )
1334 1337 coreconfigitem('web', 'archivesubrepos',
1335 1338 default=False,
1336 1339 )
1337 1340 coreconfigitem('web', 'cache',
1338 1341 default=True,
1339 1342 )
1340 1343 coreconfigitem('web', 'comparisoncontext',
1341 1344 default=5,
1342 1345 )
1343 1346 coreconfigitem('web', 'contact',
1344 1347 default=None,
1345 1348 )
1346 1349 coreconfigitem('web', 'deny_push',
1347 1350 default=list,
1348 1351 )
1349 1352 coreconfigitem('web', 'guessmime',
1350 1353 default=False,
1351 1354 )
1352 1355 coreconfigitem('web', 'hidden',
1353 1356 default=False,
1354 1357 )
1355 1358 coreconfigitem('web', 'labels',
1356 1359 default=list,
1357 1360 )
1358 1361 coreconfigitem('web', 'logoimg',
1359 1362 default='hglogo.png',
1360 1363 )
1361 1364 coreconfigitem('web', 'logourl',
1362 1365 default='https://mercurial-scm.org/',
1363 1366 )
1364 1367 coreconfigitem('web', 'accesslog',
1365 1368 default='-',
1366 1369 )
1367 1370 coreconfigitem('web', 'address',
1368 1371 default='',
1369 1372 )
1370 1373 coreconfigitem('web', 'allow-archive',
1371 1374 alias=[('web', 'allow_archive')],
1372 1375 default=list,
1373 1376 )
1374 1377 coreconfigitem('web', 'allow_read',
1375 1378 default=list,
1376 1379 )
1377 1380 coreconfigitem('web', 'baseurl',
1378 1381 default=None,
1379 1382 )
1380 1383 coreconfigitem('web', 'cacerts',
1381 1384 default=None,
1382 1385 )
1383 1386 coreconfigitem('web', 'certificate',
1384 1387 default=None,
1385 1388 )
1386 1389 coreconfigitem('web', 'collapse',
1387 1390 default=False,
1388 1391 )
1389 1392 coreconfigitem('web', 'csp',
1390 1393 default=None,
1391 1394 )
1392 1395 coreconfigitem('web', 'deny_read',
1393 1396 default=list,
1394 1397 )
1395 1398 coreconfigitem('web', 'descend',
1396 1399 default=True,
1397 1400 )
1398 1401 coreconfigitem('web', 'description',
1399 1402 default="",
1400 1403 )
1401 1404 coreconfigitem('web', 'encoding',
1402 1405 default=lambda: encoding.encoding,
1403 1406 )
1404 1407 coreconfigitem('web', 'errorlog',
1405 1408 default='-',
1406 1409 )
1407 1410 coreconfigitem('web', 'ipv6',
1408 1411 default=False,
1409 1412 )
1410 1413 coreconfigitem('web', 'maxchanges',
1411 1414 default=10,
1412 1415 )
1413 1416 coreconfigitem('web', 'maxfiles',
1414 1417 default=10,
1415 1418 )
1416 1419 coreconfigitem('web', 'maxshortchanges',
1417 1420 default=60,
1418 1421 )
1419 1422 coreconfigitem('web', 'motd',
1420 1423 default='',
1421 1424 )
1422 1425 coreconfigitem('web', 'name',
1423 1426 default=dynamicdefault,
1424 1427 )
1425 1428 coreconfigitem('web', 'port',
1426 1429 default=8000,
1427 1430 )
1428 1431 coreconfigitem('web', 'prefix',
1429 1432 default='',
1430 1433 )
1431 1434 coreconfigitem('web', 'push_ssl',
1432 1435 default=True,
1433 1436 )
1434 1437 coreconfigitem('web', 'refreshinterval',
1435 1438 default=20,
1436 1439 )
1437 1440 coreconfigitem('web', 'server-header',
1438 1441 default=None,
1439 1442 )
1440 1443 coreconfigitem('web', 'static',
1441 1444 default=None,
1442 1445 )
1443 1446 coreconfigitem('web', 'staticurl',
1444 1447 default=None,
1445 1448 )
1446 1449 coreconfigitem('web', 'stripes',
1447 1450 default=1,
1448 1451 )
1449 1452 coreconfigitem('web', 'style',
1450 1453 default='paper',
1451 1454 )
1452 1455 coreconfigitem('web', 'templates',
1453 1456 default=None,
1454 1457 )
1455 1458 coreconfigitem('web', 'view',
1456 1459 default='served',
1457 1460 )
1458 1461 coreconfigitem('worker', 'backgroundclose',
1459 1462 default=dynamicdefault,
1460 1463 )
1461 1464 # Windows defaults to a limit of 512 open files. A buffer of 128
1462 1465 # should give us enough headway.
1463 1466 coreconfigitem('worker', 'backgroundclosemaxqueue',
1464 1467 default=384,
1465 1468 )
1466 1469 coreconfigitem('worker', 'backgroundcloseminfilecount',
1467 1470 default=2048,
1468 1471 )
1469 1472 coreconfigitem('worker', 'backgroundclosethreadcount',
1470 1473 default=4,
1471 1474 )
1472 1475 coreconfigitem('worker', 'enabled',
1473 1476 default=True,
1474 1477 )
1475 1478 coreconfigitem('worker', 'numcpus',
1476 1479 default=None,
1477 1480 )
1478 1481
1479 1482 # Rebase related configuration moved to core because other extension are doing
1480 1483 # strange things. For example, shelve import the extensions to reuse some bit
1481 1484 # without formally loading it.
1482 1485 coreconfigitem('commands', 'rebase.requiredest',
1483 1486 default=False,
1484 1487 )
1485 1488 coreconfigitem('experimental', 'rebaseskipobsolete',
1486 1489 default=True,
1487 1490 )
1488 1491 coreconfigitem('rebase', 'singletransaction',
1489 1492 default=False,
1490 1493 )
1491 1494 coreconfigitem('rebase', 'experimental.inmemory',
1492 1495 default=False,
1493 1496 )
@@ -1,2856 +1,2861
1 1 The Mercurial system uses a set of configuration files to control
2 2 aspects of its behavior.
3 3
4 4 Troubleshooting
5 5 ===============
6 6
7 7 If you're having problems with your configuration,
8 8 :hg:`config --debug` can help you understand what is introducing
9 9 a setting into your environment.
10 10
11 11 See :hg:`help config.syntax` and :hg:`help config.files`
12 12 for information about how and where to override things.
13 13
14 14 Structure
15 15 =========
16 16
17 17 The configuration files use a simple ini-file format. A configuration
18 18 file consists of sections, led by a ``[section]`` header and followed
19 19 by ``name = value`` entries::
20 20
21 21 [ui]
22 22 username = Firstname Lastname <firstname.lastname@example.net>
23 23 verbose = True
24 24
25 25 The above entries will be referred to as ``ui.username`` and
26 26 ``ui.verbose``, respectively. See :hg:`help config.syntax`.
27 27
28 28 Files
29 29 =====
30 30
31 31 Mercurial reads configuration data from several files, if they exist.
32 32 These files do not exist by default and you will have to create the
33 33 appropriate configuration files yourself:
34 34
35 35 Local configuration is put into the per-repository ``<repo>/.hg/hgrc`` file.
36 36
37 37 Global configuration like the username setting is typically put into:
38 38
39 39 .. container:: windows
40 40
41 41 - ``%USERPROFILE%\mercurial.ini`` (on Windows)
42 42
43 43 .. container:: unix.plan9
44 44
45 45 - ``$HOME/.hgrc`` (on Unix, Plan9)
46 46
47 47 The names of these files depend on the system on which Mercurial is
48 48 installed. ``*.rc`` files from a single directory are read in
49 49 alphabetical order, later ones overriding earlier ones. Where multiple
50 50 paths are given below, settings from earlier paths override later
51 51 ones.
52 52
53 53 .. container:: verbose.unix
54 54
55 55 On Unix, the following files are consulted:
56 56
57 57 - ``<repo>/.hg/hgrc`` (per-repository)
58 58 - ``$HOME/.hgrc`` (per-user)
59 59 - ``${XDG_CONFIG_HOME:-$HOME/.config}/hg/hgrc`` (per-user)
60 60 - ``<install-root>/etc/mercurial/hgrc`` (per-installation)
61 61 - ``<install-root>/etc/mercurial/hgrc.d/*.rc`` (per-installation)
62 62 - ``/etc/mercurial/hgrc`` (per-system)
63 63 - ``/etc/mercurial/hgrc.d/*.rc`` (per-system)
64 64 - ``<internal>/default.d/*.rc`` (defaults)
65 65
66 66 .. container:: verbose.windows
67 67
68 68 On Windows, the following files are consulted:
69 69
70 70 - ``<repo>/.hg/hgrc`` (per-repository)
71 71 - ``%USERPROFILE%\.hgrc`` (per-user)
72 72 - ``%USERPROFILE%\Mercurial.ini`` (per-user)
73 73 - ``%HOME%\.hgrc`` (per-user)
74 74 - ``%HOME%\Mercurial.ini`` (per-user)
75 75 - ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` (per-installation)
76 76 - ``<install-dir>\hgrc.d\*.rc`` (per-installation)
77 77 - ``<install-dir>\Mercurial.ini`` (per-installation)
78 78 - ``<internal>/default.d/*.rc`` (defaults)
79 79
80 80 .. note::
81 81
82 82 The registry key ``HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mercurial``
83 83 is used when running 32-bit Python on 64-bit Windows.
84 84
85 85 .. container:: windows
86 86
87 87 On Windows 9x, ``%HOME%`` is replaced by ``%APPDATA%``.
88 88
89 89 .. container:: verbose.plan9
90 90
91 91 On Plan9, the following files are consulted:
92 92
93 93 - ``<repo>/.hg/hgrc`` (per-repository)
94 94 - ``$home/lib/hgrc`` (per-user)
95 95 - ``<install-root>/lib/mercurial/hgrc`` (per-installation)
96 96 - ``<install-root>/lib/mercurial/hgrc.d/*.rc`` (per-installation)
97 97 - ``/lib/mercurial/hgrc`` (per-system)
98 98 - ``/lib/mercurial/hgrc.d/*.rc`` (per-system)
99 99 - ``<internal>/default.d/*.rc`` (defaults)
100 100
101 101 Per-repository configuration options only apply in a
102 102 particular repository. This file is not version-controlled, and
103 103 will not get transferred during a "clone" operation. Options in
104 104 this file override options in all other configuration files.
105 105
106 106 .. container:: unix.plan9
107 107
108 108 On Plan 9 and Unix, most of this file will be ignored if it doesn't
109 109 belong to a trusted user or to a trusted group. See
110 110 :hg:`help config.trusted` for more details.
111 111
112 112 Per-user configuration file(s) are for the user running Mercurial. Options
113 113 in these files apply to all Mercurial commands executed by this user in any
114 114 directory. Options in these files override per-system and per-installation
115 115 options.
116 116
117 117 Per-installation configuration files are searched for in the
118 118 directory where Mercurial is installed. ``<install-root>`` is the
119 119 parent directory of the **hg** executable (or symlink) being run.
120 120
121 121 .. container:: unix.plan9
122 122
123 123 For example, if installed in ``/shared/tools/bin/hg``, Mercurial
124 124 will look in ``/shared/tools/etc/mercurial/hgrc``. Options in these
125 125 files apply to all Mercurial commands executed by any user in any
126 126 directory.
127 127
128 128 Per-installation configuration files are for the system on
129 129 which Mercurial is running. Options in these files apply to all
130 130 Mercurial commands executed by any user in any directory. Registry
131 131 keys contain PATH-like strings, every part of which must reference
132 132 a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will
133 133 be read. Mercurial checks each of these locations in the specified
134 134 order until one or more configuration files are detected.
135 135
136 136 Per-system configuration files are for the system on which Mercurial
137 137 is running. Options in these files apply to all Mercurial commands
138 138 executed by any user in any directory. Options in these files
139 139 override per-installation options.
140 140
141 141 Mercurial comes with some default configuration. The default configuration
142 142 files are installed with Mercurial and will be overwritten on upgrades. Default
143 143 configuration files should never be edited by users or administrators but can
144 144 be overridden in other configuration files. So far the directory only contains
145 145 merge tool configuration but packagers can also put other default configuration
146 146 there.
147 147
148 148 Syntax
149 149 ======
150 150
151 151 A configuration file consists of sections, led by a ``[section]`` header
152 152 and followed by ``name = value`` entries (sometimes called
153 153 ``configuration keys``)::
154 154
155 155 [spam]
156 156 eggs=ham
157 157 green=
158 158 eggs
159 159
160 160 Each line contains one entry. If the lines that follow are indented,
161 161 they are treated as continuations of that entry. Leading whitespace is
162 162 removed from values. Empty lines are skipped. Lines beginning with
163 163 ``#`` or ``;`` are ignored and may be used to provide comments.
164 164
165 165 Configuration keys can be set multiple times, in which case Mercurial
166 166 will use the value that was configured last. As an example::
167 167
168 168 [spam]
169 169 eggs=large
170 170 ham=serrano
171 171 eggs=small
172 172
173 173 This would set the configuration key named ``eggs`` to ``small``.
174 174
175 175 It is also possible to define a section multiple times. A section can
176 176 be redefined on the same and/or on different configuration files. For
177 177 example::
178 178
179 179 [foo]
180 180 eggs=large
181 181 ham=serrano
182 182 eggs=small
183 183
184 184 [bar]
185 185 eggs=ham
186 186 green=
187 187 eggs
188 188
189 189 [foo]
190 190 ham=prosciutto
191 191 eggs=medium
192 192 bread=toasted
193 193
194 194 This would set the ``eggs``, ``ham``, and ``bread`` configuration keys
195 195 of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``,
196 196 respectively. As you can see there only thing that matters is the last
197 197 value that was set for each of the configuration keys.
198 198
199 199 If a configuration key is set multiple times in different
200 200 configuration files the final value will depend on the order in which
201 201 the different configuration files are read, with settings from earlier
202 202 paths overriding later ones as described on the ``Files`` section
203 203 above.
204 204
205 205 A line of the form ``%include file`` will include ``file`` into the
206 206 current configuration file. The inclusion is recursive, which means
207 207 that included files can include other files. Filenames are relative to
208 208 the configuration file in which the ``%include`` directive is found.
209 209 Environment variables and ``~user`` constructs are expanded in
210 210 ``file``. This lets you do something like::
211 211
212 212 %include ~/.hgrc.d/$HOST.rc
213 213
214 214 to include a different configuration file on each computer you use.
215 215
216 216 A line with ``%unset name`` will remove ``name`` from the current
217 217 section, if it has been set previously.
218 218
219 219 The values are either free-form text strings, lists of text strings,
220 220 or Boolean values. Boolean values can be set to true using any of "1",
221 221 "yes", "true", or "on" and to false using "0", "no", "false", or "off"
222 222 (all case insensitive).
223 223
224 224 List values are separated by whitespace or comma, except when values are
225 225 placed in double quotation marks::
226 226
227 227 allow_read = "John Doe, PhD", brian, betty
228 228
229 229 Quotation marks can be escaped by prefixing them with a backslash. Only
230 230 quotation marks at the beginning of a word is counted as a quotation
231 231 (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``).
232 232
233 233 Sections
234 234 ========
235 235
236 236 This section describes the different sections that may appear in a
237 237 Mercurial configuration file, the purpose of each section, its possible
238 238 keys, and their possible values.
239 239
240 240 ``alias``
241 241 ---------
242 242
243 243 Defines command aliases.
244 244
245 245 Aliases allow you to define your own commands in terms of other
246 246 commands (or aliases), optionally including arguments. Positional
247 247 arguments in the form of ``$1``, ``$2``, etc. in the alias definition
248 248 are expanded by Mercurial before execution. Positional arguments not
249 249 already used by ``$N`` in the definition are put at the end of the
250 250 command to be executed.
251 251
252 252 Alias definitions consist of lines of the form::
253 253
254 254 <alias> = <command> [<argument>]...
255 255
256 256 For example, this definition::
257 257
258 258 latest = log --limit 5
259 259
260 260 creates a new command ``latest`` that shows only the five most recent
261 261 changesets. You can define subsequent aliases using earlier ones::
262 262
263 263 stable5 = latest -b stable
264 264
265 265 .. note::
266 266
267 267 It is possible to create aliases with the same names as
268 268 existing commands, which will then override the original
269 269 definitions. This is almost always a bad idea!
270 270
271 271 An alias can start with an exclamation point (``!``) to make it a
272 272 shell alias. A shell alias is executed with the shell and will let you
273 273 run arbitrary commands. As an example, ::
274 274
275 275 echo = !echo $@
276 276
277 277 will let you do ``hg echo foo`` to have ``foo`` printed in your
278 278 terminal. A better example might be::
279 279
280 280 purge = !$HG status --no-status --unknown -0 re: | xargs -0 rm -f
281 281
282 282 which will make ``hg purge`` delete all unknown files in the
283 283 repository in the same manner as the purge extension.
284 284
285 285 Positional arguments like ``$1``, ``$2``, etc. in the alias definition
286 286 expand to the command arguments. Unmatched arguments are
287 287 removed. ``$0`` expands to the alias name and ``$@`` expands to all
288 288 arguments separated by a space. ``"$@"`` (with quotes) expands to all
289 289 arguments quoted individually and separated by a space. These expansions
290 290 happen before the command is passed to the shell.
291 291
292 292 Shell aliases are executed in an environment where ``$HG`` expands to
293 293 the path of the Mercurial that was used to execute the alias. This is
294 294 useful when you want to call further Mercurial commands in a shell
295 295 alias, as was done above for the purge alias. In addition,
296 296 ``$HG_ARGS`` expands to the arguments given to Mercurial. In the ``hg
297 297 echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``.
298 298
299 299 .. note::
300 300
301 301 Some global configuration options such as ``-R`` are
302 302 processed before shell aliases and will thus not be passed to
303 303 aliases.
304 304
305 305
306 306 ``annotate``
307 307 ------------
308 308
309 309 Settings used when displaying file annotations. All values are
310 310 Booleans and default to False. See :hg:`help config.diff` for
311 311 related options for the diff command.
312 312
313 313 ``ignorews``
314 314 Ignore white space when comparing lines.
315 315
316 316 ``ignorewseol``
317 317 Ignore white space at the end of a line when comparing lines.
318 318
319 319 ``ignorewsamount``
320 320 Ignore changes in the amount of white space.
321 321
322 322 ``ignoreblanklines``
323 323 Ignore changes whose lines are all blank.
324 324
325 325
326 326 ``auth``
327 327 --------
328 328
329 329 Authentication credentials and other authentication-like configuration
330 330 for HTTP connections. This section allows you to store usernames and
331 331 passwords for use when logging *into* HTTP servers. See
332 332 :hg:`help config.web` if you want to configure *who* can login to
333 333 your HTTP server.
334 334
335 335 The following options apply to all hosts.
336 336
337 337 ``cookiefile``
338 338 Path to a file containing HTTP cookie lines. Cookies matching a
339 339 host will be sent automatically.
340 340
341 341 The file format uses the Mozilla cookies.txt format, which defines cookies
342 342 on their own lines. Each line contains 7 fields delimited by the tab
343 343 character (domain, is_domain_cookie, path, is_secure, expires, name,
344 344 value). For more info, do an Internet search for "Netscape cookies.txt
345 345 format."
346 346
347 347 Note: the cookies parser does not handle port numbers on domains. You
348 348 will need to remove ports from the domain for the cookie to be recognized.
349 349 This could result in a cookie being disclosed to an unwanted server.
350 350
351 351 The cookies file is read-only.
352 352
353 353 Other options in this section are grouped by name and have the following
354 354 format::
355 355
356 356 <name>.<argument> = <value>
357 357
358 358 where ``<name>`` is used to group arguments into authentication
359 359 entries. Example::
360 360
361 361 foo.prefix = hg.intevation.de/mercurial
362 362 foo.username = foo
363 363 foo.password = bar
364 364 foo.schemes = http https
365 365
366 366 bar.prefix = secure.example.org
367 367 bar.key = path/to/file.key
368 368 bar.cert = path/to/file.cert
369 369 bar.schemes = https
370 370
371 371 Supported arguments:
372 372
373 373 ``prefix``
374 374 Either ``*`` or a URI prefix with or without the scheme part.
375 375 The authentication entry with the longest matching prefix is used
376 376 (where ``*`` matches everything and counts as a match of length
377 377 1). If the prefix doesn't include a scheme, the match is performed
378 378 against the URI with its scheme stripped as well, and the schemes
379 379 argument, q.v., is then subsequently consulted.
380 380
381 381 ``username``
382 382 Optional. Username to authenticate with. If not given, and the
383 383 remote site requires basic or digest authentication, the user will
384 384 be prompted for it. Environment variables are expanded in the
385 385 username letting you do ``foo.username = $USER``. If the URI
386 386 includes a username, only ``[auth]`` entries with a matching
387 387 username or without a username will be considered.
388 388
389 389 ``password``
390 390 Optional. Password to authenticate with. If not given, and the
391 391 remote site requires basic or digest authentication, the user
392 392 will be prompted for it.
393 393
394 394 ``key``
395 395 Optional. PEM encoded client certificate key file. Environment
396 396 variables are expanded in the filename.
397 397
398 398 ``cert``
399 399 Optional. PEM encoded client certificate chain file. Environment
400 400 variables are expanded in the filename.
401 401
402 402 ``schemes``
403 403 Optional. Space separated list of URI schemes to use this
404 404 authentication entry with. Only used if the prefix doesn't include
405 405 a scheme. Supported schemes are http and https. They will match
406 406 static-http and static-https respectively, as well.
407 407 (default: https)
408 408
409 409 If no suitable authentication entry is found, the user is prompted
410 410 for credentials as usual if required by the remote.
411 411
412 412 ``color``
413 413 ---------
414 414
415 415 Configure the Mercurial color mode. For details about how to define your custom
416 416 effect and style see :hg:`help color`.
417 417
418 418 ``mode``
419 419 String: control the method used to output color. One of ``auto``, ``ansi``,
420 420 ``win32``, ``terminfo`` or ``debug``. In auto mode, Mercurial will
421 421 use ANSI mode by default (or win32 mode prior to Windows 10) if it detects a
422 422 terminal. Any invalid value will disable color.
423 423
424 424 ``pagermode``
425 425 String: optional override of ``color.mode`` used with pager.
426 426
427 427 On some systems, terminfo mode may cause problems when using
428 428 color with ``less -R`` as a pager program. less with the -R option
429 429 will only display ECMA-48 color codes, and terminfo mode may sometimes
430 430 emit codes that less doesn't understand. You can work around this by
431 431 either using ansi mode (or auto mode), or by using less -r (which will
432 432 pass through all terminal control codes, not just color control
433 433 codes).
434 434
435 435 On some systems (such as MSYS in Windows), the terminal may support
436 436 a different color mode than the pager program.
437 437
438 438 ``commands``
439 439 ------------
440 440
441 441 ``commit.post-status``
442 442 Show status of files in the working directory after successful commit.
443 443 (default: False)
444 444
445 445 ``resolve.confirm``
446 446 Confirm before performing action if no filename is passed.
447 447 (default: False)
448 448
449 449 ``resolve.explicit-re-merge``
450 450 Require uses of ``hg resolve`` to specify which action it should perform,
451 451 instead of re-merging files by default.
452 452 (default: False)
453 453
454 454 ``resolve.mark-check``
455 455 Determines what level of checking :hg:`resolve --mark` will perform before
456 456 marking files as resolved. Valid values are ``none`, ``warn``, and
457 457 ``abort``. ``warn`` will output a warning listing the file(s) that still
458 458 have conflict markers in them, but will still mark everything resolved.
459 459 ``abort`` will output the same warning but will not mark things as resolved.
460 460 If --all is passed and this is set to ``abort``, only a warning will be
461 461 shown (an error will not be raised).
462 462 (default: ``none``)
463 463
464 464 ``status.relative``
465 465 Make paths in :hg:`status` output relative to the current directory.
466 466 (default: False)
467 467
468 468 ``status.terse``
469 469 Default value for the --terse flag, which condenses status output.
470 470 (default: empty)
471 471
472 472 ``update.check``
473 473 Determines what level of checking :hg:`update` will perform before moving
474 474 to a destination revision. Valid values are ``abort``, ``none``,
475 475 ``linear``, and ``noconflict``. ``abort`` always fails if the working
476 476 directory has uncommitted changes. ``none`` performs no checking, and may
477 477 result in a merge with uncommitted changes. ``linear`` allows any update
478 478 as long as it follows a straight line in the revision history, and may
479 479 trigger a merge with uncommitted changes. ``noconflict`` will allow any
480 480 update which would not trigger a merge with uncommitted changes, if any
481 481 are present.
482 482 (default: ``linear``)
483 483
484 484 ``update.requiredest``
485 485 Require that the user pass a destination when running :hg:`update`.
486 486 For example, :hg:`update .::` will be allowed, but a plain :hg:`update`
487 487 will be disallowed.
488 488 (default: False)
489 489
490 490 ``committemplate``
491 491 ------------------
492 492
493 493 ``changeset``
494 494 String: configuration in this section is used as the template to
495 495 customize the text shown in the editor when committing.
496 496
497 497 In addition to pre-defined template keywords, commit log specific one
498 498 below can be used for customization:
499 499
500 500 ``extramsg``
501 501 String: Extra message (typically 'Leave message empty to abort
502 502 commit.'). This may be changed by some commands or extensions.
503 503
504 504 For example, the template configuration below shows as same text as
505 505 one shown by default::
506 506
507 507 [committemplate]
508 508 changeset = {desc}\n\n
509 509 HG: Enter commit message. Lines beginning with 'HG:' are removed.
510 510 HG: {extramsg}
511 511 HG: --
512 512 HG: user: {author}\n{ifeq(p2rev, "-1", "",
513 513 "HG: branch merge\n")
514 514 }HG: branch '{branch}'\n{if(activebookmark,
515 515 "HG: bookmark '{activebookmark}'\n") }{subrepos %
516 516 "HG: subrepo {subrepo}\n" }{file_adds %
517 517 "HG: added {file}\n" }{file_mods %
518 518 "HG: changed {file}\n" }{file_dels %
519 519 "HG: removed {file}\n" }{if(files, "",
520 520 "HG: no files changed\n")}
521 521
522 522 ``diff()``
523 523 String: show the diff (see :hg:`help templates` for detail)
524 524
525 525 Sometimes it is helpful to show the diff of the changeset in the editor without
526 526 having to prefix 'HG: ' to each line so that highlighting works correctly. For
527 527 this, Mercurial provides a special string which will ignore everything below
528 528 it::
529 529
530 530 HG: ------------------------ >8 ------------------------
531 531
532 532 For example, the template configuration below will show the diff below the
533 533 extra message::
534 534
535 535 [committemplate]
536 536 changeset = {desc}\n\n
537 537 HG: Enter commit message. Lines beginning with 'HG:' are removed.
538 538 HG: {extramsg}
539 539 HG: ------------------------ >8 ------------------------
540 540 HG: Do not touch the line above.
541 541 HG: Everything below will be removed.
542 542 {diff()}
543 543
544 544 .. note::
545 545
546 546 For some problematic encodings (see :hg:`help win32mbcs` for
547 547 detail), this customization should be configured carefully, to
548 548 avoid showing broken characters.
549 549
550 550 For example, if a multibyte character ending with backslash (0x5c) is
551 551 followed by the ASCII character 'n' in the customized template,
552 552 the sequence of backslash and 'n' is treated as line-feed unexpectedly
553 553 (and the multibyte character is broken, too).
554 554
555 555 Customized template is used for commands below (``--edit`` may be
556 556 required):
557 557
558 558 - :hg:`backout`
559 559 - :hg:`commit`
560 560 - :hg:`fetch` (for merge commit only)
561 561 - :hg:`graft`
562 562 - :hg:`histedit`
563 563 - :hg:`import`
564 564 - :hg:`qfold`, :hg:`qnew` and :hg:`qrefresh`
565 565 - :hg:`rebase`
566 566 - :hg:`shelve`
567 567 - :hg:`sign`
568 568 - :hg:`tag`
569 569 - :hg:`transplant`
570 570
571 571 Configuring items below instead of ``changeset`` allows showing
572 572 customized message only for specific actions, or showing different
573 573 messages for each action.
574 574
575 575 - ``changeset.backout`` for :hg:`backout`
576 576 - ``changeset.commit.amend.merge`` for :hg:`commit --amend` on merges
577 577 - ``changeset.commit.amend.normal`` for :hg:`commit --amend` on other
578 578 - ``changeset.commit.normal.merge`` for :hg:`commit` on merges
579 579 - ``changeset.commit.normal.normal`` for :hg:`commit` on other
580 580 - ``changeset.fetch`` for :hg:`fetch` (impling merge commit)
581 581 - ``changeset.gpg.sign`` for :hg:`sign`
582 582 - ``changeset.graft`` for :hg:`graft`
583 583 - ``changeset.histedit.edit`` for ``edit`` of :hg:`histedit`
584 584 - ``changeset.histedit.fold`` for ``fold`` of :hg:`histedit`
585 585 - ``changeset.histedit.mess`` for ``mess`` of :hg:`histedit`
586 586 - ``changeset.histedit.pick`` for ``pick`` of :hg:`histedit`
587 587 - ``changeset.import.bypass`` for :hg:`import --bypass`
588 588 - ``changeset.import.normal.merge`` for :hg:`import` on merges
589 589 - ``changeset.import.normal.normal`` for :hg:`import` on other
590 590 - ``changeset.mq.qnew`` for :hg:`qnew`
591 591 - ``changeset.mq.qfold`` for :hg:`qfold`
592 592 - ``changeset.mq.qrefresh`` for :hg:`qrefresh`
593 593 - ``changeset.rebase.collapse`` for :hg:`rebase --collapse`
594 594 - ``changeset.rebase.merge`` for :hg:`rebase` on merges
595 595 - ``changeset.rebase.normal`` for :hg:`rebase` on other
596 596 - ``changeset.shelve.shelve`` for :hg:`shelve`
597 597 - ``changeset.tag.add`` for :hg:`tag` without ``--remove``
598 598 - ``changeset.tag.remove`` for :hg:`tag --remove`
599 599 - ``changeset.transplant.merge`` for :hg:`transplant` on merges
600 600 - ``changeset.transplant.normal`` for :hg:`transplant` on other
601 601
602 602 These dot-separated lists of names are treated as hierarchical ones.
603 603 For example, ``changeset.tag.remove`` customizes the commit message
604 604 only for :hg:`tag --remove`, but ``changeset.tag`` customizes the
605 605 commit message for :hg:`tag` regardless of ``--remove`` option.
606 606
607 607 When the external editor is invoked for a commit, the corresponding
608 608 dot-separated list of names without the ``changeset.`` prefix
609 609 (e.g. ``commit.normal.normal``) is in the ``HGEDITFORM`` environment
610 610 variable.
611 611
612 612 In this section, items other than ``changeset`` can be referred from
613 613 others. For example, the configuration to list committed files up
614 614 below can be referred as ``{listupfiles}``::
615 615
616 616 [committemplate]
617 617 listupfiles = {file_adds %
618 618 "HG: added {file}\n" }{file_mods %
619 619 "HG: changed {file}\n" }{file_dels %
620 620 "HG: removed {file}\n" }{if(files, "",
621 621 "HG: no files changed\n")}
622 622
623 623 ``decode/encode``
624 624 -----------------
625 625
626 626 Filters for transforming files on checkout/checkin. This would
627 627 typically be used for newline processing or other
628 628 localization/canonicalization of files.
629 629
630 630 Filters consist of a filter pattern followed by a filter command.
631 631 Filter patterns are globs by default, rooted at the repository root.
632 632 For example, to match any file ending in ``.txt`` in the root
633 633 directory only, use the pattern ``*.txt``. To match any file ending
634 634 in ``.c`` anywhere in the repository, use the pattern ``**.c``.
635 635 For each file only the first matching filter applies.
636 636
637 637 The filter command can start with a specifier, either ``pipe:`` or
638 638 ``tempfile:``. If no specifier is given, ``pipe:`` is used by default.
639 639
640 640 A ``pipe:`` command must accept data on stdin and return the transformed
641 641 data on stdout.
642 642
643 643 Pipe example::
644 644
645 645 [encode]
646 646 # uncompress gzip files on checkin to improve delta compression
647 647 # note: not necessarily a good idea, just an example
648 648 *.gz = pipe: gunzip
649 649
650 650 [decode]
651 651 # recompress gzip files when writing them to the working dir (we
652 652 # can safely omit "pipe:", because it's the default)
653 653 *.gz = gzip
654 654
655 655 A ``tempfile:`` command is a template. The string ``INFILE`` is replaced
656 656 with the name of a temporary file that contains the data to be
657 657 filtered by the command. The string ``OUTFILE`` is replaced with the name
658 658 of an empty temporary file, where the filtered data must be written by
659 659 the command.
660 660
661 661 .. container:: windows
662 662
663 663 .. note::
664 664
665 665 The tempfile mechanism is recommended for Windows systems,
666 666 where the standard shell I/O redirection operators often have
667 667 strange effects and may corrupt the contents of your files.
668 668
669 669 This filter mechanism is used internally by the ``eol`` extension to
670 670 translate line ending characters between Windows (CRLF) and Unix (LF)
671 671 format. We suggest you use the ``eol`` extension for convenience.
672 672
673 673
674 674 ``defaults``
675 675 ------------
676 676
677 677 (defaults are deprecated. Don't use them. Use aliases instead.)
678 678
679 679 Use the ``[defaults]`` section to define command defaults, i.e. the
680 680 default options/arguments to pass to the specified commands.
681 681
682 682 The following example makes :hg:`log` run in verbose mode, and
683 683 :hg:`status` show only the modified files, by default::
684 684
685 685 [defaults]
686 686 log = -v
687 687 status = -m
688 688
689 689 The actual commands, instead of their aliases, must be used when
690 690 defining command defaults. The command defaults will also be applied
691 691 to the aliases of the commands defined.
692 692
693 693
694 694 ``diff``
695 695 --------
696 696
697 697 Settings used when displaying diffs. Everything except for ``unified``
698 698 is a Boolean and defaults to False. See :hg:`help config.annotate`
699 699 for related options for the annotate command.
700 700
701 701 ``git``
702 702 Use git extended diff format.
703 703
704 704 ``nobinary``
705 705 Omit git binary patches.
706 706
707 707 ``nodates``
708 708 Don't include dates in diff headers.
709 709
710 710 ``noprefix``
711 711 Omit 'a/' and 'b/' prefixes from filenames. Ignored in plain mode.
712 712
713 713 ``showfunc``
714 714 Show which function each change is in.
715 715
716 716 ``ignorews``
717 717 Ignore white space when comparing lines.
718 718
719 719 ``ignorewsamount``
720 720 Ignore changes in the amount of white space.
721 721
722 722 ``ignoreblanklines``
723 723 Ignore changes whose lines are all blank.
724 724
725 725 ``unified``
726 726 Number of lines of context to show.
727 727
728 728 ``word-diff``
729 729 Highlight changed words.
730 730
731 731 ``email``
732 732 ---------
733 733
734 734 Settings for extensions that send email messages.
735 735
736 736 ``from``
737 737 Optional. Email address to use in "From" header and SMTP envelope
738 738 of outgoing messages.
739 739
740 740 ``to``
741 741 Optional. Comma-separated list of recipients' email addresses.
742 742
743 743 ``cc``
744 744 Optional. Comma-separated list of carbon copy recipients'
745 745 email addresses.
746 746
747 747 ``bcc``
748 748 Optional. Comma-separated list of blind carbon copy recipients'
749 749 email addresses.
750 750
751 751 ``method``
752 752 Optional. Method to use to send email messages. If value is ``smtp``
753 753 (default), use SMTP (see the ``[smtp]`` section for configuration).
754 754 Otherwise, use as name of program to run that acts like sendmail
755 755 (takes ``-f`` option for sender, list of recipients on command line,
756 756 message on stdin). Normally, setting this to ``sendmail`` or
757 757 ``/usr/sbin/sendmail`` is enough to use sendmail to send messages.
758 758
759 759 ``charsets``
760 760 Optional. Comma-separated list of character sets considered
761 761 convenient for recipients. Addresses, headers, and parts not
762 762 containing patches of outgoing messages will be encoded in the
763 763 first character set to which conversion from local encoding
764 764 (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct
765 765 conversion fails, the text in question is sent as is.
766 766 (default: '')
767 767
768 768 Order of outgoing email character sets:
769 769
770 770 1. ``us-ascii``: always first, regardless of settings
771 771 2. ``email.charsets``: in order given by user
772 772 3. ``ui.fallbackencoding``: if not in email.charsets
773 773 4. ``$HGENCODING``: if not in email.charsets
774 774 5. ``utf-8``: always last, regardless of settings
775 775
776 776 Email example::
777 777
778 778 [email]
779 779 from = Joseph User <joe.user@example.com>
780 780 method = /usr/sbin/sendmail
781 781 # charsets for western Europeans
782 782 # us-ascii, utf-8 omitted, as they are tried first and last
783 783 charsets = iso-8859-1, iso-8859-15, windows-1252
784 784
785 785
786 786 ``extensions``
787 787 --------------
788 788
789 789 Mercurial has an extension mechanism for adding new features. To
790 790 enable an extension, create an entry for it in this section.
791 791
792 792 If you know that the extension is already in Python's search path,
793 793 you can give the name of the module, followed by ``=``, with nothing
794 794 after the ``=``.
795 795
796 796 Otherwise, give a name that you choose, followed by ``=``, followed by
797 797 the path to the ``.py`` file (including the file name extension) that
798 798 defines the extension.
799 799
800 800 To explicitly disable an extension that is enabled in an hgrc of
801 801 broader scope, prepend its path with ``!``, as in ``foo = !/ext/path``
802 802 or ``foo = !`` when path is not supplied.
803 803
804 804 Example for ``~/.hgrc``::
805 805
806 806 [extensions]
807 807 # (the churn extension will get loaded from Mercurial's path)
808 808 churn =
809 809 # (this extension will get loaded from the file specified)
810 810 myfeature = ~/.hgext/myfeature.py
811 811
812 812
813 813 ``format``
814 814 ----------
815 815
816 816 Configuration that controls the repository format. Newer format options are more
817 817 powerful but incompatible with some older versions of Mercurial. Format options
818 818 are considered at repository initialization only. You need to make a new clone
819 819 for config change to be taken into account.
820 820
821 821 For more details about repository format and version compatibility, see
822 822 https://www.mercurial-scm.org/wiki/MissingRequirement
823 823
824 824 ``usegeneraldelta``
825 825 Enable or disable the "generaldelta" repository format which improves
826 826 repository compression by allowing "revlog" to store delta against arbitrary
827 827 revision instead of the previous stored one. This provides significant
828 828 improvement for repositories with branches.
829 829
830 830 Repositories with this on-disk format require Mercurial version 1.9.
831 831
832 832 Enabled by default.
833 833
834 834 ``dotencode``
835 835 Enable or disable the "dotencode" repository format which enhances
836 836 the "fncache" repository format (which has to be enabled to use
837 837 dotencode) to avoid issues with filenames starting with ._ on
838 838 Mac OS X and spaces on Windows.
839 839
840 840 Repositories with this on-disk format require Mercurial version 1.7.
841 841
842 842 Enabled by default.
843 843
844 844 ``usefncache``
845 845 Enable or disable the "fncache" repository format which enhances
846 846 the "store" repository format (which has to be enabled to use
847 847 fncache) to allow longer filenames and avoids using Windows
848 848 reserved names, e.g. "nul".
849 849
850 850 Repositories with this on-disk format require Mercurial version 1.1.
851 851
852 852 Enabled by default.
853 853
854 854 ``usestore``
855 855 Enable or disable the "store" repository format which improves
856 856 compatibility with systems that fold case or otherwise mangle
857 857 filenames. Disabling this option will allow you to store longer filenames
858 858 in some situations at the expense of compatibility.
859 859
860 860 Repositories with this on-disk format require Mercurial version 0.9.4.
861 861
862 862 Enabled by default.
863 863
864 864 ``sparse-revlog``
865 865 Enable or disable the ``sparse-revlog`` delta strategy. This format improves
866 866 delta re-use inside revlog. For very branchy repositories, it results in a
867 867 smaller store. For repositories with many revisions, it also helps
868 868 performance (by using shortened delta chains.)
869 869
870 870 Repositories with this on-disk format require Mercurial version 4.7
871 871
872 872 Enabled by default.
873 873
874 874 ``revlog-compression``
875 875 Compression algorithm used by revlog. Supported value are `zlib` and `zstd`.
876 876 The `zlib` engine is the historical default of Mercurial. `zstd` is a newer
877 877 format that is usually a net win over `zlib` operating faster at better
878 878 compression rate. Use `zstd` to reduce CPU usage.
879 879
880 880 On some system, Mercurial installation may lack `zstd` supports. Default is `zlib`.
881 881
882 882 ``bookmarks-in-store``
883 883 Store bookmarks in .hg/store/. This means that bookmarks are shared when
884 884 using `hg share` regardless of the `-B` option.
885 885
886 886 Repositories with this on-disk format require Mercurial version 5.1.
887 887
888 888 Disabled by default.
889 889
890 890
891 891 ``graph``
892 892 ---------
893 893
894 894 Web graph view configuration. This section let you change graph
895 895 elements display properties by branches, for instance to make the
896 896 ``default`` branch stand out.
897 897
898 898 Each line has the following format::
899 899
900 900 <branch>.<argument> = <value>
901 901
902 902 where ``<branch>`` is the name of the branch being
903 903 customized. Example::
904 904
905 905 [graph]
906 906 # 2px width
907 907 default.width = 2
908 908 # red color
909 909 default.color = FF0000
910 910
911 911 Supported arguments:
912 912
913 913 ``width``
914 914 Set branch edges width in pixels.
915 915
916 916 ``color``
917 917 Set branch edges color in hexadecimal RGB notation.
918 918
919 919 ``hooks``
920 920 ---------
921 921
922 922 Commands or Python functions that get automatically executed by
923 923 various actions such as starting or finishing a commit. Multiple
924 924 hooks can be run for the same action by appending a suffix to the
925 925 action. Overriding a site-wide hook can be done by changing its
926 926 value or setting it to an empty string. Hooks can be prioritized
927 927 by adding a prefix of ``priority.`` to the hook name on a new line
928 928 and setting the priority. The default priority is 0.
929 929
930 930 Example ``.hg/hgrc``::
931 931
932 932 [hooks]
933 933 # update working directory after adding changesets
934 934 changegroup.update = hg update
935 935 # do not use the site-wide hook
936 936 incoming =
937 937 incoming.email = /my/email/hook
938 938 incoming.autobuild = /my/build/hook
939 939 # force autobuild hook to run before other incoming hooks
940 940 priority.incoming.autobuild = 1
941 941
942 942 Most hooks are run with environment variables set that give useful
943 943 additional information. For each hook below, the environment variables
944 944 it is passed are listed with names in the form ``$HG_foo``. The
945 945 ``$HG_HOOKTYPE`` and ``$HG_HOOKNAME`` variables are set for all hooks.
946 946 They contain the type of hook which triggered the run and the full name
947 947 of the hook in the config, respectively. In the example above, this will
948 948 be ``$HG_HOOKTYPE=incoming`` and ``$HG_HOOKNAME=incoming.email``.
949 949
950 950 .. container:: windows
951 951
952 952 Some basic Unix syntax can be enabled for portability, including ``$VAR``
953 953 and ``${VAR}`` style variables. A ``~`` followed by ``\`` or ``/`` will
954 954 be expanded to ``%USERPROFILE%`` to simulate a subset of tilde expansion
955 955 on Unix. To use a literal ``$`` or ``~``, it must be escaped with a back
956 956 slash or inside of a strong quote. Strong quotes will be replaced by
957 957 double quotes after processing.
958 958
959 959 This feature is enabled by adding a prefix of ``tonative.`` to the hook
960 960 name on a new line, and setting it to ``True``. For example::
961 961
962 962 [hooks]
963 963 incoming.autobuild = /my/build/hook
964 964 # enable translation to cmd.exe syntax for autobuild hook
965 965 tonative.incoming.autobuild = True
966 966
967 967 ``changegroup``
968 968 Run after a changegroup has been added via push, pull or unbundle. The ID of
969 969 the first new changeset is in ``$HG_NODE`` and last is in ``$HG_NODE_LAST``.
970 970 The URL from which changes came is in ``$HG_URL``.
971 971
972 972 ``commit``
973 973 Run after a changeset has been created in the local repository. The ID
974 974 of the newly created changeset is in ``$HG_NODE``. Parent changeset
975 975 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
976 976
977 977 ``incoming``
978 978 Run after a changeset has been pulled, pushed, or unbundled into
979 979 the local repository. The ID of the newly arrived changeset is in
980 980 ``$HG_NODE``. The URL that was source of the changes is in ``$HG_URL``.
981 981
982 982 ``outgoing``
983 983 Run after sending changes from the local repository to another. The ID of
984 984 first changeset sent is in ``$HG_NODE``. The source of operation is in
985 985 ``$HG_SOURCE``. Also see :hg:`help config.hooks.preoutgoing`.
986 986
987 987 ``post-<command>``
988 988 Run after successful invocations of the associated command. The
989 989 contents of the command line are passed as ``$HG_ARGS`` and the result
990 990 code in ``$HG_RESULT``. Parsed command line arguments are passed as
991 991 ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of
992 992 the python data internally passed to <command>. ``$HG_OPTS`` is a
993 993 dictionary of options (with unspecified options set to their defaults).
994 994 ``$HG_PATS`` is a list of arguments. Hook failure is ignored.
995 995
996 996 ``fail-<command>``
997 997 Run after a failed invocation of an associated command. The contents
998 998 of the command line are passed as ``$HG_ARGS``. Parsed command line
999 999 arguments are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain
1000 1000 string representations of the python data internally passed to
1001 1001 <command>. ``$HG_OPTS`` is a dictionary of options (with unspecified
1002 1002 options set to their defaults). ``$HG_PATS`` is a list of arguments.
1003 1003 Hook failure is ignored.
1004 1004
1005 1005 ``pre-<command>``
1006 1006 Run before executing the associated command. The contents of the
1007 1007 command line are passed as ``$HG_ARGS``. Parsed command line arguments
1008 1008 are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string
1009 1009 representations of the data internally passed to <command>. ``$HG_OPTS``
1010 1010 is a dictionary of options (with unspecified options set to their
1011 1011 defaults). ``$HG_PATS`` is a list of arguments. If the hook returns
1012 1012 failure, the command doesn't execute and Mercurial returns the failure
1013 1013 code.
1014 1014
1015 1015 ``prechangegroup``
1016 1016 Run before a changegroup is added via push, pull or unbundle. Exit
1017 1017 status 0 allows the changegroup to proceed. A non-zero status will
1018 1018 cause the push, pull or unbundle to fail. The URL from which changes
1019 1019 will come is in ``$HG_URL``.
1020 1020
1021 1021 ``precommit``
1022 1022 Run before starting a local commit. Exit status 0 allows the
1023 1023 commit to proceed. A non-zero status will cause the commit to fail.
1024 1024 Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
1025 1025
1026 1026 ``prelistkeys``
1027 1027 Run before listing pushkeys (like bookmarks) in the
1028 1028 repository. A non-zero status will cause failure. The key namespace is
1029 1029 in ``$HG_NAMESPACE``.
1030 1030
1031 1031 ``preoutgoing``
1032 1032 Run before collecting changes to send from the local repository to
1033 1033 another. A non-zero status will cause failure. This lets you prevent
1034 1034 pull over HTTP or SSH. It can also prevent propagating commits (via
1035 1035 local pull, push (outbound) or bundle commands), but not completely,
1036 1036 since you can just copy files instead. The source of operation is in
1037 1037 ``$HG_SOURCE``. If "serve", the operation is happening on behalf of a remote
1038 1038 SSH or HTTP repository. If "push", "pull" or "bundle", the operation
1039 1039 is happening on behalf of a repository on same system.
1040 1040
1041 1041 ``prepushkey``
1042 1042 Run before a pushkey (like a bookmark) is added to the
1043 1043 repository. A non-zero status will cause the key to be rejected. The
1044 1044 key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``,
1045 1045 the old value (if any) is in ``$HG_OLD``, and the new value is in
1046 1046 ``$HG_NEW``.
1047 1047
1048 1048 ``pretag``
1049 1049 Run before creating a tag. Exit status 0 allows the tag to be
1050 1050 created. A non-zero status will cause the tag to fail. The ID of the
1051 1051 changeset to tag is in ``$HG_NODE``. The name of tag is in ``$HG_TAG``. The
1052 1052 tag is local if ``$HG_LOCAL=1``, or in the repository if ``$HG_LOCAL=0``.
1053 1053
1054 1054 ``pretxnopen``
1055 1055 Run before any new repository transaction is open. The reason for the
1056 1056 transaction will be in ``$HG_TXNNAME``, and a unique identifier for the
1057 1057 transaction will be in ``HG_TXNID``. A non-zero status will prevent the
1058 1058 transaction from being opened.
1059 1059
1060 1060 ``pretxnclose``
1061 1061 Run right before the transaction is actually finalized. Any repository change
1062 1062 will be visible to the hook program. This lets you validate the transaction
1063 1063 content or change it. Exit status 0 allows the commit to proceed. A non-zero
1064 1064 status will cause the transaction to be rolled back. The reason for the
1065 1065 transaction opening will be in ``$HG_TXNNAME``, and a unique identifier for
1066 1066 the transaction will be in ``HG_TXNID``. The rest of the available data will
1067 1067 vary according the transaction type. New changesets will add ``$HG_NODE``
1068 1068 (the ID of the first added changeset), ``$HG_NODE_LAST`` (the ID of the last
1069 1069 added changeset), ``$HG_URL`` and ``$HG_SOURCE`` variables. Bookmark and
1070 1070 phase changes will set ``HG_BOOKMARK_MOVED`` and ``HG_PHASES_MOVED`` to ``1``
1071 1071 respectively, etc.
1072 1072
1073 1073 ``pretxnclose-bookmark``
1074 1074 Run right before a bookmark change is actually finalized. Any repository
1075 1075 change will be visible to the hook program. This lets you validate the
1076 1076 transaction content or change it. Exit status 0 allows the commit to
1077 1077 proceed. A non-zero status will cause the transaction to be rolled back.
1078 1078 The name of the bookmark will be available in ``$HG_BOOKMARK``, the new
1079 1079 bookmark location will be available in ``$HG_NODE`` while the previous
1080 1080 location will be available in ``$HG_OLDNODE``. In case of a bookmark
1081 1081 creation ``$HG_OLDNODE`` will be empty. In case of deletion ``$HG_NODE``
1082 1082 will be empty.
1083 1083 In addition, the reason for the transaction opening will be in
1084 1084 ``$HG_TXNNAME``, and a unique identifier for the transaction will be in
1085 1085 ``HG_TXNID``.
1086 1086
1087 1087 ``pretxnclose-phase``
1088 1088 Run right before a phase change is actually finalized. Any repository change
1089 1089 will be visible to the hook program. This lets you validate the transaction
1090 1090 content or change it. Exit status 0 allows the commit to proceed. A non-zero
1091 1091 status will cause the transaction to be rolled back. The hook is called
1092 1092 multiple times, once for each revision affected by a phase change.
1093 1093 The affected node is available in ``$HG_NODE``, the phase in ``$HG_PHASE``
1094 1094 while the previous ``$HG_OLDPHASE``. In case of new node, ``$HG_OLDPHASE``
1095 1095 will be empty. In addition, the reason for the transaction opening will be in
1096 1096 ``$HG_TXNNAME``, and a unique identifier for the transaction will be in
1097 1097 ``HG_TXNID``. The hook is also run for newly added revisions. In this case
1098 1098 the ``$HG_OLDPHASE`` entry will be empty.
1099 1099
1100 1100 ``txnclose``
1101 1101 Run after any repository transaction has been committed. At this
1102 1102 point, the transaction can no longer be rolled back. The hook will run
1103 1103 after the lock is released. See :hg:`help config.hooks.pretxnclose` for
1104 1104 details about available variables.
1105 1105
1106 1106 ``txnclose-bookmark``
1107 1107 Run after any bookmark change has been committed. At this point, the
1108 1108 transaction can no longer be rolled back. The hook will run after the lock
1109 1109 is released. See :hg:`help config.hooks.pretxnclose-bookmark` for details
1110 1110 about available variables.
1111 1111
1112 1112 ``txnclose-phase``
1113 1113 Run after any phase change has been committed. At this point, the
1114 1114 transaction can no longer be rolled back. The hook will run after the lock
1115 1115 is released. See :hg:`help config.hooks.pretxnclose-phase` for details about
1116 1116 available variables.
1117 1117
1118 1118 ``txnabort``
1119 1119 Run when a transaction is aborted. See :hg:`help config.hooks.pretxnclose`
1120 1120 for details about available variables.
1121 1121
1122 1122 ``pretxnchangegroup``
1123 1123 Run after a changegroup has been added via push, pull or unbundle, but before
1124 1124 the transaction has been committed. The changegroup is visible to the hook
1125 1125 program. This allows validation of incoming changes before accepting them.
1126 1126 The ID of the first new changeset is in ``$HG_NODE`` and last is in
1127 1127 ``$HG_NODE_LAST``. Exit status 0 allows the transaction to commit. A non-zero
1128 1128 status will cause the transaction to be rolled back, and the push, pull or
1129 1129 unbundle will fail. The URL that was the source of changes is in ``$HG_URL``.
1130 1130
1131 1131 ``pretxncommit``
1132 1132 Run after a changeset has been created, but before the transaction is
1133 1133 committed. The changeset is visible to the hook program. This allows
1134 1134 validation of the commit message and changes. Exit status 0 allows the
1135 1135 commit to proceed. A non-zero status will cause the transaction to
1136 1136 be rolled back. The ID of the new changeset is in ``$HG_NODE``. The parent
1137 1137 changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
1138 1138
1139 1139 ``preupdate``
1140 1140 Run before updating the working directory. Exit status 0 allows
1141 1141 the update to proceed. A non-zero status will prevent the update.
1142 1142 The changeset ID of first new parent is in ``$HG_PARENT1``. If updating to a
1143 1143 merge, the ID of second new parent is in ``$HG_PARENT2``.
1144 1144
1145 1145 ``listkeys``
1146 1146 Run after listing pushkeys (like bookmarks) in the repository. The
1147 1147 key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a
1148 1148 dictionary containing the keys and values.
1149 1149
1150 1150 ``pushkey``
1151 1151 Run after a pushkey (like a bookmark) is added to the
1152 1152 repository. The key namespace is in ``$HG_NAMESPACE``, the key is in
1153 1153 ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new
1154 1154 value is in ``$HG_NEW``.
1155 1155
1156 1156 ``tag``
1157 1157 Run after a tag is created. The ID of the tagged changeset is in ``$HG_NODE``.
1158 1158 The name of tag is in ``$HG_TAG``. The tag is local if ``$HG_LOCAL=1``, or in
1159 1159 the repository if ``$HG_LOCAL=0``.
1160 1160
1161 1161 ``update``
1162 1162 Run after updating the working directory. The changeset ID of first
1163 1163 new parent is in ``$HG_PARENT1``. If updating to a merge, the ID of second new
1164 1164 parent is in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the
1165 1165 update failed (e.g. because conflicts were not resolved), ``$HG_ERROR=1``.
1166 1166
1167 1167 .. note::
1168 1168
1169 1169 It is generally better to use standard hooks rather than the
1170 1170 generic pre- and post- command hooks, as they are guaranteed to be
1171 1171 called in the appropriate contexts for influencing transactions.
1172 1172 Also, hooks like "commit" will be called in all contexts that
1173 1173 generate a commit (e.g. tag) and not just the commit command.
1174 1174
1175 1175 .. note::
1176 1176
1177 1177 Environment variables with empty values may not be passed to
1178 1178 hooks on platforms such as Windows. As an example, ``$HG_PARENT2``
1179 1179 will have an empty value under Unix-like platforms for non-merge
1180 1180 changesets, while it will not be available at all under Windows.
1181 1181
1182 1182 The syntax for Python hooks is as follows::
1183 1183
1184 1184 hookname = python:modulename.submodule.callable
1185 1185 hookname = python:/path/to/python/module.py:callable
1186 1186
1187 1187 Python hooks are run within the Mercurial process. Each hook is
1188 1188 called with at least three keyword arguments: a ui object (keyword
1189 1189 ``ui``), a repository object (keyword ``repo``), and a ``hooktype``
1190 1190 keyword that tells what kind of hook is used. Arguments listed as
1191 1191 environment variables above are passed as keyword arguments, with no
1192 1192 ``HG_`` prefix, and names in lower case.
1193 1193
1194 1194 If a Python hook returns a "true" value or raises an exception, this
1195 1195 is treated as a failure.
1196 1196
1197 1197
1198 1198 ``hostfingerprints``
1199 1199 --------------------
1200 1200
1201 1201 (Deprecated. Use ``[hostsecurity]``'s ``fingerprints`` options instead.)
1202 1202
1203 1203 Fingerprints of the certificates of known HTTPS servers.
1204 1204
1205 1205 A HTTPS connection to a server with a fingerprint configured here will
1206 1206 only succeed if the servers certificate matches the fingerprint.
1207 1207 This is very similar to how ssh known hosts works.
1208 1208
1209 1209 The fingerprint is the SHA-1 hash value of the DER encoded certificate.
1210 1210 Multiple values can be specified (separated by spaces or commas). This can
1211 1211 be used to define both old and new fingerprints while a host transitions
1212 1212 to a new certificate.
1213 1213
1214 1214 The CA chain and web.cacerts is not used for servers with a fingerprint.
1215 1215
1216 1216 For example::
1217 1217
1218 1218 [hostfingerprints]
1219 1219 hg.intevation.de = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
1220 1220 hg.intevation.org = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
1221 1221
1222 1222 ``hostsecurity``
1223 1223 ----------------
1224 1224
1225 1225 Used to specify global and per-host security settings for connecting to
1226 1226 other machines.
1227 1227
1228 1228 The following options control default behavior for all hosts.
1229 1229
1230 1230 ``ciphers``
1231 1231 Defines the cryptographic ciphers to use for connections.
1232 1232
1233 1233 Value must be a valid OpenSSL Cipher List Format as documented at
1234 1234 https://www.openssl.org/docs/manmaster/apps/ciphers.html#CIPHER-LIST-FORMAT.
1235 1235
1236 1236 This setting is for advanced users only. Setting to incorrect values
1237 1237 can significantly lower connection security or decrease performance.
1238 1238 You have been warned.
1239 1239
1240 1240 This option requires Python 2.7.
1241 1241
1242 1242 ``minimumprotocol``
1243 1243 Defines the minimum channel encryption protocol to use.
1244 1244
1245 1245 By default, the highest version of TLS supported by both client and server
1246 1246 is used.
1247 1247
1248 1248 Allowed values are: ``tls1.0``, ``tls1.1``, ``tls1.2``.
1249 1249
1250 1250 When running on an old Python version, only ``tls1.0`` is allowed since
1251 1251 old versions of Python only support up to TLS 1.0.
1252 1252
1253 1253 When running a Python that supports modern TLS versions, the default is
1254 1254 ``tls1.1``. ``tls1.0`` can still be used to allow TLS 1.0. However, this
1255 1255 weakens security and should only be used as a feature of last resort if
1256 1256 a server does not support TLS 1.1+.
1257 1257
1258 1258 Options in the ``[hostsecurity]`` section can have the form
1259 1259 ``hostname``:``setting``. This allows multiple settings to be defined on a
1260 1260 per-host basis.
1261 1261
1262 1262 The following per-host settings can be defined.
1263 1263
1264 1264 ``ciphers``
1265 1265 This behaves like ``ciphers`` as described above except it only applies
1266 1266 to the host on which it is defined.
1267 1267
1268 1268 ``fingerprints``
1269 1269 A list of hashes of the DER encoded peer/remote certificate. Values have
1270 1270 the form ``algorithm``:``fingerprint``. e.g.
1271 1271 ``sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2``.
1272 1272 In addition, colons (``:``) can appear in the fingerprint part.
1273 1273
1274 1274 The following algorithms/prefixes are supported: ``sha1``, ``sha256``,
1275 1275 ``sha512``.
1276 1276
1277 1277 Use of ``sha256`` or ``sha512`` is preferred.
1278 1278
1279 1279 If a fingerprint is specified, the CA chain is not validated for this
1280 1280 host and Mercurial will require the remote certificate to match one
1281 1281 of the fingerprints specified. This means if the server updates its
1282 1282 certificate, Mercurial will abort until a new fingerprint is defined.
1283 1283 This can provide stronger security than traditional CA-based validation
1284 1284 at the expense of convenience.
1285 1285
1286 1286 This option takes precedence over ``verifycertsfile``.
1287 1287
1288 1288 ``minimumprotocol``
1289 1289 This behaves like ``minimumprotocol`` as described above except it
1290 1290 only applies to the host on which it is defined.
1291 1291
1292 1292 ``verifycertsfile``
1293 1293 Path to file a containing a list of PEM encoded certificates used to
1294 1294 verify the server certificate. Environment variables and ``~user``
1295 1295 constructs are expanded in the filename.
1296 1296
1297 1297 The server certificate or the certificate's certificate authority (CA)
1298 1298 must match a certificate from this file or certificate verification
1299 1299 will fail and connections to the server will be refused.
1300 1300
1301 1301 If defined, only certificates provided by this file will be used:
1302 1302 ``web.cacerts`` and any system/default certificates will not be
1303 1303 used.
1304 1304
1305 1305 This option has no effect if the per-host ``fingerprints`` option
1306 1306 is set.
1307 1307
1308 1308 The format of the file is as follows::
1309 1309
1310 1310 -----BEGIN CERTIFICATE-----
1311 1311 ... (certificate in base64 PEM encoding) ...
1312 1312 -----END CERTIFICATE-----
1313 1313 -----BEGIN CERTIFICATE-----
1314 1314 ... (certificate in base64 PEM encoding) ...
1315 1315 -----END CERTIFICATE-----
1316 1316
1317 1317 For example::
1318 1318
1319 1319 [hostsecurity]
1320 1320 hg.example.com:fingerprints = sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2
1321 1321 hg2.example.com:fingerprints = sha1:914f1aff87249c09b6859b88b1906d30756491ca, sha1:fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
1322 1322 hg3.example.com:fingerprints = sha256:9a:b0:dc:e2:75:ad:8a:b7:84:58:e5:1f:07:32:f1:87:e6:bd:24:22:af:b7:ce:8e:9c:b4:10:cf:b9:f4:0e:d2
1323 1323 foo.example.com:verifycertsfile = /etc/ssl/trusted-ca-certs.pem
1324 1324
1325 1325 To change the default minimum protocol version to TLS 1.2 but to allow TLS 1.1
1326 1326 when connecting to ``hg.example.com``::
1327 1327
1328 1328 [hostsecurity]
1329 1329 minimumprotocol = tls1.2
1330 1330 hg.example.com:minimumprotocol = tls1.1
1331 1331
1332 1332 ``http_proxy``
1333 1333 --------------
1334 1334
1335 1335 Used to access web-based Mercurial repositories through a HTTP
1336 1336 proxy.
1337 1337
1338 1338 ``host``
1339 1339 Host name and (optional) port of the proxy server, for example
1340 1340 "myproxy:8000".
1341 1341
1342 1342 ``no``
1343 1343 Optional. Comma-separated list of host names that should bypass
1344 1344 the proxy.
1345 1345
1346 1346 ``passwd``
1347 1347 Optional. Password to authenticate with at the proxy server.
1348 1348
1349 1349 ``user``
1350 1350 Optional. User name to authenticate with at the proxy server.
1351 1351
1352 1352 ``always``
1353 1353 Optional. Always use the proxy, even for localhost and any entries
1354 1354 in ``http_proxy.no``. (default: False)
1355 1355
1356 1356 ``http``
1357 1357 ----------
1358 1358
1359 1359 Used to configure access to Mercurial repositories via HTTP.
1360 1360
1361 1361 ``timeout``
1362 1362 If set, blocking operations will timeout after that many seconds.
1363 1363 (default: None)
1364 1364
1365 1365 ``merge``
1366 1366 ---------
1367 1367
1368 1368 This section specifies behavior during merges and updates.
1369 1369
1370 1370 ``checkignored``
1371 1371 Controls behavior when an ignored file on disk has the same name as a tracked
1372 1372 file in the changeset being merged or updated to, and has different
1373 1373 contents. Options are ``abort``, ``warn`` and ``ignore``. With ``abort``,
1374 1374 abort on such files. With ``warn``, warn on such files and back them up as
1375 1375 ``.orig``. With ``ignore``, don't print a warning and back them up as
1376 1376 ``.orig``. (default: ``abort``)
1377 1377
1378 1378 ``checkunknown``
1379 1379 Controls behavior when an unknown file that isn't ignored has the same name
1380 1380 as a tracked file in the changeset being merged or updated to, and has
1381 1381 different contents. Similar to ``merge.checkignored``, except for files that
1382 1382 are not ignored. (default: ``abort``)
1383 1383
1384 1384 ``on-failure``
1385 1385 When set to ``continue`` (the default), the merge process attempts to
1386 1386 merge all unresolved files using the merge chosen tool, regardless of
1387 1387 whether previous file merge attempts during the process succeeded or not.
1388 1388 Setting this to ``prompt`` will prompt after any merge failure continue
1389 1389 or halt the merge process. Setting this to ``halt`` will automatically
1390 1390 halt the merge process on any merge tool failure. The merge process
1391 1391 can be restarted by using the ``resolve`` command. When a merge is
1392 1392 halted, the repository is left in a normal ``unresolved`` merge state.
1393 1393 (default: ``continue``)
1394 1394
1395 1395 ``strict-capability-check``
1396 1396 Whether capabilities of internal merge tools are checked strictly
1397 1397 or not, while examining rules to decide merge tool to be used.
1398 1398 (default: False)
1399 1399
1400 1400 ``merge-patterns``
1401 1401 ------------------
1402 1402
1403 1403 This section specifies merge tools to associate with particular file
1404 1404 patterns. Tools matched here will take precedence over the default
1405 1405 merge tool. Patterns are globs by default, rooted at the repository
1406 1406 root.
1407 1407
1408 1408 Example::
1409 1409
1410 1410 [merge-patterns]
1411 1411 **.c = kdiff3
1412 1412 **.jpg = myimgmerge
1413 1413
1414 1414 ``merge-tools``
1415 1415 ---------------
1416 1416
1417 1417 This section configures external merge tools to use for file-level
1418 1418 merges. This section has likely been preconfigured at install time.
1419 1419 Use :hg:`config merge-tools` to check the existing configuration.
1420 1420 Also see :hg:`help merge-tools` for more details.
1421 1421
1422 1422 Example ``~/.hgrc``::
1423 1423
1424 1424 [merge-tools]
1425 1425 # Override stock tool location
1426 1426 kdiff3.executable = ~/bin/kdiff3
1427 1427 # Specify command line
1428 1428 kdiff3.args = $base $local $other -o $output
1429 1429 # Give higher priority
1430 1430 kdiff3.priority = 1
1431 1431
1432 1432 # Changing the priority of preconfigured tool
1433 1433 meld.priority = 0
1434 1434
1435 1435 # Disable a preconfigured tool
1436 1436 vimdiff.disabled = yes
1437 1437
1438 1438 # Define new tool
1439 1439 myHtmlTool.args = -m $local $other $base $output
1440 1440 myHtmlTool.regkey = Software\FooSoftware\HtmlMerge
1441 1441 myHtmlTool.priority = 1
1442 1442
1443 1443 Supported arguments:
1444 1444
1445 1445 ``priority``
1446 1446 The priority in which to evaluate this tool.
1447 1447 (default: 0)
1448 1448
1449 1449 ``executable``
1450 1450 Either just the name of the executable or its pathname.
1451 1451
1452 1452 .. container:: windows
1453 1453
1454 1454 On Windows, the path can use environment variables with ${ProgramFiles}
1455 1455 syntax.
1456 1456
1457 1457 (default: the tool name)
1458 1458
1459 1459 ``args``
1460 1460 The arguments to pass to the tool executable. You can refer to the
1461 1461 files being merged as well as the output file through these
1462 1462 variables: ``$base``, ``$local``, ``$other``, ``$output``.
1463 1463
1464 1464 The meaning of ``$local`` and ``$other`` can vary depending on which action is
1465 1465 being performed. During an update or merge, ``$local`` represents the original
1466 1466 state of the file, while ``$other`` represents the commit you are updating to or
1467 1467 the commit you are merging with. During a rebase, ``$local`` represents the
1468 1468 destination of the rebase, and ``$other`` represents the commit being rebased.
1469 1469
1470 1470 Some operations define custom labels to assist with identifying the revisions,
1471 1471 accessible via ``$labellocal``, ``$labelother``, and ``$labelbase``. If custom
1472 1472 labels are not available, these will be ``local``, ``other``, and ``base``,
1473 1473 respectively.
1474 1474 (default: ``$local $base $other``)
1475 1475
1476 1476 ``premerge``
1477 1477 Attempt to run internal non-interactive 3-way merge tool before
1478 1478 launching external tool. Options are ``true``, ``false``, ``keep`` or
1479 1479 ``keep-merge3``. The ``keep`` option will leave markers in the file if the
1480 1480 premerge fails. The ``keep-merge3`` will do the same but include information
1481 1481 about the base of the merge in the marker (see internal :merge3 in
1482 1482 :hg:`help merge-tools`).
1483 1483 (default: True)
1484 1484
1485 1485 ``binary``
1486 1486 This tool can merge binary files. (default: False, unless tool
1487 1487 was selected by file pattern match)
1488 1488
1489 1489 ``symlink``
1490 1490 This tool can merge symlinks. (default: False)
1491 1491
1492 1492 ``check``
1493 1493 A list of merge success-checking options:
1494 1494
1495 1495 ``changed``
1496 1496 Ask whether merge was successful when the merged file shows no changes.
1497 1497 ``conflicts``
1498 1498 Check whether there are conflicts even though the tool reported success.
1499 1499 ``prompt``
1500 1500 Always prompt for merge success, regardless of success reported by tool.
1501 1501
1502 1502 ``fixeol``
1503 1503 Attempt to fix up EOL changes caused by the merge tool.
1504 1504 (default: False)
1505 1505
1506 1506 ``gui``
1507 1507 This tool requires a graphical interface to run. (default: False)
1508 1508
1509 1509 ``mergemarkers``
1510 1510 Controls whether the labels passed via ``$labellocal``, ``$labelother``, and
1511 1511 ``$labelbase`` are ``detailed`` (respecting ``mergemarkertemplate``) or
1512 1512 ``basic``. If ``premerge`` is ``keep`` or ``keep-merge3``, the conflict
1513 1513 markers generated during premerge will be ``detailed`` if either this option or
1514 1514 the corresponding option in the ``[ui]`` section is ``detailed``.
1515 1515 (default: ``basic``)
1516 1516
1517 1517 ``mergemarkertemplate``
1518 1518 This setting can be used to override ``mergemarkertemplate`` from the ``[ui]``
1519 1519 section on a per-tool basis; this applies to the ``$label``-prefixed variables
1520 1520 and to the conflict markers that are generated if ``premerge`` is ``keep` or
1521 1521 ``keep-merge3``. See the corresponding variable in ``[ui]`` for more
1522 1522 information.
1523 1523
1524 1524 .. container:: windows
1525 1525
1526 1526 ``regkey``
1527 1527 Windows registry key which describes install location of this
1528 1528 tool. Mercurial will search for this key first under
1529 1529 ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``.
1530 1530 (default: None)
1531 1531
1532 1532 ``regkeyalt``
1533 1533 An alternate Windows registry key to try if the first key is not
1534 1534 found. The alternate key uses the same ``regname`` and ``regappend``
1535 1535 semantics of the primary key. The most common use for this key
1536 1536 is to search for 32bit applications on 64bit operating systems.
1537 1537 (default: None)
1538 1538
1539 1539 ``regname``
1540 1540 Name of value to read from specified registry key.
1541 1541 (default: the unnamed (default) value)
1542 1542
1543 1543 ``regappend``
1544 1544 String to append to the value read from the registry, typically
1545 1545 the executable name of the tool.
1546 1546 (default: None)
1547 1547
1548 1548 ``pager``
1549 1549 ---------
1550 1550
1551 1551 Setting used to control when to paginate and with what external tool. See
1552 1552 :hg:`help pager` for details.
1553 1553
1554 1554 ``pager``
1555 1555 Define the external tool used as pager.
1556 1556
1557 1557 If no pager is set, Mercurial uses the environment variable $PAGER.
1558 1558 If neither pager.pager, nor $PAGER is set, a default pager will be
1559 1559 used, typically `less` on Unix and `more` on Windows. Example::
1560 1560
1561 1561 [pager]
1562 1562 pager = less -FRX
1563 1563
1564 1564 ``ignore``
1565 1565 List of commands to disable the pager for. Example::
1566 1566
1567 1567 [pager]
1568 1568 ignore = version, help, update
1569 1569
1570 1570 ``patch``
1571 1571 ---------
1572 1572
1573 1573 Settings used when applying patches, for instance through the 'import'
1574 1574 command or with Mercurial Queues extension.
1575 1575
1576 1576 ``eol``
1577 1577 When set to 'strict' patch content and patched files end of lines
1578 1578 are preserved. When set to ``lf`` or ``crlf``, both files end of
1579 1579 lines are ignored when patching and the result line endings are
1580 1580 normalized to either LF (Unix) or CRLF (Windows). When set to
1581 1581 ``auto``, end of lines are again ignored while patching but line
1582 1582 endings in patched files are normalized to their original setting
1583 1583 on a per-file basis. If target file does not exist or has no end
1584 1584 of line, patch line endings are preserved.
1585 1585 (default: strict)
1586 1586
1587 1587 ``fuzz``
1588 1588 The number of lines of 'fuzz' to allow when applying patches. This
1589 1589 controls how much context the patcher is allowed to ignore when
1590 1590 trying to apply a patch.
1591 1591 (default: 2)
1592 1592
1593 1593 ``paths``
1594 1594 ---------
1595 1595
1596 1596 Assigns symbolic names and behavior to repositories.
1597 1597
1598 1598 Options are symbolic names defining the URL or directory that is the
1599 1599 location of the repository. Example::
1600 1600
1601 1601 [paths]
1602 1602 my_server = https://example.com/my_repo
1603 1603 local_path = /home/me/repo
1604 1604
1605 1605 These symbolic names can be used from the command line. To pull
1606 1606 from ``my_server``: :hg:`pull my_server`. To push to ``local_path``:
1607 1607 :hg:`push local_path`.
1608 1608
1609 1609 Options containing colons (``:``) denote sub-options that can influence
1610 1610 behavior for that specific path. Example::
1611 1611
1612 1612 [paths]
1613 1613 my_server = https://example.com/my_path
1614 1614 my_server:pushurl = ssh://example.com/my_path
1615 1615
1616 1616 The following sub-options can be defined:
1617 1617
1618 1618 ``pushurl``
1619 1619 The URL to use for push operations. If not defined, the location
1620 1620 defined by the path's main entry is used.
1621 1621
1622 1622 ``pushrev``
1623 1623 A revset defining which revisions to push by default.
1624 1624
1625 1625 When :hg:`push` is executed without a ``-r`` argument, the revset
1626 1626 defined by this sub-option is evaluated to determine what to push.
1627 1627
1628 1628 For example, a value of ``.`` will push the working directory's
1629 1629 revision by default.
1630 1630
1631 1631 Revsets specifying bookmarks will not result in the bookmark being
1632 1632 pushed.
1633 1633
1634 1634 The following special named paths exist:
1635 1635
1636 1636 ``default``
1637 1637 The URL or directory to use when no source or remote is specified.
1638 1638
1639 1639 :hg:`clone` will automatically define this path to the location the
1640 1640 repository was cloned from.
1641 1641
1642 1642 ``default-push``
1643 1643 (deprecated) The URL or directory for the default :hg:`push` location.
1644 1644 ``default:pushurl`` should be used instead.
1645 1645
1646 1646 ``phases``
1647 1647 ----------
1648 1648
1649 1649 Specifies default handling of phases. See :hg:`help phases` for more
1650 1650 information about working with phases.
1651 1651
1652 1652 ``publish``
1653 1653 Controls draft phase behavior when working as a server. When true,
1654 1654 pushed changesets are set to public in both client and server and
1655 1655 pulled or cloned changesets are set to public in the client.
1656 1656 (default: True)
1657 1657
1658 1658 ``new-commit``
1659 1659 Phase of newly-created commits.
1660 1660 (default: draft)
1661 1661
1662 1662 ``checksubrepos``
1663 1663 Check the phase of the current revision of each subrepository. Allowed
1664 1664 values are "ignore", "follow" and "abort". For settings other than
1665 1665 "ignore", the phase of the current revision of each subrepository is
1666 1666 checked before committing the parent repository. If any of those phases is
1667 1667 greater than the phase of the parent repository (e.g. if a subrepo is in a
1668 1668 "secret" phase while the parent repo is in "draft" phase), the commit is
1669 1669 either aborted (if checksubrepos is set to "abort") or the higher phase is
1670 1670 used for the parent repository commit (if set to "follow").
1671 1671 (default: follow)
1672 1672
1673 1673
1674 1674 ``profiling``
1675 1675 -------------
1676 1676
1677 1677 Specifies profiling type, format, and file output. Two profilers are
1678 1678 supported: an instrumenting profiler (named ``ls``), and a sampling
1679 1679 profiler (named ``stat``).
1680 1680
1681 1681 In this section description, 'profiling data' stands for the raw data
1682 1682 collected during profiling, while 'profiling report' stands for a
1683 1683 statistical text report generated from the profiling data.
1684 1684
1685 1685 ``enabled``
1686 1686 Enable the profiler.
1687 1687 (default: false)
1688 1688
1689 1689 This is equivalent to passing ``--profile`` on the command line.
1690 1690
1691 1691 ``type``
1692 1692 The type of profiler to use.
1693 1693 (default: stat)
1694 1694
1695 1695 ``ls``
1696 1696 Use Python's built-in instrumenting profiler. This profiler
1697 1697 works on all platforms, but each line number it reports is the
1698 1698 first line of a function. This restriction makes it difficult to
1699 1699 identify the expensive parts of a non-trivial function.
1700 1700 ``stat``
1701 1701 Use a statistical profiler, statprof. This profiler is most
1702 1702 useful for profiling commands that run for longer than about 0.1
1703 1703 seconds.
1704 1704
1705 1705 ``format``
1706 1706 Profiling format. Specific to the ``ls`` instrumenting profiler.
1707 1707 (default: text)
1708 1708
1709 1709 ``text``
1710 1710 Generate a profiling report. When saving to a file, it should be
1711 1711 noted that only the report is saved, and the profiling data is
1712 1712 not kept.
1713 1713 ``kcachegrind``
1714 1714 Format profiling data for kcachegrind use: when saving to a
1715 1715 file, the generated file can directly be loaded into
1716 1716 kcachegrind.
1717 1717
1718 1718 ``statformat``
1719 1719 Profiling format for the ``stat`` profiler.
1720 1720 (default: hotpath)
1721 1721
1722 1722 ``hotpath``
1723 1723 Show a tree-based display containing the hot path of execution (where
1724 1724 most time was spent).
1725 1725 ``bymethod``
1726 1726 Show a table of methods ordered by how frequently they are active.
1727 1727 ``byline``
1728 1728 Show a table of lines in files ordered by how frequently they are active.
1729 1729 ``json``
1730 1730 Render profiling data as JSON.
1731 1731
1732 1732 ``frequency``
1733 1733 Sampling frequency. Specific to the ``stat`` sampling profiler.
1734 1734 (default: 1000)
1735 1735
1736 1736 ``output``
1737 1737 File path where profiling data or report should be saved. If the
1738 1738 file exists, it is replaced. (default: None, data is printed on
1739 1739 stderr)
1740 1740
1741 1741 ``sort``
1742 1742 Sort field. Specific to the ``ls`` instrumenting profiler.
1743 1743 One of ``callcount``, ``reccallcount``, ``totaltime`` and
1744 1744 ``inlinetime``.
1745 1745 (default: inlinetime)
1746 1746
1747 1747 ``time-track``
1748 1748 Control if the stat profiler track ``cpu`` or ``real`` time.
1749 1749 (default: ``cpu`` on Windows, otherwise ``real``)
1750 1750
1751 1751 ``limit``
1752 1752 Number of lines to show. Specific to the ``ls`` instrumenting profiler.
1753 1753 (default: 30)
1754 1754
1755 1755 ``nested``
1756 1756 Show at most this number of lines of drill-down info after each main entry.
1757 1757 This can help explain the difference between Total and Inline.
1758 1758 Specific to the ``ls`` instrumenting profiler.
1759 1759 (default: 0)
1760 1760
1761 1761 ``showmin``
1762 1762 Minimum fraction of samples an entry must have for it to be displayed.
1763 1763 Can be specified as a float between ``0.0`` and ``1.0`` or can have a
1764 1764 ``%`` afterwards to allow values up to ``100``. e.g. ``5%``.
1765 1765
1766 1766 Only used by the ``stat`` profiler.
1767 1767
1768 1768 For the ``hotpath`` format, default is ``0.05``.
1769 1769 For the ``chrome`` format, default is ``0.005``.
1770 1770
1771 1771 The option is unused on other formats.
1772 1772
1773 1773 ``showmax``
1774 1774 Maximum fraction of samples an entry can have before it is ignored in
1775 1775 display. Values format is the same as ``showmin``.
1776 1776
1777 1777 Only used by the ``stat`` profiler.
1778 1778
1779 1779 For the ``chrome`` format, default is ``0.999``.
1780 1780
1781 1781 The option is unused on other formats.
1782 1782
1783 ``showtime``
1784 Show time taken as absolute durations, in addition to percentages.
1785 Only used by the ``hotpath`` format.
1786 (default: true)
1787
1783 1788 ``progress``
1784 1789 ------------
1785 1790
1786 1791 Mercurial commands can draw progress bars that are as informative as
1787 1792 possible. Some progress bars only offer indeterminate information, while others
1788 1793 have a definite end point.
1789 1794
1790 1795 ``debug``
1791 1796 Whether to print debug info when updating the progress bar. (default: False)
1792 1797
1793 1798 ``delay``
1794 1799 Number of seconds (float) before showing the progress bar. (default: 3)
1795 1800
1796 1801 ``changedelay``
1797 1802 Minimum delay before showing a new topic. When set to less than 3 * refresh,
1798 1803 that value will be used instead. (default: 1)
1799 1804
1800 1805 ``estimateinterval``
1801 1806 Maximum sampling interval in seconds for speed and estimated time
1802 1807 calculation. (default: 60)
1803 1808
1804 1809 ``refresh``
1805 1810 Time in seconds between refreshes of the progress bar. (default: 0.1)
1806 1811
1807 1812 ``format``
1808 1813 Format of the progress bar.
1809 1814
1810 1815 Valid entries for the format field are ``topic``, ``bar``, ``number``,
1811 1816 ``unit``, ``estimate``, ``speed``, and ``item``. ``item`` defaults to the
1812 1817 last 20 characters of the item, but this can be changed by adding either
1813 1818 ``-<num>`` which would take the last num characters, or ``+<num>`` for the
1814 1819 first num characters.
1815 1820
1816 1821 (default: topic bar number estimate)
1817 1822
1818 1823 ``width``
1819 1824 If set, the maximum width of the progress information (that is, min(width,
1820 1825 term width) will be used).
1821 1826
1822 1827 ``clear-complete``
1823 1828 Clear the progress bar after it's done. (default: True)
1824 1829
1825 1830 ``disable``
1826 1831 If true, don't show a progress bar.
1827 1832
1828 1833 ``assume-tty``
1829 1834 If true, ALWAYS show a progress bar, unless disable is given.
1830 1835
1831 1836 ``rebase``
1832 1837 ----------
1833 1838
1834 1839 ``evolution.allowdivergence``
1835 1840 Default to False, when True allow creating divergence when performing
1836 1841 rebase of obsolete changesets.
1837 1842
1838 1843 ``revsetalias``
1839 1844 ---------------
1840 1845
1841 1846 Alias definitions for revsets. See :hg:`help revsets` for details.
1842 1847
1843 1848 ``rewrite``
1844 1849 -----------
1845 1850
1846 1851 ``backup-bundle``
1847 1852 Whether to save stripped changesets to a bundle file. (default: True)
1848 1853
1849 1854 ``update-timestamp``
1850 1855 If true, updates the date and time of the changeset to current. It is only
1851 1856 applicable for hg amend in current version.
1852 1857
1853 1858 ``storage``
1854 1859 -----------
1855 1860
1856 1861 Control the strategy Mercurial uses internally to store history. Options in this
1857 1862 category impact performance and repository size.
1858 1863
1859 1864 ``revlog.optimize-delta-parent-choice``
1860 1865 When storing a merge revision, both parents will be equally considered as
1861 1866 a possible delta base. This results in better delta selection and improved
1862 1867 revlog compression. This option is enabled by default.
1863 1868
1864 1869 Turning this option off can result in large increase of repository size for
1865 1870 repository with many merges.
1866 1871
1867 1872 ``revlog.reuse-external-delta-parent``
1868 1873 Control the order in which delta parents are considered when adding new
1869 1874 revisions from an external source.
1870 1875 (typically: apply bundle from `hg pull` or `hg push`).
1871 1876
1872 1877 New revisions are usually provided as a delta against other revisions. By
1873 1878 default, Mercurial will try to reuse this delta first, therefore using the
1874 1879 same "delta parent" as the source. Directly using delta's from the source
1875 1880 reduces CPU usage and usually speeds up operation. However, in some case,
1876 1881 the source might have sub-optimal delta bases and forcing their reevaluation
1877 1882 is useful. For example, pushes from an old client could have sub-optimal
1878 1883 delta's parent that the server want to optimize. (lack of general delta, bad
1879 1884 parents, choice, lack of sparse-revlog, etc).
1880 1885
1881 1886 This option is enabled by default. Turning it off will ensure bad delta
1882 1887 parent choices from older client do not propagate to this repository, at
1883 1888 the cost of a small increase in CPU consumption.
1884 1889
1885 1890 Note: this option only control the order in which delta parents are
1886 1891 considered. Even when disabled, the existing delta from the source will be
1887 1892 reused if the same delta parent is selected.
1888 1893
1889 1894 ``revlog.reuse-external-delta``
1890 1895 Control the reuse of delta from external source.
1891 1896 (typically: apply bundle from `hg pull` or `hg push`).
1892 1897
1893 1898 New revisions are usually provided as a delta against another revision. By
1894 1899 default, Mercurial will not recompute the same delta again, trusting
1895 1900 externally provided deltas. There have been rare cases of small adjustment
1896 1901 to the diffing algorithm in the past. So in some rare case, recomputing
1897 1902 delta provided by ancient clients can provides better results. Disabling
1898 1903 this option means going through a full delta recomputation for all incoming
1899 1904 revisions. It means a large increase in CPU usage and will slow operations
1900 1905 down.
1901 1906
1902 1907 This option is enabled by default. When disabled, it also disables the
1903 1908 related ``storage.revlog.reuse-external-delta-parent`` option.
1904 1909
1905 1910 ``revlog.zlib.level``
1906 1911 Zlib compression level used when storing data into the repository. Accepted
1907 1912 Value range from 1 (lowest compression) to 9 (highest compression). Zlib
1908 1913 default value is 6.
1909 1914
1910 1915
1911 1916 ``revlog.zstd.level``
1912 1917 zstd compression level used when storing data into the repository. Accepted
1913 1918 Value range from 1 (lowest compression) to 22 (highest compression).
1914 1919 (default 3)
1915 1920
1916 1921 ``server``
1917 1922 ----------
1918 1923
1919 1924 Controls generic server settings.
1920 1925
1921 1926 ``bookmarks-pushkey-compat``
1922 1927 Trigger pushkey hook when being pushed bookmark updates. This config exist
1923 1928 for compatibility purpose (default to True)
1924 1929
1925 1930 If you use ``pushkey`` and ``pre-pushkey`` hooks to control bookmark
1926 1931 movement we recommend you migrate them to ``txnclose-bookmark`` and
1927 1932 ``pretxnclose-bookmark``.
1928 1933
1929 1934 ``compressionengines``
1930 1935 List of compression engines and their relative priority to advertise
1931 1936 to clients.
1932 1937
1933 1938 The order of compression engines determines their priority, the first
1934 1939 having the highest priority. If a compression engine is not listed
1935 1940 here, it won't be advertised to clients.
1936 1941
1937 1942 If not set (the default), built-in defaults are used. Run
1938 1943 :hg:`debuginstall` to list available compression engines and their
1939 1944 default wire protocol priority.
1940 1945
1941 1946 Older Mercurial clients only support zlib compression and this setting
1942 1947 has no effect for legacy clients.
1943 1948
1944 1949 ``uncompressed``
1945 1950 Whether to allow clients to clone a repository using the
1946 1951 uncompressed streaming protocol. This transfers about 40% more
1947 1952 data than a regular clone, but uses less memory and CPU on both
1948 1953 server and client. Over a LAN (100 Mbps or better) or a very fast
1949 1954 WAN, an uncompressed streaming clone is a lot faster (~10x) than a
1950 1955 regular clone. Over most WAN connections (anything slower than
1951 1956 about 6 Mbps), uncompressed streaming is slower, because of the
1952 1957 extra data transfer overhead. This mode will also temporarily hold
1953 1958 the write lock while determining what data to transfer.
1954 1959 (default: True)
1955 1960
1956 1961 ``uncompressedallowsecret``
1957 1962 Whether to allow stream clones when the repository contains secret
1958 1963 changesets. (default: False)
1959 1964
1960 1965 ``preferuncompressed``
1961 1966 When set, clients will try to use the uncompressed streaming
1962 1967 protocol. (default: False)
1963 1968
1964 1969 ``disablefullbundle``
1965 1970 When set, servers will refuse attempts to do pull-based clones.
1966 1971 If this option is set, ``preferuncompressed`` and/or clone bundles
1967 1972 are highly recommended. Partial clones will still be allowed.
1968 1973 (default: False)
1969 1974
1970 1975 ``streamunbundle``
1971 1976 When set, servers will apply data sent from the client directly,
1972 1977 otherwise it will be written to a temporary file first. This option
1973 1978 effectively prevents concurrent pushes.
1974 1979
1975 1980 ``pullbundle``
1976 1981 When set, the server will check pullbundle.manifest for bundles
1977 1982 covering the requested heads and common nodes. The first matching
1978 1983 entry will be streamed to the client.
1979 1984
1980 1985 For HTTP transport, the stream will still use zlib compression
1981 1986 for older clients.
1982 1987
1983 1988 ``concurrent-push-mode``
1984 1989 Level of allowed race condition between two pushing clients.
1985 1990
1986 1991 - 'strict': push is abort if another client touched the repository
1987 1992 while the push was preparing. (default)
1988 1993 - 'check-related': push is only aborted if it affects head that got also
1989 1994 affected while the push was preparing.
1990 1995
1991 1996 This requires compatible client (version 4.3 and later). Old client will
1992 1997 use 'strict'.
1993 1998
1994 1999 ``validate``
1995 2000 Whether to validate the completeness of pushed changesets by
1996 2001 checking that all new file revisions specified in manifests are
1997 2002 present. (default: False)
1998 2003
1999 2004 ``maxhttpheaderlen``
2000 2005 Instruct HTTP clients not to send request headers longer than this
2001 2006 many bytes. (default: 1024)
2002 2007
2003 2008 ``bundle1``
2004 2009 Whether to allow clients to push and pull using the legacy bundle1
2005 2010 exchange format. (default: True)
2006 2011
2007 2012 ``bundle1gd``
2008 2013 Like ``bundle1`` but only used if the repository is using the
2009 2014 *generaldelta* storage format. (default: True)
2010 2015
2011 2016 ``bundle1.push``
2012 2017 Whether to allow clients to push using the legacy bundle1 exchange
2013 2018 format. (default: True)
2014 2019
2015 2020 ``bundle1gd.push``
2016 2021 Like ``bundle1.push`` but only used if the repository is using the
2017 2022 *generaldelta* storage format. (default: True)
2018 2023
2019 2024 ``bundle1.pull``
2020 2025 Whether to allow clients to pull using the legacy bundle1 exchange
2021 2026 format. (default: True)
2022 2027
2023 2028 ``bundle1gd.pull``
2024 2029 Like ``bundle1.pull`` but only used if the repository is using the
2025 2030 *generaldelta* storage format. (default: True)
2026 2031
2027 2032 Large repositories using the *generaldelta* storage format should
2028 2033 consider setting this option because converting *generaldelta*
2029 2034 repositories to the exchange format required by the bundle1 data
2030 2035 format can consume a lot of CPU.
2031 2036
2032 2037 ``bundle2.stream``
2033 2038 Whether to allow clients to pull using the bundle2 streaming protocol.
2034 2039 (default: True)
2035 2040
2036 2041 ``zliblevel``
2037 2042 Integer between ``-1`` and ``9`` that controls the zlib compression level
2038 2043 for wire protocol commands that send zlib compressed output (notably the
2039 2044 commands that send repository history data).
2040 2045
2041 2046 The default (``-1``) uses the default zlib compression level, which is
2042 2047 likely equivalent to ``6``. ``0`` means no compression. ``9`` means
2043 2048 maximum compression.
2044 2049
2045 2050 Setting this option allows server operators to make trade-offs between
2046 2051 bandwidth and CPU used. Lowering the compression lowers CPU utilization
2047 2052 but sends more bytes to clients.
2048 2053
2049 2054 This option only impacts the HTTP server.
2050 2055
2051 2056 ``zstdlevel``
2052 2057 Integer between ``1`` and ``22`` that controls the zstd compression level
2053 2058 for wire protocol commands. ``1`` is the minimal amount of compression and
2054 2059 ``22`` is the highest amount of compression.
2055 2060
2056 2061 The default (``3``) should be significantly faster than zlib while likely
2057 2062 delivering better compression ratios.
2058 2063
2059 2064 This option only impacts the HTTP server.
2060 2065
2061 2066 See also ``server.zliblevel``.
2062 2067
2063 2068 ``view``
2064 2069 Repository filter used when exchanging revisions with the peer.
2065 2070
2066 2071 The default view (``served``) excludes secret and hidden changesets.
2067 2072 Another useful value is ``immutable`` (no draft, secret or hidden
2068 2073 changesets). (EXPERIMENTAL)
2069 2074
2070 2075 ``smtp``
2071 2076 --------
2072 2077
2073 2078 Configuration for extensions that need to send email messages.
2074 2079
2075 2080 ``host``
2076 2081 Host name of mail server, e.g. "mail.example.com".
2077 2082
2078 2083 ``port``
2079 2084 Optional. Port to connect to on mail server. (default: 465 if
2080 2085 ``tls`` is smtps; 25 otherwise)
2081 2086
2082 2087 ``tls``
2083 2088 Optional. Method to enable TLS when connecting to mail server: starttls,
2084 2089 smtps or none. (default: none)
2085 2090
2086 2091 ``username``
2087 2092 Optional. User name for authenticating with the SMTP server.
2088 2093 (default: None)
2089 2094
2090 2095 ``password``
2091 2096 Optional. Password for authenticating with the SMTP server. If not
2092 2097 specified, interactive sessions will prompt the user for a
2093 2098 password; non-interactive sessions will fail. (default: None)
2094 2099
2095 2100 ``local_hostname``
2096 2101 Optional. The hostname that the sender can use to identify
2097 2102 itself to the MTA.
2098 2103
2099 2104
2100 2105 ``subpaths``
2101 2106 ------------
2102 2107
2103 2108 Subrepository source URLs can go stale if a remote server changes name
2104 2109 or becomes temporarily unavailable. This section lets you define
2105 2110 rewrite rules of the form::
2106 2111
2107 2112 <pattern> = <replacement>
2108 2113
2109 2114 where ``pattern`` is a regular expression matching a subrepository
2110 2115 source URL and ``replacement`` is the replacement string used to
2111 2116 rewrite it. Groups can be matched in ``pattern`` and referenced in
2112 2117 ``replacements``. For instance::
2113 2118
2114 2119 http://server/(.*)-hg/ = http://hg.server/\1/
2115 2120
2116 2121 rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``.
2117 2122
2118 2123 Relative subrepository paths are first made absolute, and the
2119 2124 rewrite rules are then applied on the full (absolute) path. If ``pattern``
2120 2125 doesn't match the full path, an attempt is made to apply it on the
2121 2126 relative path alone. The rules are applied in definition order.
2122 2127
2123 2128 ``subrepos``
2124 2129 ------------
2125 2130
2126 2131 This section contains options that control the behavior of the
2127 2132 subrepositories feature. See also :hg:`help subrepos`.
2128 2133
2129 2134 Security note: auditing in Mercurial is known to be insufficient to
2130 2135 prevent clone-time code execution with carefully constructed Git
2131 2136 subrepos. It is unknown if a similar detect is present in Subversion
2132 2137 subrepos. Both Git and Subversion subrepos are disabled by default
2133 2138 out of security concerns. These subrepo types can be enabled using
2134 2139 the respective options below.
2135 2140
2136 2141 ``allowed``
2137 2142 Whether subrepositories are allowed in the working directory.
2138 2143
2139 2144 When false, commands involving subrepositories (like :hg:`update`)
2140 2145 will fail for all subrepository types.
2141 2146 (default: true)
2142 2147
2143 2148 ``hg:allowed``
2144 2149 Whether Mercurial subrepositories are allowed in the working
2145 2150 directory. This option only has an effect if ``subrepos.allowed``
2146 2151 is true.
2147 2152 (default: true)
2148 2153
2149 2154 ``git:allowed``
2150 2155 Whether Git subrepositories are allowed in the working directory.
2151 2156 This option only has an effect if ``subrepos.allowed`` is true.
2152 2157
2153 2158 See the security note above before enabling Git subrepos.
2154 2159 (default: false)
2155 2160
2156 2161 ``svn:allowed``
2157 2162 Whether Subversion subrepositories are allowed in the working
2158 2163 directory. This option only has an effect if ``subrepos.allowed``
2159 2164 is true.
2160 2165
2161 2166 See the security note above before enabling Subversion subrepos.
2162 2167 (default: false)
2163 2168
2164 2169 ``templatealias``
2165 2170 -----------------
2166 2171
2167 2172 Alias definitions for templates. See :hg:`help templates` for details.
2168 2173
2169 2174 ``templates``
2170 2175 -------------
2171 2176
2172 2177 Use the ``[templates]`` section to define template strings.
2173 2178 See :hg:`help templates` for details.
2174 2179
2175 2180 ``trusted``
2176 2181 -----------
2177 2182
2178 2183 Mercurial will not use the settings in the
2179 2184 ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted
2180 2185 user or to a trusted group, as various hgrc features allow arbitrary
2181 2186 commands to be run. This issue is often encountered when configuring
2182 2187 hooks or extensions for shared repositories or servers. However,
2183 2188 the web interface will use some safe settings from the ``[web]``
2184 2189 section.
2185 2190
2186 2191 This section specifies what users and groups are trusted. The
2187 2192 current user is always trusted. To trust everybody, list a user or a
2188 2193 group with name ``*``. These settings must be placed in an
2189 2194 *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the
2190 2195 user or service running Mercurial.
2191 2196
2192 2197 ``users``
2193 2198 Comma-separated list of trusted users.
2194 2199
2195 2200 ``groups``
2196 2201 Comma-separated list of trusted groups.
2197 2202
2198 2203
2199 2204 ``ui``
2200 2205 ------
2201 2206
2202 2207 User interface controls.
2203 2208
2204 2209 ``archivemeta``
2205 2210 Whether to include the .hg_archival.txt file containing meta data
2206 2211 (hashes for the repository base and for tip) in archives created
2207 2212 by the :hg:`archive` command or downloaded via hgweb.
2208 2213 (default: True)
2209 2214
2210 2215 ``askusername``
2211 2216 Whether to prompt for a username when committing. If True, and
2212 2217 neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will
2213 2218 be prompted to enter a username. If no username is entered, the
2214 2219 default ``USER@HOST`` is used instead.
2215 2220 (default: False)
2216 2221
2217 2222 ``clonebundles``
2218 2223 Whether the "clone bundles" feature is enabled.
2219 2224
2220 2225 When enabled, :hg:`clone` may download and apply a server-advertised
2221 2226 bundle file from a URL instead of using the normal exchange mechanism.
2222 2227
2223 2228 This can likely result in faster and more reliable clones.
2224 2229
2225 2230 (default: True)
2226 2231
2227 2232 ``clonebundlefallback``
2228 2233 Whether failure to apply an advertised "clone bundle" from a server
2229 2234 should result in fallback to a regular clone.
2230 2235
2231 2236 This is disabled by default because servers advertising "clone
2232 2237 bundles" often do so to reduce server load. If advertised bundles
2233 2238 start mass failing and clients automatically fall back to a regular
2234 2239 clone, this would add significant and unexpected load to the server
2235 2240 since the server is expecting clone operations to be offloaded to
2236 2241 pre-generated bundles. Failing fast (the default behavior) ensures
2237 2242 clients don't overwhelm the server when "clone bundle" application
2238 2243 fails.
2239 2244
2240 2245 (default: False)
2241 2246
2242 2247 ``clonebundleprefers``
2243 2248 Defines preferences for which "clone bundles" to use.
2244 2249
2245 2250 Servers advertising "clone bundles" may advertise multiple available
2246 2251 bundles. Each bundle may have different attributes, such as the bundle
2247 2252 type and compression format. This option is used to prefer a particular
2248 2253 bundle over another.
2249 2254
2250 2255 The following keys are defined by Mercurial:
2251 2256
2252 2257 BUNDLESPEC
2253 2258 A bundle type specifier. These are strings passed to :hg:`bundle -t`.
2254 2259 e.g. ``gzip-v2`` or ``bzip2-v1``.
2255 2260
2256 2261 COMPRESSION
2257 2262 The compression format of the bundle. e.g. ``gzip`` and ``bzip2``.
2258 2263
2259 2264 Server operators may define custom keys.
2260 2265
2261 2266 Example values: ``COMPRESSION=bzip2``,
2262 2267 ``BUNDLESPEC=gzip-v2, COMPRESSION=gzip``.
2263 2268
2264 2269 By default, the first bundle advertised by the server is used.
2265 2270
2266 2271 ``color``
2267 2272 When to colorize output. Possible value are Boolean ("yes" or "no"), or
2268 2273 "debug", or "always". (default: "yes"). "yes" will use color whenever it
2269 2274 seems possible. See :hg:`help color` for details.
2270 2275
2271 2276 ``commitsubrepos``
2272 2277 Whether to commit modified subrepositories when committing the
2273 2278 parent repository. If False and one subrepository has uncommitted
2274 2279 changes, abort the commit.
2275 2280 (default: False)
2276 2281
2277 2282 ``debug``
2278 2283 Print debugging information. (default: False)
2279 2284
2280 2285 ``editor``
2281 2286 The editor to use during a commit. (default: ``$EDITOR`` or ``vi``)
2282 2287
2283 2288 ``fallbackencoding``
2284 2289 Encoding to try if it's not possible to decode the changelog using
2285 2290 UTF-8. (default: ISO-8859-1)
2286 2291
2287 2292 ``graphnodetemplate``
2288 2293 The template used to print changeset nodes in an ASCII revision graph.
2289 2294 (default: ``{graphnode}``)
2290 2295
2291 2296 ``ignore``
2292 2297 A file to read per-user ignore patterns from. This file should be
2293 2298 in the same format as a repository-wide .hgignore file. Filenames
2294 2299 are relative to the repository root. This option supports hook syntax,
2295 2300 so if you want to specify multiple ignore files, you can do so by
2296 2301 setting something like ``ignore.other = ~/.hgignore2``. For details
2297 2302 of the ignore file format, see the ``hgignore(5)`` man page.
2298 2303
2299 2304 ``interactive``
2300 2305 Allow to prompt the user. (default: True)
2301 2306
2302 2307 ``interface``
2303 2308 Select the default interface for interactive features (default: text).
2304 2309 Possible values are 'text' and 'curses'.
2305 2310
2306 2311 ``interface.chunkselector``
2307 2312 Select the interface for change recording (e.g. :hg:`commit -i`).
2308 2313 Possible values are 'text' and 'curses'.
2309 2314 This config overrides the interface specified by ui.interface.
2310 2315
2311 2316 ``large-file-limit``
2312 2317 Largest file size that gives no memory use warning.
2313 2318 Possible values are integers or 0 to disable the check.
2314 2319 (default: 10000000)
2315 2320
2316 2321 ``logtemplate``
2317 2322 Template string for commands that print changesets.
2318 2323
2319 2324 ``merge``
2320 2325 The conflict resolution program to use during a manual merge.
2321 2326 For more information on merge tools see :hg:`help merge-tools`.
2322 2327 For configuring merge tools see the ``[merge-tools]`` section.
2323 2328
2324 2329 ``mergemarkers``
2325 2330 Sets the merge conflict marker label styling. The ``detailed``
2326 2331 style uses the ``mergemarkertemplate`` setting to style the labels.
2327 2332 The ``basic`` style just uses 'local' and 'other' as the marker label.
2328 2333 One of ``basic`` or ``detailed``.
2329 2334 (default: ``basic``)
2330 2335
2331 2336 ``mergemarkertemplate``
2332 2337 The template used to print the commit description next to each conflict
2333 2338 marker during merge conflicts. See :hg:`help templates` for the template
2334 2339 format.
2335 2340
2336 2341 Defaults to showing the hash, tags, branches, bookmarks, author, and
2337 2342 the first line of the commit description.
2338 2343
2339 2344 If you use non-ASCII characters in names for tags, branches, bookmarks,
2340 2345 authors, and/or commit descriptions, you must pay attention to encodings of
2341 2346 managed files. At template expansion, non-ASCII characters use the encoding
2342 2347 specified by the ``--encoding`` global option, ``HGENCODING`` or other
2343 2348 environment variables that govern your locale. If the encoding of the merge
2344 2349 markers is different from the encoding of the merged files,
2345 2350 serious problems may occur.
2346 2351
2347 2352 Can be overridden per-merge-tool, see the ``[merge-tools]`` section.
2348 2353
2349 2354 ``message-output``
2350 2355 Where to write status and error messages. (default: ``stdio``)
2351 2356
2352 2357 ``stderr``
2353 2358 Everything to stderr.
2354 2359 ``stdio``
2355 2360 Status to stdout, and error to stderr.
2356 2361
2357 2362 ``origbackuppath``
2358 2363 The path to a directory used to store generated .orig files. If the path is
2359 2364 not a directory, one will be created. If set, files stored in this
2360 2365 directory have the same name as the original file and do not have a .orig
2361 2366 suffix.
2362 2367
2363 2368 ``paginate``
2364 2369 Control the pagination of command output (default: True). See :hg:`help pager`
2365 2370 for details.
2366 2371
2367 2372 ``patch``
2368 2373 An optional external tool that ``hg import`` and some extensions
2369 2374 will use for applying patches. By default Mercurial uses an
2370 2375 internal patch utility. The external tool must work as the common
2371 2376 Unix ``patch`` program. In particular, it must accept a ``-p``
2372 2377 argument to strip patch headers, a ``-d`` argument to specify the
2373 2378 current directory, a file name to patch, and a patch file to take
2374 2379 from stdin.
2375 2380
2376 2381 It is possible to specify a patch tool together with extra
2377 2382 arguments. For example, setting this option to ``patch --merge``
2378 2383 will use the ``patch`` program with its 2-way merge option.
2379 2384
2380 2385 ``portablefilenames``
2381 2386 Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``.
2382 2387 (default: ``warn``)
2383 2388
2384 2389 ``warn``
2385 2390 Print a warning message on POSIX platforms, if a file with a non-portable
2386 2391 filename is added (e.g. a file with a name that can't be created on
2387 2392 Windows because it contains reserved parts like ``AUX``, reserved
2388 2393 characters like ``:``, or would cause a case collision with an existing
2389 2394 file).
2390 2395
2391 2396 ``ignore``
2392 2397 Don't print a warning.
2393 2398
2394 2399 ``abort``
2395 2400 The command is aborted.
2396 2401
2397 2402 ``true``
2398 2403 Alias for ``warn``.
2399 2404
2400 2405 ``false``
2401 2406 Alias for ``ignore``.
2402 2407
2403 2408 .. container:: windows
2404 2409
2405 2410 On Windows, this configuration option is ignored and the command aborted.
2406 2411
2407 2412 ``pre-merge-tool-output-template``
2408 2413 A template that is printed before executing an external merge tool. This can
2409 2414 be used to print out additional context that might be useful to have during
2410 2415 the conflict resolution, such as the description of the various commits
2411 2416 involved or bookmarks/tags.
2412 2417
2413 2418 Additional information is available in the ``local`, ``base``, and ``other``
2414 2419 dicts. For example: ``{local.label}``, ``{base.name}``, or
2415 2420 ``{other.islink}``.
2416 2421
2417 2422 ``quiet``
2418 2423 Reduce the amount of output printed.
2419 2424 (default: False)
2420 2425
2421 2426 ``relative-paths``
2422 2427 Prefer relative paths in the UI.
2423 2428
2424 2429 ``remotecmd``
2425 2430 Remote command to use for clone/push/pull operations.
2426 2431 (default: ``hg``)
2427 2432
2428 2433 ``report_untrusted``
2429 2434 Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a
2430 2435 trusted user or group.
2431 2436 (default: True)
2432 2437
2433 2438 ``slash``
2434 2439 (Deprecated. Use ``slashpath`` template filter instead.)
2435 2440
2436 2441 Display paths using a slash (``/``) as the path separator. This
2437 2442 only makes a difference on systems where the default path
2438 2443 separator is not the slash character (e.g. Windows uses the
2439 2444 backslash character (``\``)).
2440 2445 (default: False)
2441 2446
2442 2447 ``statuscopies``
2443 2448 Display copies in the status command.
2444 2449
2445 2450 ``ssh``
2446 2451 Command to use for SSH connections. (default: ``ssh``)
2447 2452
2448 2453 ``ssherrorhint``
2449 2454 A hint shown to the user in the case of SSH error (e.g.
2450 2455 ``Please see http://company/internalwiki/ssh.html``)
2451 2456
2452 2457 ``strict``
2453 2458 Require exact command names, instead of allowing unambiguous
2454 2459 abbreviations. (default: False)
2455 2460
2456 2461 ``style``
2457 2462 Name of style to use for command output.
2458 2463
2459 2464 ``supportcontact``
2460 2465 A URL where users should report a Mercurial traceback. Use this if you are a
2461 2466 large organisation with its own Mercurial deployment process and crash
2462 2467 reports should be addressed to your internal support.
2463 2468
2464 2469 ``textwidth``
2465 2470 Maximum width of help text. A longer line generated by ``hg help`` or
2466 2471 ``hg subcommand --help`` will be broken after white space to get this
2467 2472 width or the terminal width, whichever comes first.
2468 2473 A non-positive value will disable this and the terminal width will be
2469 2474 used. (default: 78)
2470 2475
2471 2476 ``timeout``
2472 2477 The timeout used when a lock is held (in seconds), a negative value
2473 2478 means no timeout. (default: 600)
2474 2479
2475 2480 ``timeout.warn``
2476 2481 Time (in seconds) before a warning is printed about held lock. A negative
2477 2482 value means no warning. (default: 0)
2478 2483
2479 2484 ``traceback``
2480 2485 Mercurial always prints a traceback when an unknown exception
2481 2486 occurs. Setting this to True will make Mercurial print a traceback
2482 2487 on all exceptions, even those recognized by Mercurial (such as
2483 2488 IOError or MemoryError). (default: False)
2484 2489
2485 2490 ``tweakdefaults``
2486 2491
2487 2492 By default Mercurial's behavior changes very little from release
2488 2493 to release, but over time the recommended config settings
2489 2494 shift. Enable this config to opt in to get automatic tweaks to
2490 2495 Mercurial's behavior over time. This config setting will have no
2491 2496 effect if ``HGPLAIN`` is set or ``HGPLAINEXCEPT`` is set and does
2492 2497 not include ``tweakdefaults``. (default: False)
2493 2498
2494 2499 It currently means::
2495 2500
2496 2501 .. tweakdefaultsmarker
2497 2502
2498 2503 ``username``
2499 2504 The committer of a changeset created when running "commit".
2500 2505 Typically a person's name and email address, e.g. ``Fred Widget
2501 2506 <fred@example.com>``. Environment variables in the
2502 2507 username are expanded.
2503 2508
2504 2509 (default: ``$EMAIL`` or ``username@hostname``. If the username in
2505 2510 hgrc is empty, e.g. if the system admin set ``username =`` in the
2506 2511 system hgrc, it has to be specified manually or in a different
2507 2512 hgrc file)
2508 2513
2509 2514 ``verbose``
2510 2515 Increase the amount of output printed. (default: False)
2511 2516
2512 2517
2513 2518 ``web``
2514 2519 -------
2515 2520
2516 2521 Web interface configuration. The settings in this section apply to
2517 2522 both the builtin webserver (started by :hg:`serve`) and the script you
2518 2523 run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI
2519 2524 and WSGI).
2520 2525
2521 2526 The Mercurial webserver does no authentication (it does not prompt for
2522 2527 usernames and passwords to validate *who* users are), but it does do
2523 2528 authorization (it grants or denies access for *authenticated users*
2524 2529 based on settings in this section). You must either configure your
2525 2530 webserver to do authentication for you, or disable the authorization
2526 2531 checks.
2527 2532
2528 2533 For a quick setup in a trusted environment, e.g., a private LAN, where
2529 2534 you want it to accept pushes from anybody, you can use the following
2530 2535 command line::
2531 2536
2532 2537 $ hg --config web.allow-push=* --config web.push_ssl=False serve
2533 2538
2534 2539 Note that this will allow anybody to push anything to the server and
2535 2540 that this should not be used for public servers.
2536 2541
2537 2542 The full set of options is:
2538 2543
2539 2544 ``accesslog``
2540 2545 Where to output the access log. (default: stdout)
2541 2546
2542 2547 ``address``
2543 2548 Interface address to bind to. (default: all)
2544 2549
2545 2550 ``allow-archive``
2546 2551 List of archive format (bz2, gz, zip) allowed for downloading.
2547 2552 (default: empty)
2548 2553
2549 2554 ``allowbz2``
2550 2555 (DEPRECATED) Whether to allow .tar.bz2 downloading of repository
2551 2556 revisions.
2552 2557 (default: False)
2553 2558
2554 2559 ``allowgz``
2555 2560 (DEPRECATED) Whether to allow .tar.gz downloading of repository
2556 2561 revisions.
2557 2562 (default: False)
2558 2563
2559 2564 ``allow-pull``
2560 2565 Whether to allow pulling from the repository. (default: True)
2561 2566
2562 2567 ``allow-push``
2563 2568 Whether to allow pushing to the repository. If empty or not set,
2564 2569 pushing is not allowed. If the special value ``*``, any remote
2565 2570 user can push, including unauthenticated users. Otherwise, the
2566 2571 remote user must have been authenticated, and the authenticated
2567 2572 user name must be present in this list. The contents of the
2568 2573 allow-push list are examined after the deny_push list.
2569 2574
2570 2575 ``allow_read``
2571 2576 If the user has not already been denied repository access due to
2572 2577 the contents of deny_read, this list determines whether to grant
2573 2578 repository access to the user. If this list is not empty, and the
2574 2579 user is unauthenticated or not present in the list, then access is
2575 2580 denied for the user. If the list is empty or not set, then access
2576 2581 is permitted to all users by default. Setting allow_read to the
2577 2582 special value ``*`` is equivalent to it not being set (i.e. access
2578 2583 is permitted to all users). The contents of the allow_read list are
2579 2584 examined after the deny_read list.
2580 2585
2581 2586 ``allowzip``
2582 2587 (DEPRECATED) Whether to allow .zip downloading of repository
2583 2588 revisions. This feature creates temporary files.
2584 2589 (default: False)
2585 2590
2586 2591 ``archivesubrepos``
2587 2592 Whether to recurse into subrepositories when archiving.
2588 2593 (default: False)
2589 2594
2590 2595 ``baseurl``
2591 2596 Base URL to use when publishing URLs in other locations, so
2592 2597 third-party tools like email notification hooks can construct
2593 2598 URLs. Example: ``http://hgserver/repos/``.
2594 2599
2595 2600 ``cacerts``
2596 2601 Path to file containing a list of PEM encoded certificate
2597 2602 authority certificates. Environment variables and ``~user``
2598 2603 constructs are expanded in the filename. If specified on the
2599 2604 client, then it will verify the identity of remote HTTPS servers
2600 2605 with these certificates.
2601 2606
2602 2607 To disable SSL verification temporarily, specify ``--insecure`` from
2603 2608 command line.
2604 2609
2605 2610 You can use OpenSSL's CA certificate file if your platform has
2606 2611 one. On most Linux systems this will be
2607 2612 ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to
2608 2613 generate this file manually. The form must be as follows::
2609 2614
2610 2615 -----BEGIN CERTIFICATE-----
2611 2616 ... (certificate in base64 PEM encoding) ...
2612 2617 -----END CERTIFICATE-----
2613 2618 -----BEGIN CERTIFICATE-----
2614 2619 ... (certificate in base64 PEM encoding) ...
2615 2620 -----END CERTIFICATE-----
2616 2621
2617 2622 ``cache``
2618 2623 Whether to support caching in hgweb. (default: True)
2619 2624
2620 2625 ``certificate``
2621 2626 Certificate to use when running :hg:`serve`.
2622 2627
2623 2628 ``collapse``
2624 2629 With ``descend`` enabled, repositories in subdirectories are shown at
2625 2630 a single level alongside repositories in the current path. With
2626 2631 ``collapse`` also enabled, repositories residing at a deeper level than
2627 2632 the current path are grouped behind navigable directory entries that
2628 2633 lead to the locations of these repositories. In effect, this setting
2629 2634 collapses each collection of repositories found within a subdirectory
2630 2635 into a single entry for that subdirectory. (default: False)
2631 2636
2632 2637 ``comparisoncontext``
2633 2638 Number of lines of context to show in side-by-side file comparison. If
2634 2639 negative or the value ``full``, whole files are shown. (default: 5)
2635 2640
2636 2641 This setting can be overridden by a ``context`` request parameter to the
2637 2642 ``comparison`` command, taking the same values.
2638 2643
2639 2644 ``contact``
2640 2645 Name or email address of the person in charge of the repository.
2641 2646 (default: ui.username or ``$EMAIL`` or "unknown" if unset or empty)
2642 2647
2643 2648 ``csp``
2644 2649 Send a ``Content-Security-Policy`` HTTP header with this value.
2645 2650
2646 2651 The value may contain a special string ``%nonce%``, which will be replaced
2647 2652 by a randomly-generated one-time use value. If the value contains
2648 2653 ``%nonce%``, ``web.cache`` will be disabled, as caching undermines the
2649 2654 one-time property of the nonce. This nonce will also be inserted into
2650 2655 ``<script>`` elements containing inline JavaScript.
2651 2656
2652 2657 Note: lots of HTML content sent by the server is derived from repository
2653 2658 data. Please consider the potential for malicious repository data to
2654 2659 "inject" itself into generated HTML content as part of your security
2655 2660 threat model.
2656 2661
2657 2662 ``deny_push``
2658 2663 Whether to deny pushing to the repository. If empty or not set,
2659 2664 push is not denied. If the special value ``*``, all remote users are
2660 2665 denied push. Otherwise, unauthenticated users are all denied, and
2661 2666 any authenticated user name present in this list is also denied. The
2662 2667 contents of the deny_push list are examined before the allow-push list.
2663 2668
2664 2669 ``deny_read``
2665 2670 Whether to deny reading/viewing of the repository. If this list is
2666 2671 not empty, unauthenticated users are all denied, and any
2667 2672 authenticated user name present in this list is also denied access to
2668 2673 the repository. If set to the special value ``*``, all remote users
2669 2674 are denied access (rarely needed ;). If deny_read is empty or not set,
2670 2675 the determination of repository access depends on the presence and
2671 2676 content of the allow_read list (see description). If both
2672 2677 deny_read and allow_read are empty or not set, then access is
2673 2678 permitted to all users by default. If the repository is being
2674 2679 served via hgwebdir, denied users will not be able to see it in
2675 2680 the list of repositories. The contents of the deny_read list have
2676 2681 priority over (are examined before) the contents of the allow_read
2677 2682 list.
2678 2683
2679 2684 ``descend``
2680 2685 hgwebdir indexes will not descend into subdirectories. Only repositories
2681 2686 directly in the current path will be shown (other repositories are still
2682 2687 available from the index corresponding to their containing path).
2683 2688
2684 2689 ``description``
2685 2690 Textual description of the repository's purpose or contents.
2686 2691 (default: "unknown")
2687 2692
2688 2693 ``encoding``
2689 2694 Character encoding name. (default: the current locale charset)
2690 2695 Example: "UTF-8".
2691 2696
2692 2697 ``errorlog``
2693 2698 Where to output the error log. (default: stderr)
2694 2699
2695 2700 ``guessmime``
2696 2701 Control MIME types for raw download of file content.
2697 2702 Set to True to let hgweb guess the content type from the file
2698 2703 extension. This will serve HTML files as ``text/html`` and might
2699 2704 allow cross-site scripting attacks when serving untrusted
2700 2705 repositories. (default: False)
2701 2706
2702 2707 ``hidden``
2703 2708 Whether to hide the repository in the hgwebdir index.
2704 2709 (default: False)
2705 2710
2706 2711 ``ipv6``
2707 2712 Whether to use IPv6. (default: False)
2708 2713
2709 2714 ``labels``
2710 2715 List of string *labels* associated with the repository.
2711 2716
2712 2717 Labels are exposed as a template keyword and can be used to customize
2713 2718 output. e.g. the ``index`` template can group or filter repositories
2714 2719 by labels and the ``summary`` template can display additional content
2715 2720 if a specific label is present.
2716 2721
2717 2722 ``logoimg``
2718 2723 File name of the logo image that some templates display on each page.
2719 2724 The file name is relative to ``staticurl``. That is, the full path to
2720 2725 the logo image is "staticurl/logoimg".
2721 2726 If unset, ``hglogo.png`` will be used.
2722 2727
2723 2728 ``logourl``
2724 2729 Base URL to use for logos. If unset, ``https://mercurial-scm.org/``
2725 2730 will be used.
2726 2731
2727 2732 ``maxchanges``
2728 2733 Maximum number of changes to list on the changelog. (default: 10)
2729 2734
2730 2735 ``maxfiles``
2731 2736 Maximum number of files to list per changeset. (default: 10)
2732 2737
2733 2738 ``maxshortchanges``
2734 2739 Maximum number of changes to list on the shortlog, graph or filelog
2735 2740 pages. (default: 60)
2736 2741
2737 2742 ``name``
2738 2743 Repository name to use in the web interface.
2739 2744 (default: current working directory)
2740 2745
2741 2746 ``port``
2742 2747 Port to listen on. (default: 8000)
2743 2748
2744 2749 ``prefix``
2745 2750 Prefix path to serve from. (default: '' (server root))
2746 2751
2747 2752 ``push_ssl``
2748 2753 Whether to require that inbound pushes be transported over SSL to
2749 2754 prevent password sniffing. (default: True)
2750 2755
2751 2756 ``refreshinterval``
2752 2757 How frequently directory listings re-scan the filesystem for new
2753 2758 repositories, in seconds. This is relevant when wildcards are used
2754 2759 to define paths. Depending on how much filesystem traversal is
2755 2760 required, refreshing may negatively impact performance.
2756 2761
2757 2762 Values less than or equal to 0 always refresh.
2758 2763 (default: 20)
2759 2764
2760 2765 ``server-header``
2761 2766 Value for HTTP ``Server`` response header.
2762 2767
2763 2768 ``static``
2764 2769 Directory where static files are served from.
2765 2770
2766 2771 ``staticurl``
2767 2772 Base URL to use for static files. If unset, static files (e.g. the
2768 2773 hgicon.png favicon) will be served by the CGI script itself. Use
2769 2774 this setting to serve them directly with the HTTP server.
2770 2775 Example: ``http://hgserver/static/``.
2771 2776
2772 2777 ``stripes``
2773 2778 How many lines a "zebra stripe" should span in multi-line output.
2774 2779 Set to 0 to disable. (default: 1)
2775 2780
2776 2781 ``style``
2777 2782 Which template map style to use. The available options are the names of
2778 2783 subdirectories in the HTML templates path. (default: ``paper``)
2779 2784 Example: ``monoblue``.
2780 2785
2781 2786 ``templates``
2782 2787 Where to find the HTML templates. The default path to the HTML templates
2783 2788 can be obtained from ``hg debuginstall``.
2784 2789
2785 2790 ``websub``
2786 2791 ----------
2787 2792
2788 2793 Web substitution filter definition. You can use this section to
2789 2794 define a set of regular expression substitution patterns which
2790 2795 let you automatically modify the hgweb server output.
2791 2796
2792 2797 The default hgweb templates only apply these substitution patterns
2793 2798 on the revision description fields. You can apply them anywhere
2794 2799 you want when you create your own templates by adding calls to the
2795 2800 "websub" filter (usually after calling the "escape" filter).
2796 2801
2797 2802 This can be used, for example, to convert issue references to links
2798 2803 to your issue tracker, or to convert "markdown-like" syntax into
2799 2804 HTML (see the examples below).
2800 2805
2801 2806 Each entry in this section names a substitution filter.
2802 2807 The value of each entry defines the substitution expression itself.
2803 2808 The websub expressions follow the old interhg extension syntax,
2804 2809 which in turn imitates the Unix sed replacement syntax::
2805 2810
2806 2811 patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i]
2807 2812
2808 2813 You can use any separator other than "/". The final "i" is optional
2809 2814 and indicates that the search must be case insensitive.
2810 2815
2811 2816 Examples::
2812 2817
2813 2818 [websub]
2814 2819 issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i
2815 2820 italic = s/\b_(\S+)_\b/<i>\1<\/i>/
2816 2821 bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/
2817 2822
2818 2823 ``worker``
2819 2824 ----------
2820 2825
2821 2826 Parallel master/worker configuration. We currently perform working
2822 2827 directory updates in parallel on Unix-like systems, which greatly
2823 2828 helps performance.
2824 2829
2825 2830 ``enabled``
2826 2831 Whether to enable workers code to be used.
2827 2832 (default: true)
2828 2833
2829 2834 ``numcpus``
2830 2835 Number of CPUs to use for parallel operations. A zero or
2831 2836 negative value is treated as ``use the default``.
2832 2837 (default: 4 or the number of CPUs on the system, whichever is larger)
2833 2838
2834 2839 ``backgroundclose``
2835 2840 Whether to enable closing file handles on background threads during certain
2836 2841 operations. Some platforms aren't very efficient at closing file
2837 2842 handles that have been written or appended to. By performing file closing
2838 2843 on background threads, file write rate can increase substantially.
2839 2844 (default: true on Windows, false elsewhere)
2840 2845
2841 2846 ``backgroundcloseminfilecount``
2842 2847 Minimum number of files required to trigger background file closing.
2843 2848 Operations not writing this many files won't start background close
2844 2849 threads.
2845 2850 (default: 2048)
2846 2851
2847 2852 ``backgroundclosemaxqueue``
2848 2853 The maximum number of opened file handles waiting to be closed in the
2849 2854 background. This option only has an effect if ``backgroundclose`` is
2850 2855 enabled.
2851 2856 (default: 384)
2852 2857
2853 2858 ``backgroundclosethreadcount``
2854 2859 Number of threads to process background file closes. Only relevant if
2855 2860 ``backgroundclose`` is enabled.
2856 2861 (default: 4)
@@ -1,252 +1,254
1 1 # profiling.py - profiling functions
2 2 #
3 3 # Copyright 2016 Gregory Szorc <gregory.szorc@gmail.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, print_function
9 9
10 10 import contextlib
11 11
12 12 from .i18n import _
13 13 from . import (
14 14 encoding,
15 15 error,
16 16 extensions,
17 17 pycompat,
18 18 util,
19 19 )
20 20
21 21 def _loadprofiler(ui, profiler):
22 22 """load profiler extension. return profile method, or None on failure"""
23 23 extname = profiler
24 24 extensions.loadall(ui, whitelist=[extname])
25 25 try:
26 26 mod = extensions.find(extname)
27 27 except KeyError:
28 28 return None
29 29 else:
30 30 return getattr(mod, 'profile', None)
31 31
32 32 @contextlib.contextmanager
33 33 def lsprofile(ui, fp):
34 34 format = ui.config('profiling', 'format')
35 35 field = ui.config('profiling', 'sort')
36 36 limit = ui.configint('profiling', 'limit')
37 37 climit = ui.configint('profiling', 'nested')
38 38
39 39 if format not in ['text', 'kcachegrind']:
40 40 ui.warn(_("unrecognized profiling format '%s'"
41 41 " - Ignored\n") % format)
42 42 format = 'text'
43 43
44 44 try:
45 45 from . import lsprof
46 46 except ImportError:
47 47 raise error.Abort(_(
48 48 'lsprof not available - install from '
49 49 'http://codespeak.net/svn/user/arigo/hack/misc/lsprof/'))
50 50 p = lsprof.Profiler()
51 51 p.enable(subcalls=True)
52 52 try:
53 53 yield
54 54 finally:
55 55 p.disable()
56 56
57 57 if format == 'kcachegrind':
58 58 from . import lsprofcalltree
59 59 calltree = lsprofcalltree.KCacheGrind(p)
60 60 calltree.output(fp)
61 61 else:
62 62 # format == 'text'
63 63 stats = lsprof.Stats(p.getstats())
64 64 stats.sort(pycompat.sysstr(field))
65 65 stats.pprint(limit=limit, file=fp, climit=climit)
66 66
67 67 @contextlib.contextmanager
68 68 def flameprofile(ui, fp):
69 69 try:
70 70 from flamegraph import flamegraph
71 71 except ImportError:
72 72 raise error.Abort(_(
73 73 'flamegraph not available - install from '
74 74 'https://github.com/evanhempel/python-flamegraph'))
75 75 # developer config: profiling.freq
76 76 freq = ui.configint('profiling', 'freq')
77 77 filter_ = None
78 78 collapse_recursion = True
79 79 thread = flamegraph.ProfileThread(fp, 1.0 / freq,
80 80 filter_, collapse_recursion)
81 81 start_time = util.timer()
82 82 try:
83 83 thread.start()
84 84 yield
85 85 finally:
86 86 thread.stop()
87 87 thread.join()
88 88 print('Collected %d stack frames (%d unique) in %2.2f seconds.' % (
89 89 util.timer() - start_time, thread.num_frames(),
90 90 thread.num_frames(unique=True)))
91 91
92 92 @contextlib.contextmanager
93 93 def statprofile(ui, fp):
94 94 from . import statprof
95 95
96 96 freq = ui.configint('profiling', 'freq')
97 97 if freq > 0:
98 98 # Cannot reset when profiler is already active. So silently no-op.
99 99 if statprof.state.profile_level == 0:
100 100 statprof.reset(freq)
101 101 else:
102 102 ui.warn(_("invalid sampling frequency '%s' - ignoring\n") % freq)
103 103
104 104 track = ui.config('profiling', 'time-track',
105 105 pycompat.iswindows and 'cpu' or 'real')
106 106 statprof.start(mechanism='thread', track=track)
107 107
108 108 try:
109 109 yield
110 110 finally:
111 111 data = statprof.stop()
112 112
113 113 profformat = ui.config('profiling', 'statformat')
114 114
115 115 formats = {
116 116 'byline': statprof.DisplayFormats.ByLine,
117 117 'bymethod': statprof.DisplayFormats.ByMethod,
118 118 'hotpath': statprof.DisplayFormats.Hotpath,
119 119 'json': statprof.DisplayFormats.Json,
120 120 'chrome': statprof.DisplayFormats.Chrome,
121 121 }
122 122
123 123 if profformat in formats:
124 124 displayformat = formats[profformat]
125 125 else:
126 126 ui.warn(_('unknown profiler output format: %s\n') % profformat)
127 127 displayformat = statprof.DisplayFormats.Hotpath
128 128
129 129 kwargs = {}
130 130
131 131 def fraction(s):
132 132 if isinstance(s, (float, int)):
133 133 return float(s)
134 134 if s.endswith('%'):
135 135 v = float(s[:-1]) / 100
136 136 else:
137 137 v = float(s)
138 138 if 0 <= v <= 1:
139 139 return v
140 140 raise ValueError(s)
141 141
142 142 if profformat == 'chrome':
143 143 showmin = ui.configwith(fraction, 'profiling', 'showmin', 0.005)
144 144 showmax = ui.configwith(fraction, 'profiling', 'showmax')
145 145 kwargs.update(minthreshold=showmin, maxthreshold=showmax)
146 146 elif profformat == 'hotpath':
147 147 # inconsistent config: profiling.showmin
148 148 limit = ui.configwith(fraction, 'profiling', 'showmin', 0.05)
149 149 kwargs[r'limit'] = limit
150 showtime = ui.configbool('profiling', 'showtime')
151 kwargs[r'showtime'] = showtime
150 152
151 153 statprof.display(fp, data=data, format=displayformat, **kwargs)
152 154
153 155 class profile(object):
154 156 """Start profiling.
155 157
156 158 Profiling is active when the context manager is active. When the context
157 159 manager exits, profiling results will be written to the configured output.
158 160 """
159 161 def __init__(self, ui, enabled=True):
160 162 self._ui = ui
161 163 self._output = None
162 164 self._fp = None
163 165 self._fpdoclose = True
164 166 self._profiler = None
165 167 self._enabled = enabled
166 168 self._entered = False
167 169 self._started = False
168 170
169 171 def __enter__(self):
170 172 self._entered = True
171 173 if self._enabled:
172 174 self.start()
173 175 return self
174 176
175 177 def start(self):
176 178 """Start profiling.
177 179
178 180 The profiling will stop at the context exit.
179 181
180 182 If the profiler was already started, this has no effect."""
181 183 if not self._entered:
182 184 raise error.ProgrammingError()
183 185 if self._started:
184 186 return
185 187 self._started = True
186 188 profiler = encoding.environ.get('HGPROF')
187 189 proffn = None
188 190 if profiler is None:
189 191 profiler = self._ui.config('profiling', 'type')
190 192 if profiler not in ('ls', 'stat', 'flame'):
191 193 # try load profiler from extension with the same name
192 194 proffn = _loadprofiler(self._ui, profiler)
193 195 if proffn is None:
194 196 self._ui.warn(_("unrecognized profiler '%s' - ignored\n")
195 197 % profiler)
196 198 profiler = 'stat'
197 199
198 200 self._output = self._ui.config('profiling', 'output')
199 201
200 202 try:
201 203 if self._output == 'blackbox':
202 204 self._fp = util.stringio()
203 205 elif self._output:
204 206 path = self._ui.expandpath(self._output)
205 207 self._fp = open(path, 'wb')
206 208 elif pycompat.iswindows:
207 209 # parse escape sequence by win32print()
208 210 class uifp(object):
209 211 def __init__(self, ui):
210 212 self._ui = ui
211 213 def write(self, data):
212 214 self._ui.write_err(data)
213 215 def flush(self):
214 216 self._ui.flush()
215 217 self._fpdoclose = False
216 218 self._fp = uifp(self._ui)
217 219 else:
218 220 self._fpdoclose = False
219 221 self._fp = self._ui.ferr
220 222
221 223 if proffn is not None:
222 224 pass
223 225 elif profiler == 'ls':
224 226 proffn = lsprofile
225 227 elif profiler == 'flame':
226 228 proffn = flameprofile
227 229 else:
228 230 proffn = statprofile
229 231
230 232 self._profiler = proffn(self._ui, self._fp)
231 233 self._profiler.__enter__()
232 234 except: # re-raises
233 235 self._closefp()
234 236 raise
235 237
236 238 def __exit__(self, exception_type, exception_value, traceback):
237 239 propagate = None
238 240 if self._profiler is not None:
239 241 propagate = self._profiler.__exit__(exception_type, exception_value,
240 242 traceback)
241 243 if self._output == 'blackbox':
242 244 val = 'Profile:\n%s' % self._fp.getvalue()
243 245 # ui.log treats the input as a format string,
244 246 # so we need to escape any % signs.
245 247 val = val.replace('%', '%%')
246 248 self._ui.log('profile', val)
247 249 self._closefp()
248 250 return propagate
249 251
250 252 def _closefp(self):
251 253 if self._fpdoclose and self._fp is not None:
252 254 self._fp.close()
@@ -1,969 +1,972
1 1 #!/usr/bin/env python
2 2 ## statprof.py
3 3 ## Copyright (C) 2012 Bryan O'Sullivan <bos@serpentine.com>
4 4 ## Copyright (C) 2011 Alex Fraser <alex at phatcore dot com>
5 5 ## Copyright (C) 2004,2005 Andy Wingo <wingo at pobox dot com>
6 6 ## Copyright (C) 2001 Rob Browning <rlb at defaultvalue dot org>
7 7
8 8 ## This library is free software; you can redistribute it and/or
9 9 ## modify it under the terms of the GNU Lesser General Public
10 10 ## License as published by the Free Software Foundation; either
11 11 ## version 2.1 of the License, or (at your option) any later version.
12 12 ##
13 13 ## This library is distributed in the hope that it will be useful,
14 14 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
15 15 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 16 ## Lesser General Public License for more details.
17 17 ##
18 18 ## You should have received a copy of the GNU Lesser General Public
19 19 ## License along with this program; if not, contact:
20 20 ##
21 21 ## Free Software Foundation Voice: +1-617-542-5942
22 22 ## 59 Temple Place - Suite 330 Fax: +1-617-542-2652
23 23 ## Boston, MA 02111-1307, USA gnu@gnu.org
24 24
25 25 """
26 26 statprof is intended to be a fairly simple statistical profiler for
27 27 python. It was ported directly from a statistical profiler for guile,
28 28 also named statprof, available from guile-lib [0].
29 29
30 30 [0] http://wingolog.org/software/guile-lib/statprof/
31 31
32 32 To start profiling, call statprof.start():
33 33 >>> start()
34 34
35 35 Then run whatever it is that you want to profile, for example:
36 36 >>> import test.pystone; test.pystone.pystones()
37 37
38 38 Then stop the profiling and print out the results:
39 39 >>> stop()
40 40 >>> display()
41 41 % cumulative self
42 42 time seconds seconds name
43 43 26.72 1.40 0.37 pystone.py:79:Proc0
44 44 13.79 0.56 0.19 pystone.py:133:Proc1
45 45 13.79 0.19 0.19 pystone.py:208:Proc8
46 46 10.34 0.16 0.14 pystone.py:229:Func2
47 47 6.90 0.10 0.10 pystone.py:45:__init__
48 48 4.31 0.16 0.06 pystone.py:53:copy
49 49 ...
50 50
51 51 All of the numerical data is statistically approximate. In the
52 52 following column descriptions, and in all of statprof, "time" refers
53 53 to execution time (both user and system), not wall clock time.
54 54
55 55 % time
56 56 The percent of the time spent inside the procedure itself (not
57 57 counting children).
58 58
59 59 cumulative seconds
60 60 The total number of seconds spent in the procedure, including
61 61 children.
62 62
63 63 self seconds
64 64 The total number of seconds spent in the procedure itself (not
65 65 counting children).
66 66
67 67 name
68 68 The name of the procedure.
69 69
70 70 By default statprof keeps the data collected from previous runs. If you
71 71 want to clear the collected data, call reset():
72 72 >>> reset()
73 73
74 74 reset() can also be used to change the sampling frequency from the
75 75 default of 1000 Hz. For example, to tell statprof to sample 50 times a
76 76 second:
77 77 >>> reset(50)
78 78
79 79 This means that statprof will sample the call stack after every 1/50 of
80 80 a second of user + system time spent running on behalf of the python
81 81 process. When your process is idle (for example, blocking in a read(),
82 82 as is the case at the listener), the clock does not advance. For this
83 83 reason statprof is not currently not suitable for profiling io-bound
84 84 operations.
85 85
86 86 The profiler uses the hash of the code object itself to identify the
87 87 procedures, so it won't confuse different procedures with the same name.
88 88 They will show up as two different rows in the output.
89 89
90 90 Right now the profiler is quite simplistic. I cannot provide
91 91 call-graphs or other higher level information. What you see in the
92 92 table is pretty much all there is. Patches are welcome :-)
93 93
94 94
95 95 Threading
96 96 ---------
97 97
98 98 Because signals only get delivered to the main thread in Python,
99 99 statprof only profiles the main thread. However because the time
100 100 reporting function uses per-process timers, the results can be
101 101 significantly off if other threads' work patterns are not similar to the
102 102 main thread's work patterns.
103 103 """
104 104 # no-check-code
105 105 from __future__ import absolute_import, division, print_function
106 106
107 107 import collections
108 108 import contextlib
109 109 import getopt
110 110 import inspect
111 111 import json
112 112 import os
113 113 import signal
114 114 import sys
115 115 import threading
116 116 import time
117 117
118 118 from . import (
119 119 encoding,
120 120 pycompat,
121 121 )
122 122
123 123 defaultdict = collections.defaultdict
124 124 contextmanager = contextlib.contextmanager
125 125
126 126 __all__ = ['start', 'stop', 'reset', 'display', 'profile']
127 127
128 128 skips = {
129 129 r"util.py:check",
130 130 r"extensions.py:closure",
131 131 r"color.py:colorcmd",
132 132 r"dispatch.py:checkargs",
133 133 r"dispatch.py:<lambda>",
134 134 r"dispatch.py:_runcatch",
135 135 r"dispatch.py:_dispatch",
136 136 r"dispatch.py:_runcommand",
137 137 r"pager.py:pagecmd",
138 138 r"dispatch.py:run",
139 139 r"dispatch.py:dispatch",
140 140 r"dispatch.py:runcommand",
141 141 r"hg.py:<module>",
142 142 r"evolve.py:warnobserrors",
143 143 }
144 144
145 145 ###########################################################################
146 146 ## Utils
147 147
148 148 def clock():
149 149 times = os.times()
150 150 return (times[0] + times[1], times[4])
151 151
152 152
153 153 ###########################################################################
154 154 ## Collection data structures
155 155
156 156 class ProfileState(object):
157 157 def __init__(self, frequency=None):
158 158 self.reset(frequency)
159 159 self.track = 'cpu'
160 160
161 161 def reset(self, frequency=None):
162 162 # total so far
163 163 self.accumulated_time = (0.0, 0.0)
164 164 # start_time when timer is active
165 165 self.last_start_time = None
166 166 # a float
167 167 if frequency:
168 168 self.sample_interval = 1.0 / frequency
169 169 elif not hasattr(self, 'sample_interval'):
170 170 # default to 1000 Hz
171 171 self.sample_interval = 1.0 / 1000.0
172 172 else:
173 173 # leave the frequency as it was
174 174 pass
175 175 self.remaining_prof_time = None
176 176 # for user start/stop nesting
177 177 self.profile_level = 0
178 178
179 179 self.samples = []
180 180
181 181 def accumulate_time(self, stop_time):
182 182 increment = (
183 183 stop_time[0] - self.last_start_time[0],
184 184 stop_time[1] - self.last_start_time[1],
185 185 )
186 186 self.accumulated_time = (
187 187 self.accumulated_time[0] + increment[0],
188 188 self.accumulated_time[1] + increment[1],
189 189 )
190 190
191 191 def seconds_per_sample(self):
192 192 return self.accumulated_time[self.timeidx] / len(self.samples)
193 193
194 194 @property
195 195 def timeidx(self):
196 196 if self.track == 'real':
197 197 return 1
198 198 return 0
199 199
200 200 state = ProfileState()
201 201
202 202
203 203 class CodeSite(object):
204 204 cache = {}
205 205
206 206 __slots__ = (r'path', r'lineno', r'function', r'source')
207 207
208 208 def __init__(self, path, lineno, function):
209 209 assert isinstance(path, bytes)
210 210 self.path = path
211 211 self.lineno = lineno
212 212 assert isinstance(function, bytes)
213 213 self.function = function
214 214 self.source = None
215 215
216 216 def __eq__(self, other):
217 217 try:
218 218 return (self.lineno == other.lineno and
219 219 self.path == other.path)
220 220 except:
221 221 return False
222 222
223 223 def __hash__(self):
224 224 return hash((self.lineno, self.path))
225 225
226 226 @classmethod
227 227 def get(cls, path, lineno, function):
228 228 k = (path, lineno)
229 229 try:
230 230 return cls.cache[k]
231 231 except KeyError:
232 232 v = cls(path, lineno, function)
233 233 cls.cache[k] = v
234 234 return v
235 235
236 236 def getsource(self, length):
237 237 if self.source is None:
238 238 lineno = self.lineno - 1
239 239 fp = None
240 240 try:
241 241 fp = open(self.path, 'rb')
242 242 for i, line in enumerate(fp):
243 243 if i == lineno:
244 244 self.source = line.strip()
245 245 break
246 246 except:
247 247 pass
248 248 finally:
249 249 if fp:
250 250 fp.close()
251 251 if self.source is None:
252 252 self.source = ''
253 253
254 254 source = self.source
255 255 if len(source) > length:
256 256 source = source[:(length - 3)] + "..."
257 257 return source
258 258
259 259 def filename(self):
260 260 return os.path.basename(self.path)
261 261
262 262 def skipname(self):
263 263 return r'%s:%s' % (self.filename(), self.function)
264 264
265 265 class Sample(object):
266 266 __slots__ = (r'stack', r'time')
267 267
268 268 def __init__(self, stack, time):
269 269 self.stack = stack
270 270 self.time = time
271 271
272 272 @classmethod
273 273 def from_frame(cls, frame, time):
274 274 stack = []
275 275
276 276 while frame:
277 277 stack.append(CodeSite.get(
278 278 pycompat.sysbytes(frame.f_code.co_filename),
279 279 frame.f_lineno,
280 280 pycompat.sysbytes(frame.f_code.co_name)))
281 281 frame = frame.f_back
282 282
283 283 return Sample(stack, time)
284 284
285 285 ###########################################################################
286 286 ## SIGPROF handler
287 287
288 288 def profile_signal_handler(signum, frame):
289 289 if state.profile_level > 0:
290 290 now = clock()
291 291 state.accumulate_time(now)
292 292
293 293 timestamp = state.accumulated_time[state.timeidx]
294 294 state.samples.append(Sample.from_frame(frame, timestamp))
295 295
296 296 signal.setitimer(signal.ITIMER_PROF,
297 297 state.sample_interval, 0.0)
298 298 state.last_start_time = now
299 299
300 300 stopthread = threading.Event()
301 301 def samplerthread(tid):
302 302 while not stopthread.is_set():
303 303 now = clock()
304 304 state.accumulate_time(now)
305 305
306 306 frame = sys._current_frames()[tid]
307 307
308 308 timestamp = state.accumulated_time[state.timeidx]
309 309 state.samples.append(Sample.from_frame(frame, timestamp))
310 310
311 311 state.last_start_time = now
312 312 time.sleep(state.sample_interval)
313 313
314 314 stopthread.clear()
315 315
316 316 ###########################################################################
317 317 ## Profiling API
318 318
319 319 def is_active():
320 320 return state.profile_level > 0
321 321
322 322 lastmechanism = None
323 323 def start(mechanism='thread', track='cpu'):
324 324 '''Install the profiling signal handler, and start profiling.'''
325 325 state.track = track # note: nesting different mode won't work
326 326 state.profile_level += 1
327 327 if state.profile_level == 1:
328 328 state.last_start_time = clock()
329 329 rpt = state.remaining_prof_time
330 330 state.remaining_prof_time = None
331 331
332 332 global lastmechanism
333 333 lastmechanism = mechanism
334 334
335 335 if mechanism == 'signal':
336 336 signal.signal(signal.SIGPROF, profile_signal_handler)
337 337 signal.setitimer(signal.ITIMER_PROF,
338 338 rpt or state.sample_interval, 0.0)
339 339 elif mechanism == 'thread':
340 340 frame = inspect.currentframe()
341 341 tid = [k for k, f in sys._current_frames().items() if f == frame][0]
342 342 state.thread = threading.Thread(target=samplerthread,
343 343 args=(tid,), name="samplerthread")
344 344 state.thread.start()
345 345
346 346 def stop():
347 347 '''Stop profiling, and uninstall the profiling signal handler.'''
348 348 state.profile_level -= 1
349 349 if state.profile_level == 0:
350 350 if lastmechanism == 'signal':
351 351 rpt = signal.setitimer(signal.ITIMER_PROF, 0.0, 0.0)
352 352 signal.signal(signal.SIGPROF, signal.SIG_IGN)
353 353 state.remaining_prof_time = rpt[0]
354 354 elif lastmechanism == 'thread':
355 355 stopthread.set()
356 356 state.thread.join()
357 357
358 358 state.accumulate_time(clock())
359 359 state.last_start_time = None
360 360 statprofpath = encoding.environ.get('STATPROF_DEST')
361 361 if statprofpath:
362 362 save_data(statprofpath)
363 363
364 364 return state
365 365
366 366 def save_data(path):
367 367 with open(path, 'w+') as file:
368 368 file.write("%f %f\n" % state.accumulated_time)
369 369 for sample in state.samples:
370 370 time = sample.time
371 371 stack = sample.stack
372 372 sites = ['\1'.join([s.path, b'%d' % s.lineno, s.function])
373 373 for s in stack]
374 374 file.write("%d\0%s\n" % (time, '\0'.join(sites)))
375 375
376 376 def load_data(path):
377 377 lines = open(path, 'rb').read().splitlines()
378 378
379 379 state.accumulated_time = [float(value) for value in lines[0].split()]
380 380 state.samples = []
381 381 for line in lines[1:]:
382 382 parts = line.split('\0')
383 383 time = float(parts[0])
384 384 rawsites = parts[1:]
385 385 sites = []
386 386 for rawsite in rawsites:
387 387 siteparts = rawsite.split('\1')
388 388 sites.append(CodeSite.get(siteparts[0], int(siteparts[1]),
389 389 siteparts[2]))
390 390
391 391 state.samples.append(Sample(sites, time))
392 392
393 393
394 394
395 395 def reset(frequency=None):
396 396 '''Clear out the state of the profiler. Do not call while the
397 397 profiler is running.
398 398
399 399 The optional frequency argument specifies the number of samples to
400 400 collect per second.'''
401 401 assert state.profile_level == 0, "Can't reset() while statprof is running"
402 402 CodeSite.cache.clear()
403 403 state.reset(frequency)
404 404
405 405
406 406 @contextmanager
407 407 def profile():
408 408 start()
409 409 try:
410 410 yield
411 411 finally:
412 412 stop()
413 413 display()
414 414
415 415
416 416 ###########################################################################
417 417 ## Reporting API
418 418
419 419 class SiteStats(object):
420 420 def __init__(self, site):
421 421 self.site = site
422 422 self.selfcount = 0
423 423 self.totalcount = 0
424 424
425 425 def addself(self):
426 426 self.selfcount += 1
427 427
428 428 def addtotal(self):
429 429 self.totalcount += 1
430 430
431 431 def selfpercent(self):
432 432 return self.selfcount / len(state.samples) * 100
433 433
434 434 def totalpercent(self):
435 435 return self.totalcount / len(state.samples) * 100
436 436
437 437 def selfseconds(self):
438 438 return self.selfcount * state.seconds_per_sample()
439 439
440 440 def totalseconds(self):
441 441 return self.totalcount * state.seconds_per_sample()
442 442
443 443 @classmethod
444 444 def buildstats(cls, samples):
445 445 stats = {}
446 446
447 447 for sample in samples:
448 448 for i, site in enumerate(sample.stack):
449 449 sitestat = stats.get(site)
450 450 if not sitestat:
451 451 sitestat = SiteStats(site)
452 452 stats[site] = sitestat
453 453
454 454 sitestat.addtotal()
455 455
456 456 if i == 0:
457 457 sitestat.addself()
458 458
459 459 return [s for s in stats.itervalues()]
460 460
461 461 class DisplayFormats:
462 462 ByLine = 0
463 463 ByMethod = 1
464 464 AboutMethod = 2
465 465 Hotpath = 3
466 466 FlameGraph = 4
467 467 Json = 5
468 468 Chrome = 6
469 469
470 470 def display(fp=None, format=3, data=None, **kwargs):
471 471 '''Print statistics, either to stdout or the given file object.'''
472 472 if data is None:
473 473 data = state
474 474
475 475 if fp is None:
476 476 import sys
477 477 fp = sys.stdout
478 478 if len(data.samples) == 0:
479 479 fp.write(b'No samples recorded.\n')
480 480 return
481 481
482 482 if format == DisplayFormats.ByLine:
483 483 display_by_line(data, fp)
484 484 elif format == DisplayFormats.ByMethod:
485 485 display_by_method(data, fp)
486 486 elif format == DisplayFormats.AboutMethod:
487 487 display_about_method(data, fp, **kwargs)
488 488 elif format == DisplayFormats.Hotpath:
489 489 display_hotpath(data, fp, **kwargs)
490 490 elif format == DisplayFormats.FlameGraph:
491 491 write_to_flame(data, fp, **kwargs)
492 492 elif format == DisplayFormats.Json:
493 493 write_to_json(data, fp)
494 494 elif format == DisplayFormats.Chrome:
495 495 write_to_chrome(data, fp, **kwargs)
496 496 else:
497 497 raise Exception("Invalid display format")
498 498
499 499 if format not in (DisplayFormats.Json, DisplayFormats.Chrome):
500 500 fp.write(b'---\n')
501 501 fp.write(b'Sample count: %d\n' % len(data.samples))
502 502 fp.write(b'Total time: %f seconds (%f wall)\n' % data.accumulated_time)
503 503
504 504 def display_by_line(data, fp):
505 505 '''Print the profiler data with each sample line represented
506 506 as one row in a table. Sorted by self-time per line.'''
507 507 stats = SiteStats.buildstats(data.samples)
508 508 stats.sort(reverse=True, key=lambda x: x.selfseconds())
509 509
510 510 fp.write(b'%5.5s %10.10s %7.7s %-8.8s\n' % (
511 511 b'% ', b'cumulative', b'self', b''))
512 512 fp.write(b'%5.5s %9.9s %8.8s %-8.8s\n' % (
513 513 b"time", b"seconds", b"seconds", b"name"))
514 514
515 515 for stat in stats:
516 516 site = stat.site
517 517 sitelabel = '%s:%d:%s' % (site.filename(),
518 518 site.lineno,
519 519 site.function)
520 520 fp.write(b'%6.2f %9.2f %9.2f %s\n' % (
521 521 stat.selfpercent(), stat.totalseconds(),
522 522 stat.selfseconds(), sitelabel))
523 523
524 524 def display_by_method(data, fp):
525 525 '''Print the profiler data with each sample function represented
526 526 as one row in a table. Important lines within that function are
527 527 output as nested rows. Sorted by self-time per line.'''
528 528 fp.write(b'%5.5s %10.10s %7.7s %-8.8s\n' %
529 529 ('% ', 'cumulative', 'self', ''))
530 530 fp.write(b'%5.5s %9.9s %8.8s %-8.8s\n' %
531 531 ("time", "seconds", "seconds", "name"))
532 532
533 533 stats = SiteStats.buildstats(data.samples)
534 534
535 535 grouped = defaultdict(list)
536 536 for stat in stats:
537 537 grouped[stat.site.filename() + b":" + stat.site.function].append(stat)
538 538
539 539 # compute sums for each function
540 540 functiondata = []
541 541 for fname, sitestats in grouped.iteritems():
542 542 total_cum_sec = 0
543 543 total_self_sec = 0
544 544 total_percent = 0
545 545 for stat in sitestats:
546 546 total_cum_sec += stat.totalseconds()
547 547 total_self_sec += stat.selfseconds()
548 548 total_percent += stat.selfpercent()
549 549
550 550 functiondata.append((fname,
551 551 total_cum_sec,
552 552 total_self_sec,
553 553 total_percent,
554 554 sitestats))
555 555
556 556 # sort by total self sec
557 557 functiondata.sort(reverse=True, key=lambda x: x[2])
558 558
559 559 for function in functiondata:
560 560 if function[3] < 0.05:
561 561 continue
562 562 fp.write(b'%6.2f %9.2f %9.2f %s\n' % (
563 563 function[3], # total percent
564 564 function[1], # total cum sec
565 565 function[2], # total self sec
566 566 function[0])) # file:function
567 567
568 568 function[4].sort(reverse=True, key=lambda i: i.selfseconds())
569 569 for stat in function[4]:
570 570 # only show line numbers for significant locations (>1% time spent)
571 571 if stat.selfpercent() > 1:
572 572 source = stat.site.getsource(25)
573 573 if sys.version_info.major >= 3 and not isinstance(source, bytes):
574 574 source = pycompat.bytestr(source)
575 575
576 576 stattuple = (stat.selfpercent(), stat.selfseconds(),
577 577 stat.site.lineno, source)
578 578
579 579 fp.write(b'%33.0f%% %6.2f line %d: %s\n' % stattuple)
580 580
581 581 def display_about_method(data, fp, function=None, **kwargs):
582 582 if function is None:
583 583 raise Exception("Invalid function")
584 584
585 585 filename = None
586 586 if ':' in function:
587 587 filename, function = function.split(':')
588 588
589 589 relevant_samples = 0
590 590 parents = {}
591 591 children = {}
592 592
593 593 for sample in data.samples:
594 594 for i, site in enumerate(sample.stack):
595 595 if site.function == function and (not filename
596 596 or site.filename() == filename):
597 597 relevant_samples += 1
598 598 if i != len(sample.stack) - 1:
599 599 parent = sample.stack[i + 1]
600 600 if parent in parents:
601 601 parents[parent] = parents[parent] + 1
602 602 else:
603 603 parents[parent] = 1
604 604
605 605 if site in children:
606 606 children[site] = children[site] + 1
607 607 else:
608 608 children[site] = 1
609 609
610 610 parents = [(parent, count) for parent, count in parents.iteritems()]
611 611 parents.sort(reverse=True, key=lambda x: x[1])
612 612 for parent, count in parents:
613 613 fp.write(b'%6.2f%% %s:%s line %s: %s\n' %
614 614 (count / relevant_samples * 100,
615 615 pycompat.fsencode(parent.filename()),
616 616 pycompat.sysbytes(parent.function),
617 617 parent.lineno,
618 618 pycompat.sysbytes(parent.getsource(50))))
619 619
620 620 stats = SiteStats.buildstats(data.samples)
621 621 stats = [s for s in stats
622 622 if s.site.function == function and
623 623 (not filename or s.site.filename() == filename)]
624 624
625 625 total_cum_sec = 0
626 626 total_self_sec = 0
627 627 total_self_percent = 0
628 628 total_cum_percent = 0
629 629 for stat in stats:
630 630 total_cum_sec += stat.totalseconds()
631 631 total_self_sec += stat.selfseconds()
632 632 total_self_percent += stat.selfpercent()
633 633 total_cum_percent += stat.totalpercent()
634 634
635 635 fp.write(
636 636 b'\n %s:%s Total: %0.2fs (%0.2f%%) Self: %0.2fs (%0.2f%%)\n\n'
637 637 % (
638 638 pycompat.sysbytes(filename or '___'),
639 639 pycompat.sysbytes(function),
640 640 total_cum_sec,
641 641 total_cum_percent,
642 642 total_self_sec,
643 643 total_self_percent
644 644 ))
645 645
646 646 children = [(child, count) for child, count in children.iteritems()]
647 647 children.sort(reverse=True, key=lambda x: x[1])
648 648 for child, count in children:
649 649 fp.write(b' %6.2f%% line %s: %s\n' %
650 650 (count / relevant_samples * 100, child.lineno,
651 651 pycompat.sysbytes(child.getsource(50))))
652 652
653 653 def display_hotpath(data, fp, limit=0.05, **kwargs):
654 654 class HotNode(object):
655 655 def __init__(self, site):
656 656 self.site = site
657 657 self.count = 0
658 658 self.children = {}
659 659
660 660 def add(self, stack, time):
661 661 self.count += time
662 662 site = stack[0]
663 663 child = self.children.get(site)
664 664 if not child:
665 665 child = HotNode(site)
666 666 self.children[site] = child
667 667
668 668 if len(stack) > 1:
669 669 i = 1
670 670 # Skip boiler plate parts of the stack
671 671 while i < len(stack) and stack[i].skipname() in skips:
672 672 i += 1
673 673 if i < len(stack):
674 674 child.add(stack[i:], time)
675 675
676 676 root = HotNode(None)
677 677 lasttime = data.samples[0].time
678 678 for sample in data.samples:
679 679 root.add(sample.stack[::-1], sample.time - lasttime)
680 680 lasttime = sample.time
681 showtime = kwargs.get(r'showtime', True)
681 682
682 683 def _write(node, depth, multiple_siblings):
683 684 site = node.site
684 685 visiblechildren = [c for c in node.children.itervalues()
685 686 if c.count >= (limit * root.count)]
686 687 if site:
687 688 indent = depth * 2 - 1
688 689 filename = ''
689 690 function = ''
690 691 if len(node.children) > 0:
691 692 childsite = list(node.children.itervalues())[0].site
692 693 filename = (childsite.filename() + ':').ljust(15)
693 694 function = childsite.function
694 695
695 696 # lots of string formatting
696 697 listpattern = ''.ljust(indent) +\
697 698 ('\\' if multiple_siblings else '|') +\
698 ' %4.1f%% %s %s'
699 ' %4.1f%%' +\
700 (' %5.2fs' % node.count if showtime else '') +\
701 ' %s %s'
699 702 liststring = listpattern % (node.count / root.count * 100,
700 703 filename, function)
701 704 codepattern = '%' + ('%d' % (55 - len(liststring))) + 's %d: %s'
702 705 codestring = codepattern % ('line', site.lineno, site.getsource(30))
703 706
704 707 finalstring = liststring + codestring
705 708 childrensamples = sum([c.count for c in node.children.itervalues()])
706 709 # Make frames that performed more than 10% of the operation red
707 710 if node.count - childrensamples > (0.1 * root.count):
708 711 finalstring = '\033[91m' + finalstring + '\033[0m'
709 712 # Make frames that didn't actually perform work dark grey
710 713 elif node.count - childrensamples == 0:
711 714 finalstring = '\033[90m' + finalstring + '\033[0m'
712 715 fp.write(finalstring + b'\n')
713 716
714 717 newdepth = depth
715 718 if len(visiblechildren) > 1 or multiple_siblings:
716 719 newdepth += 1
717 720
718 721 visiblechildren.sort(reverse=True, key=lambda x: x.count)
719 722 for child in visiblechildren:
720 723 _write(child, newdepth, len(visiblechildren) > 1)
721 724
722 725 if root.count > 0:
723 726 _write(root, 0, False)
724 727
725 728 def write_to_flame(data, fp, scriptpath=None, outputfile=None, **kwargs):
726 729 if scriptpath is None:
727 730 scriptpath = encoding.environ['HOME'] + '/flamegraph.pl'
728 731 if not os.path.exists(scriptpath):
729 732 fp.write(b'error: missing %s\n' % scriptpath)
730 733 fp.write(b'get it here: https://github.com/brendangregg/FlameGraph\n')
731 734 return
732 735
733 736 fd, path = pycompat.mkstemp()
734 737
735 738 file = open(path, "w+")
736 739
737 740 lines = {}
738 741 for sample in data.samples:
739 742 sites = [s.function for s in sample.stack]
740 743 sites.reverse()
741 744 line = ';'.join(sites)
742 745 if line in lines:
743 746 lines[line] = lines[line] + 1
744 747 else:
745 748 lines[line] = 1
746 749
747 750 for line, count in lines.iteritems():
748 751 file.write("%s %d\n" % (line, count))
749 752
750 753 file.close()
751 754
752 755 if outputfile is None:
753 756 outputfile = '~/flamegraph.svg'
754 757
755 758 os.system("perl ~/flamegraph.pl %s > %s" % (path, outputfile))
756 759 fp.write(b'Written to %s\n' % outputfile)
757 760
758 761 _pathcache = {}
759 762 def simplifypath(path):
760 763 '''Attempt to make the path to a Python module easier to read by
761 764 removing whatever part of the Python search path it was found
762 765 on.'''
763 766
764 767 if path in _pathcache:
765 768 return _pathcache[path]
766 769 hgpath = pycompat.fsencode(encoding.__file__).rsplit(os.sep, 2)[0]
767 770 for p in [hgpath] + sys.path:
768 771 prefix = p + os.sep
769 772 if path.startswith(prefix):
770 773 path = path[len(prefix):]
771 774 break
772 775 _pathcache[path] = path
773 776 return path
774 777
775 778 def write_to_json(data, fp):
776 779 samples = []
777 780
778 781 for sample in data.samples:
779 782 stack = []
780 783
781 784 for frame in sample.stack:
782 785 stack.append(
783 786 (pycompat.sysstr(frame.path),
784 787 frame.lineno,
785 788 pycompat.sysstr(frame.function)))
786 789
787 790 samples.append((sample.time, stack))
788 791
789 792 data = json.dumps(samples)
790 793 if not isinstance(data, bytes):
791 794 data = data.encode('utf-8')
792 795
793 796 fp.write(data)
794 797
795 798 def write_to_chrome(data, fp, minthreshold=0.005, maxthreshold=0.999):
796 799 samples = []
797 800 laststack = collections.deque()
798 801 lastseen = collections.deque()
799 802
800 803 # The Chrome tracing format allows us to use a compact stack
801 804 # representation to save space. It's fiddly but worth it.
802 805 # We maintain a bijection between stack and ID.
803 806 stack2id = {}
804 807 id2stack = [] # will eventually be rendered
805 808
806 809 def stackid(stack):
807 810 if not stack:
808 811 return
809 812 if stack in stack2id:
810 813 return stack2id[stack]
811 814 parent = stackid(stack[1:])
812 815 myid = len(stack2id)
813 816 stack2id[stack] = myid
814 817 id2stack.append(dict(category=stack[0][0], name='%s %s' % stack[0]))
815 818 if parent is not None:
816 819 id2stack[-1].update(parent=parent)
817 820 return myid
818 821
819 822 # The sampling profiler can sample multiple times without
820 823 # advancing the clock, potentially causing the Chrome trace viewer
821 824 # to render single-pixel columns that we cannot zoom in on. We
822 825 # work around this by pretending that zero-duration samples are a
823 826 # millisecond in length.
824 827
825 828 clamp = 0.001
826 829
827 830 # We provide knobs that by default attempt to filter out stack
828 831 # frames that are too noisy:
829 832 #
830 833 # * A few take almost all execution time. These are usually boring
831 834 # setup functions, giving a stack that is deep but uninformative.
832 835 #
833 836 # * Numerous samples take almost no time, but introduce lots of
834 837 # noisy, oft-deep "spines" into a rendered profile.
835 838
836 839 blacklist = set()
837 840 totaltime = data.samples[-1].time - data.samples[0].time
838 841 minthreshold = totaltime * minthreshold
839 842 maxthreshold = max(totaltime * maxthreshold, clamp)
840 843
841 844 def poplast():
842 845 oldsid = stackid(tuple(laststack))
843 846 oldcat, oldfunc = laststack.popleft()
844 847 oldtime, oldidx = lastseen.popleft()
845 848 duration = sample.time - oldtime
846 849 if minthreshold <= duration <= maxthreshold:
847 850 # ensure no zero-duration events
848 851 sampletime = max(oldtime + clamp, sample.time)
849 852 samples.append(dict(ph='E', name=oldfunc, cat=oldcat, sf=oldsid,
850 853 ts=sampletime*1e6, pid=0))
851 854 else:
852 855 blacklist.add(oldidx)
853 856
854 857 # Much fiddling to synthesize correctly(ish) nested begin/end
855 858 # events given only stack snapshots.
856 859
857 860 for sample in data.samples:
858 861 stack = tuple((('%s:%d' % (simplifypath(frame.path), frame.lineno),
859 862 frame.function) for frame in sample.stack))
860 863 qstack = collections.deque(stack)
861 864 if laststack == qstack:
862 865 continue
863 866 while laststack and qstack and laststack[-1] == qstack[-1]:
864 867 laststack.pop()
865 868 qstack.pop()
866 869 while laststack:
867 870 poplast()
868 871 for f in reversed(qstack):
869 872 lastseen.appendleft((sample.time, len(samples)))
870 873 laststack.appendleft(f)
871 874 path, name = f
872 875 sid = stackid(tuple(laststack))
873 876 samples.append(dict(ph='B', name=name, cat=path, ts=sample.time*1e6,
874 877 sf=sid, pid=0))
875 878 laststack = collections.deque(stack)
876 879 while laststack:
877 880 poplast()
878 881 events = [s[1] for s in enumerate(samples) if s[0] not in blacklist]
879 882 frames = collections.OrderedDict((str(k), v)
880 883 for (k,v) in enumerate(id2stack))
881 884 json.dump(dict(traceEvents=events, stackFrames=frames), fp, indent=1)
882 885 fp.write('\n')
883 886
884 887 def printusage():
885 888 print(r"""
886 889 The statprof command line allows you to inspect the last profile's results in
887 890 the following forms:
888 891
889 892 usage:
890 893 hotpath [-l --limit percent]
891 894 Shows a graph of calls with the percent of time each takes.
892 895 Red calls take over 10%% of the total time themselves.
893 896 lines
894 897 Shows the actual sampled lines.
895 898 functions
896 899 Shows the samples grouped by function.
897 900 function [filename:]functionname
898 901 Shows the callers and callees of a particular function.
899 902 flame [-s --script-path] [-o --output-file path]
900 903 Writes out a flamegraph to output-file (defaults to ~/flamegraph.svg)
901 904 Requires that ~/flamegraph.pl exist.
902 905 (Specify alternate script path with --script-path.)""")
903 906
904 907 def main(argv=None):
905 908 if argv is None:
906 909 argv = sys.argv
907 910
908 911 if len(argv) == 1:
909 912 printusage()
910 913 return 0
911 914
912 915 displayargs = {}
913 916
914 917 optstart = 2
915 918 displayargs['function'] = None
916 919 if argv[1] == r'hotpath':
917 920 displayargs['format'] = DisplayFormats.Hotpath
918 921 elif argv[1] == r'lines':
919 922 displayargs['format'] = DisplayFormats.ByLine
920 923 elif argv[1] == r'functions':
921 924 displayargs['format'] = DisplayFormats.ByMethod
922 925 elif argv[1] == r'function':
923 926 displayargs['format'] = DisplayFormats.AboutMethod
924 927 displayargs['function'] = argv[2]
925 928 optstart = 3
926 929 elif argv[1] == r'flame':
927 930 displayargs['format'] = DisplayFormats.FlameGraph
928 931 else:
929 932 printusage()
930 933 return 0
931 934
932 935 # process options
933 936 try:
934 937 opts, args = pycompat.getoptb(sys.argv[optstart:], "hl:f:o:p:",
935 938 ["help", "limit=", "file=", "output-file=", "script-path="])
936 939 except getopt.error as msg:
937 940 print(msg)
938 941 printusage()
939 942 return 2
940 943
941 944 displayargs['limit'] = 0.05
942 945 path = None
943 946 for o, value in opts:
944 947 if o in (r"-l", r"--limit"):
945 948 displayargs['limit'] = float(value)
946 949 elif o in (r"-f", r"--file"):
947 950 path = value
948 951 elif o in (r"-o", r"--output-file"):
949 952 displayargs['outputfile'] = value
950 953 elif o in (r"-p", r"--script-path"):
951 954 displayargs['scriptpath'] = value
952 955 elif o in (r"-h", r"help"):
953 956 printusage()
954 957 return 0
955 958 else:
956 959 assert False, "unhandled option %s" % o
957 960
958 961 if not path:
959 962 print(r'must specify --file to load')
960 963 return 1
961 964
962 965 load_data(path=path)
963 966
964 967 display(**pycompat.strkwargs(displayargs))
965 968
966 969 return 0
967 970
968 971 if __name__ == r"__main__":
969 972 sys.exit(main())
General Comments 0
You need to be logged in to leave comments. Login now