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