##// END OF EJS Templates
configitems: register the 'smtp.port' config
Boris Feld -
r34479:a27718ef default
parent child Browse files
Show More
@@ -1,683 +1,686
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
12 12 from . import (
13 13 encoding,
14 14 error,
15 15 )
16 16
17 17 def loadconfigtable(ui, extname, configtable):
18 18 """update config item known to the ui with the extension ones"""
19 19 for section, items in configtable.items():
20 20 knownitems = ui._knownconfig.setdefault(section, {})
21 21 knownkeys = set(knownitems)
22 22 newkeys = set(items)
23 23 for key in sorted(knownkeys & newkeys):
24 24 msg = "extension '%s' overwrite config item '%s.%s'"
25 25 msg %= (extname, section, key)
26 26 ui.develwarn(msg, config='warn-config')
27 27
28 28 knownitems.update(items)
29 29
30 30 class configitem(object):
31 31 """represent a known config item
32 32
33 33 :section: the official config section where to find this item,
34 34 :name: the official name within the section,
35 35 :default: default value for this item,
36 36 :alias: optional list of tuples as alternatives.
37 37 """
38 38
39 39 def __init__(self, section, name, default=None, alias=()):
40 40 self.section = section
41 41 self.name = name
42 42 self.default = default
43 43 self.alias = list(alias)
44 44
45 45 coreitems = {}
46 46
47 47 def _register(configtable, *args, **kwargs):
48 48 item = configitem(*args, **kwargs)
49 49 section = configtable.setdefault(item.section, {})
50 50 if item.name in section:
51 51 msg = "duplicated config item registration for '%s.%s'"
52 52 raise error.ProgrammingError(msg % (item.section, item.name))
53 53 section[item.name] = item
54 54
55 55 # special value for case where the default is derived from other values
56 56 dynamicdefault = object()
57 57
58 58 # Registering actual config items
59 59
60 60 def getitemregister(configtable):
61 61 return functools.partial(_register, configtable)
62 62
63 63 coreconfigitem = getitemregister(coreitems)
64 64
65 65 coreconfigitem('auth', 'cookiefile',
66 66 default=None,
67 67 )
68 68 # bookmarks.pushing: internal hack for discovery
69 69 coreconfigitem('bookmarks', 'pushing',
70 70 default=list,
71 71 )
72 72 # bundle.mainreporoot: internal hack for bundlerepo
73 73 coreconfigitem('bundle', 'mainreporoot',
74 74 default='',
75 75 )
76 76 # bundle.reorder: experimental config
77 77 coreconfigitem('bundle', 'reorder',
78 78 default='auto',
79 79 )
80 80 coreconfigitem('censor', 'policy',
81 81 default='abort',
82 82 )
83 83 coreconfigitem('chgserver', 'idletimeout',
84 84 default=3600,
85 85 )
86 86 coreconfigitem('chgserver', 'skiphash',
87 87 default=False,
88 88 )
89 89 coreconfigitem('cmdserver', 'log',
90 90 default=None,
91 91 )
92 92 coreconfigitem('color', 'mode',
93 93 default='auto',
94 94 )
95 95 coreconfigitem('color', 'pagermode',
96 96 default=dynamicdefault,
97 97 )
98 98 coreconfigitem('commands', 'status.relative',
99 99 default=False,
100 100 )
101 101 coreconfigitem('commands', 'status.skipstates',
102 102 default=[],
103 103 )
104 104 coreconfigitem('commands', 'status.verbose',
105 105 default=False,
106 106 )
107 107 coreconfigitem('commands', 'update.requiredest',
108 108 default=False,
109 109 )
110 110 coreconfigitem('devel', 'all-warnings',
111 111 default=False,
112 112 )
113 113 coreconfigitem('devel', 'bundle2.debug',
114 114 default=False,
115 115 )
116 116 coreconfigitem('devel', 'check-locks',
117 117 default=False,
118 118 )
119 119 coreconfigitem('devel', 'check-relroot',
120 120 default=False,
121 121 )
122 122 coreconfigitem('devel', 'default-date',
123 123 default=None,
124 124 )
125 125 coreconfigitem('devel', 'deprec-warn',
126 126 default=False,
127 127 )
128 128 coreconfigitem('devel', 'disableloaddefaultcerts',
129 129 default=False,
130 130 )
131 131 coreconfigitem('devel', 'legacy.exchange',
132 132 default=list,
133 133 )
134 134 coreconfigitem('devel', 'servercafile',
135 135 default='',
136 136 )
137 137 coreconfigitem('devel', 'serverexactprotocol',
138 138 default='',
139 139 )
140 140 coreconfigitem('devel', 'serverrequirecert',
141 141 default=False,
142 142 )
143 143 coreconfigitem('devel', 'strip-obsmarkers',
144 144 default=True,
145 145 )
146 146 coreconfigitem('email', 'charsets',
147 147 default=list,
148 148 )
149 149 coreconfigitem('email', 'method',
150 150 default='smtp',
151 151 )
152 152 coreconfigitem('experimental', 'bundle-phases',
153 153 default=False,
154 154 )
155 155 coreconfigitem('experimental', 'bundle2-advertise',
156 156 default=True,
157 157 )
158 158 coreconfigitem('experimental', 'bundle2-output-capture',
159 159 default=False,
160 160 )
161 161 coreconfigitem('experimental', 'bundle2.pushback',
162 162 default=False,
163 163 )
164 164 coreconfigitem('experimental', 'bundle2lazylocking',
165 165 default=False,
166 166 )
167 167 coreconfigitem('experimental', 'bundlecomplevel',
168 168 default=None,
169 169 )
170 170 coreconfigitem('experimental', 'changegroup3',
171 171 default=False,
172 172 )
173 173 coreconfigitem('experimental', 'clientcompressionengines',
174 174 default=list,
175 175 )
176 176 coreconfigitem('experimental', 'copytrace',
177 177 default='on',
178 178 )
179 179 coreconfigitem('experimental', 'copytrace.sourcecommitlimit',
180 180 default=100,
181 181 )
182 182 coreconfigitem('experimental', 'crecordtest',
183 183 default=None,
184 184 )
185 185 coreconfigitem('experimental', 'editortmpinhg',
186 186 default=False,
187 187 )
188 188 coreconfigitem('experimental', 'stabilization',
189 189 default=list,
190 190 alias=[('experimental', 'evolution')],
191 191 )
192 192 coreconfigitem('experimental', 'stabilization.bundle-obsmarker',
193 193 default=False,
194 194 alias=[('experimental', 'evolution.bundle-obsmarker')],
195 195 )
196 196 coreconfigitem('experimental', 'stabilization.track-operation',
197 197 default=True,
198 198 alias=[('experimental', 'evolution.track-operation')]
199 199 )
200 200 coreconfigitem('experimental', 'exportableenviron',
201 201 default=list,
202 202 )
203 203 coreconfigitem('experimental', 'extendedheader.index',
204 204 default=None,
205 205 )
206 206 coreconfigitem('experimental', 'extendedheader.similarity',
207 207 default=False,
208 208 )
209 209 coreconfigitem('experimental', 'format.compression',
210 210 default='zlib',
211 211 )
212 212 coreconfigitem('experimental', 'graphshorten',
213 213 default=False,
214 214 )
215 215 coreconfigitem('experimental', 'hook-track-tags',
216 216 default=False,
217 217 )
218 218 coreconfigitem('experimental', 'httppostargs',
219 219 default=False,
220 220 )
221 221 coreconfigitem('experimental', 'manifestv2',
222 222 default=False,
223 223 )
224 224 coreconfigitem('experimental', 'mergedriver',
225 225 default=None,
226 226 )
227 227 coreconfigitem('experimental', 'obsmarkers-exchange-debug',
228 228 default=False,
229 229 )
230 230 coreconfigitem('experimental', 'rebase.multidest',
231 231 default=False,
232 232 )
233 233 coreconfigitem('experimental', 'revertalternateinteractivemode',
234 234 default=True,
235 235 )
236 236 coreconfigitem('experimental', 'revlogv2',
237 237 default=None,
238 238 )
239 239 coreconfigitem('experimental', 'spacemovesdown',
240 240 default=False,
241 241 )
242 242 coreconfigitem('experimental', 'treemanifest',
243 243 default=False,
244 244 )
245 245 coreconfigitem('experimental', 'updatecheck',
246 246 default=None,
247 247 )
248 248 coreconfigitem('format', 'aggressivemergedeltas',
249 249 default=False,
250 250 )
251 251 coreconfigitem('format', 'chunkcachesize',
252 252 default=None,
253 253 )
254 254 coreconfigitem('format', 'dotencode',
255 255 default=True,
256 256 )
257 257 coreconfigitem('format', 'generaldelta',
258 258 default=False,
259 259 )
260 260 coreconfigitem('format', 'manifestcachesize',
261 261 default=None,
262 262 )
263 263 coreconfigitem('format', 'maxchainlen',
264 264 default=None,
265 265 )
266 266 coreconfigitem('format', 'obsstore-version',
267 267 default=None,
268 268 )
269 269 coreconfigitem('format', 'usefncache',
270 270 default=True,
271 271 )
272 272 coreconfigitem('format', 'usegeneraldelta',
273 273 default=True,
274 274 )
275 275 coreconfigitem('format', 'usestore',
276 276 default=True,
277 277 )
278 278 coreconfigitem('hostsecurity', 'ciphers',
279 279 default=None,
280 280 )
281 281 coreconfigitem('hostsecurity', 'disabletls10warning',
282 282 default=False,
283 283 )
284 284 coreconfigitem('http_proxy', 'always',
285 285 default=False,
286 286 )
287 287 coreconfigitem('http_proxy', 'host',
288 288 default=None,
289 289 )
290 290 coreconfigitem('http_proxy', 'no',
291 291 default=list,
292 292 )
293 293 coreconfigitem('http_proxy', 'passwd',
294 294 default=None,
295 295 )
296 296 coreconfigitem('http_proxy', 'user',
297 297 default=None,
298 298 )
299 299 coreconfigitem('merge', 'followcopies',
300 300 default=True,
301 301 )
302 302 coreconfigitem('pager', 'ignore',
303 303 default=list,
304 304 )
305 305 coreconfigitem('patch', 'eol',
306 306 default='strict',
307 307 )
308 308 coreconfigitem('patch', 'fuzz',
309 309 default=2,
310 310 )
311 311 coreconfigitem('paths', 'default',
312 312 default=None,
313 313 )
314 314 coreconfigitem('paths', 'default-push',
315 315 default=None,
316 316 )
317 317 coreconfigitem('phases', 'checksubrepos',
318 318 default='follow',
319 319 )
320 320 coreconfigitem('phases', 'new-commit',
321 321 default=dynamicdefault,
322 322 )
323 323 coreconfigitem('phases', 'publish',
324 324 default=True,
325 325 )
326 326 coreconfigitem('profiling', 'enabled',
327 327 default=False,
328 328 )
329 329 coreconfigitem('profiling', 'format',
330 330 default='text',
331 331 )
332 332 coreconfigitem('profiling', 'freq',
333 333 default=1000,
334 334 )
335 335 coreconfigitem('profiling', 'limit',
336 336 default=30,
337 337 )
338 338 coreconfigitem('profiling', 'nested',
339 339 default=0,
340 340 )
341 341 coreconfigitem('profiling', 'output',
342 342 default=None,
343 343 )
344 344 coreconfigitem('profiling', 'showmax',
345 345 default=0.999,
346 346 )
347 347 coreconfigitem('profiling', 'showmin',
348 348 default=dynamicdefault,
349 349 )
350 350 coreconfigitem('profiling', 'sort',
351 351 default='inlinetime',
352 352 )
353 353 coreconfigitem('profiling', 'statformat',
354 354 default='hotpath',
355 355 )
356 356 coreconfigitem('profiling', 'type',
357 357 default='stat',
358 358 )
359 359 coreconfigitem('progress', 'assume-tty',
360 360 default=False,
361 361 )
362 362 coreconfigitem('progress', 'changedelay',
363 363 default=1,
364 364 )
365 365 coreconfigitem('progress', 'clear-complete',
366 366 default=True,
367 367 )
368 368 coreconfigitem('progress', 'debug',
369 369 default=False,
370 370 )
371 371 coreconfigitem('progress', 'delay',
372 372 default=3,
373 373 )
374 374 coreconfigitem('progress', 'disable',
375 375 default=False,
376 376 )
377 377 coreconfigitem('progress', 'estimateinterval',
378 378 default=60.0,
379 379 )
380 380 coreconfigitem('progress', 'refresh',
381 381 default=0.1,
382 382 )
383 383 coreconfigitem('progress', 'width',
384 384 default=dynamicdefault,
385 385 )
386 386 coreconfigitem('push', 'pushvars.server',
387 387 default=False,
388 388 )
389 389 coreconfigitem('server', 'bundle1',
390 390 default=True,
391 391 )
392 392 coreconfigitem('server', 'bundle1gd',
393 393 default=None,
394 394 )
395 395 coreconfigitem('server', 'compressionengines',
396 396 default=list,
397 397 )
398 398 coreconfigitem('server', 'concurrent-push-mode',
399 399 default='strict',
400 400 )
401 401 coreconfigitem('server', 'disablefullbundle',
402 402 default=False,
403 403 )
404 404 coreconfigitem('server', 'maxhttpheaderlen',
405 405 default=1024,
406 406 )
407 407 coreconfigitem('server', 'preferuncompressed',
408 408 default=False,
409 409 )
410 410 coreconfigitem('server', 'uncompressed',
411 411 default=True,
412 412 )
413 413 coreconfigitem('server', 'uncompressedallowsecret',
414 414 default=False,
415 415 )
416 416 coreconfigitem('server', 'validate',
417 417 default=False,
418 418 )
419 419 coreconfigitem('server', 'zliblevel',
420 420 default=-1,
421 421 )
422 422 coreconfigitem('smtp', 'host',
423 423 default=None,
424 424 )
425 425 coreconfigitem('smtp', 'local_hostname',
426 426 default=None,
427 427 )
428 428 coreconfigitem('smtp', 'password',
429 429 default=None,
430 430 )
431 coreconfigitem('smtp', 'port',
432 default=dynamicdefault,
433 )
431 434 coreconfigitem('smtp', 'tls',
432 435 default='none',
433 436 )
434 437 coreconfigitem('smtp', 'username',
435 438 default=None,
436 439 )
437 440 coreconfigitem('sparse', 'missingwarning',
438 441 default=True,
439 442 )
440 443 coreconfigitem('trusted', 'groups',
441 444 default=list,
442 445 )
443 446 coreconfigitem('trusted', 'users',
444 447 default=list,
445 448 )
446 449 coreconfigitem('ui', '_usedassubrepo',
447 450 default=False,
448 451 )
449 452 coreconfigitem('ui', 'allowemptycommit',
450 453 default=False,
451 454 )
452 455 coreconfigitem('ui', 'archivemeta',
453 456 default=True,
454 457 )
455 458 coreconfigitem('ui', 'askusername',
456 459 default=False,
457 460 )
458 461 coreconfigitem('ui', 'clonebundlefallback',
459 462 default=False,
460 463 )
461 464 coreconfigitem('ui', 'clonebundleprefers',
462 465 default=list,
463 466 )
464 467 coreconfigitem('ui', 'clonebundles',
465 468 default=True,
466 469 )
467 470 coreconfigitem('ui', 'color',
468 471 default='auto',
469 472 )
470 473 coreconfigitem('ui', 'commitsubrepos',
471 474 default=False,
472 475 )
473 476 coreconfigitem('ui', 'debug',
474 477 default=False,
475 478 )
476 479 coreconfigitem('ui', 'debugger',
477 480 default=None,
478 481 )
479 482 coreconfigitem('ui', 'fallbackencoding',
480 483 default=None,
481 484 )
482 485 coreconfigitem('ui', 'forcecwd',
483 486 default=None,
484 487 )
485 488 coreconfigitem('ui', 'forcemerge',
486 489 default=None,
487 490 )
488 491 coreconfigitem('ui', 'formatdebug',
489 492 default=False,
490 493 )
491 494 coreconfigitem('ui', 'formatjson',
492 495 default=False,
493 496 )
494 497 coreconfigitem('ui', 'formatted',
495 498 default=None,
496 499 )
497 500 coreconfigitem('ui', 'graphnodetemplate',
498 501 default=None,
499 502 )
500 503 coreconfigitem('ui', 'http2debuglevel',
501 504 default=None,
502 505 )
503 506 coreconfigitem('ui', 'interactive',
504 507 default=None,
505 508 )
506 509 coreconfigitem('ui', 'interface',
507 510 default=None,
508 511 )
509 512 coreconfigitem('ui', 'logblockedtimes',
510 513 default=False,
511 514 )
512 515 coreconfigitem('ui', 'logtemplate',
513 516 default=None,
514 517 )
515 518 coreconfigitem('ui', 'merge',
516 519 default=None,
517 520 )
518 521 coreconfigitem('ui', 'mergemarkers',
519 522 default='basic',
520 523 )
521 524 coreconfigitem('ui', 'mergemarkertemplate',
522 525 default=('{node|short} '
523 526 '{ifeq(tags, "tip", "", '
524 527 'ifeq(tags, "", "", "{tags} "))}'
525 528 '{if(bookmarks, "{bookmarks} ")}'
526 529 '{ifeq(branch, "default", "", "{branch} ")}'
527 530 '- {author|user}: {desc|firstline}')
528 531 )
529 532 coreconfigitem('ui', 'nontty',
530 533 default=False,
531 534 )
532 535 coreconfigitem('ui', 'origbackuppath',
533 536 default=None,
534 537 )
535 538 coreconfigitem('ui', 'paginate',
536 539 default=True,
537 540 )
538 541 coreconfigitem('ui', 'patch',
539 542 default=None,
540 543 )
541 544 coreconfigitem('ui', 'portablefilenames',
542 545 default='warn',
543 546 )
544 547 coreconfigitem('ui', 'promptecho',
545 548 default=False,
546 549 )
547 550 coreconfigitem('ui', 'quiet',
548 551 default=False,
549 552 )
550 553 coreconfigitem('ui', 'quietbookmarkmove',
551 554 default=False,
552 555 )
553 556 coreconfigitem('ui', 'remotecmd',
554 557 default='hg',
555 558 )
556 559 coreconfigitem('ui', 'report_untrusted',
557 560 default=True,
558 561 )
559 562 coreconfigitem('ui', 'rollback',
560 563 default=True,
561 564 )
562 565 coreconfigitem('ui', 'slash',
563 566 default=False,
564 567 )
565 568 coreconfigitem('ui', 'ssh',
566 569 default='ssh',
567 570 )
568 571 coreconfigitem('ui', 'statuscopies',
569 572 default=False,
570 573 )
571 574 coreconfigitem('ui', 'strict',
572 575 default=False,
573 576 )
574 577 coreconfigitem('ui', 'style',
575 578 default='',
576 579 )
577 580 coreconfigitem('ui', 'supportcontact',
578 581 default=None,
579 582 )
580 583 coreconfigitem('ui', 'textwidth',
581 584 default=78,
582 585 )
583 586 coreconfigitem('ui', 'timeout',
584 587 default='600',
585 588 )
586 589 coreconfigitem('ui', 'traceback',
587 590 default=False,
588 591 )
589 592 coreconfigitem('ui', 'tweakdefaults',
590 593 default=False,
591 594 )
592 595 coreconfigitem('ui', 'usehttp2',
593 596 default=False,
594 597 )
595 598 coreconfigitem('ui', 'username',
596 599 alias=[('ui', 'user')]
597 600 )
598 601 coreconfigitem('ui', 'verbose',
599 602 default=False,
600 603 )
601 604 coreconfigitem('verify', 'skipflags',
602 605 default=None,
603 606 )
604 607 coreconfigitem('web', 'accesslog',
605 608 default='-',
606 609 )
607 610 coreconfigitem('web', 'address',
608 611 default='',
609 612 )
610 613 coreconfigitem('web', 'allow_archive',
611 614 default=list,
612 615 )
613 616 coreconfigitem('web', 'allow_read',
614 617 default=list,
615 618 )
616 619 coreconfigitem('web', 'baseurl',
617 620 default=None,
618 621 )
619 622 coreconfigitem('web', 'cacerts',
620 623 default=None,
621 624 )
622 625 coreconfigitem('web', 'certificate',
623 626 default=None,
624 627 )
625 628 coreconfigitem('web', 'collapse',
626 629 default=False,
627 630 )
628 631 coreconfigitem('web', 'csp',
629 632 default=None,
630 633 )
631 634 coreconfigitem('web', 'deny_read',
632 635 default=list,
633 636 )
634 637 coreconfigitem('web', 'descend',
635 638 default=True,
636 639 )
637 640 coreconfigitem('web', 'description',
638 641 default="",
639 642 )
640 643 coreconfigitem('web', 'encoding',
641 644 default=lambda: encoding.encoding,
642 645 )
643 646 coreconfigitem('web', 'errorlog',
644 647 default='-',
645 648 )
646 649 coreconfigitem('web', 'ipv6',
647 650 default=False,
648 651 )
649 652 coreconfigitem('web', 'port',
650 653 default=8000,
651 654 )
652 655 coreconfigitem('web', 'prefix',
653 656 default='',
654 657 )
655 658 coreconfigitem('web', 'refreshinterval',
656 659 default=20,
657 660 )
658 661 coreconfigitem('web', 'stripes',
659 662 default=1,
660 663 )
661 664 coreconfigitem('web', 'style',
662 665 default='paper',
663 666 )
664 667 coreconfigitem('web', 'templates',
665 668 default=None,
666 669 )
667 670 coreconfigitem('worker', 'backgroundclose',
668 671 default=dynamicdefault,
669 672 )
670 673 # Windows defaults to a limit of 512 open files. A buffer of 128
671 674 # should give us enough headway.
672 675 coreconfigitem('worker', 'backgroundclosemaxqueue',
673 676 default=384,
674 677 )
675 678 coreconfigitem('worker', 'backgroundcloseminfilecount',
676 679 default=2048,
677 680 )
678 681 coreconfigitem('worker', 'backgroundclosethreadcount',
679 682 default=4,
680 683 )
681 684 coreconfigitem('worker', 'numcpus',
682 685 default=None,
683 686 )
General Comments 0
You need to be logged in to leave comments. Login now