2307
2307
def get_default(self):
2308
2308
return self.default
2310
def get_help_text(self, additional_see_also=None, plain=True):
2312
from bzrlib import help_topics
2313
result += help_topics._format_see_also(additional_see_also)
2315
result = help_topics.help_as_plain_text(result)
2310
2319
# Predefined converters to get proper values from store
2312
2321
def bool_from_store(unicode_str):
2317
2326
return int(unicode_str)
2329
def list_from_store(unicode_str):
2330
# ConfigObj return '' instead of u''. Use 'str' below to catch all cases.
2331
if isinstance(unicode_str, (str, unicode)):
2333
# A single value, most probably the user forgot (or didn't care to
2334
# add) the final ','
2337
# The empty string, convert to empty list
2340
# We rely on ConfigObj providing us with a list already
2320
2345
class OptionRegistry(registry.Registry):
2321
2346
"""Register config options by their name.
2335
2360
def register_lazy(self, key, module_name, member_name):
2336
2361
"""Register a new option to be loaded on request.
2338
:param key: This is the key to use to request the option later. Since
2339
the registration is lazy, it should be provided and match the
2342
:param module_name: The python path to the module. Such as 'os.path'.
2344
:param member_name: The member of the module to return. If empty or
2363
:param key: the key to request the option later. Since the registration
2364
is lazy, it should be provided and match the option name.
2366
:param module_name: the python path to the module. Such as 'os.path'.
2368
:param member_name: the member of the module to return. If empty or
2345
2369
None, get() will return the module itself.
2347
2371
super(OptionRegistry, self).register_lazy(key,
2362
2386
# Registered options in lexicographical order
2364
2388
option_registry.register(
2365
Option('dirstate.fdatasync', default=True, from_unicode=bool_from_store,
2389
Option('bzr.workingtree.worth_saving_limit', default=10,
2390
from_unicode=int_from_store, invalid='warning',
2392
How many changes before saving the dirstate.
2394
-1 means that we will never rewrite the dirstate file for only
2395
stat-cache changes. Regardless of this setting, we will always rewrite
2396
the dirstate file if a file is added/removed/renamed/etc. This flag only
2397
affects the behavior of updating the dirstate file after we notice that
2398
a file has been touched.
2400
option_registry.register(
2401
Option('dirstate.fdatasync', default=True,
2402
from_unicode=bool_from_store,
2367
2404
Flush dirstate changes onto physical disk?
2369
2406
If true (default), working tree metadata changes are flushed through the
2371
2408
should not be lost if the machine crashes. See also repository.fdatasync.
2373
2410
option_registry.register(
2411
Option('debug_flags', default=[], from_unicode=list_from_store,
2412
help='Debug flags to activate.'))
2413
option_registry.register(
2374
2414
Option('default_format', default='2a',
2375
2415
help='Format used when creating branches.'))
2376
2416
option_registry.register(
2377
2417
Option('editor',
2378
2418
help='The command called to launch an editor to enter a message.'))
2379
2419
option_registry.register(
2420
Option('ignore_missing_extensions', default=False,
2421
from_unicode=bool_from_store,
2423
Control the missing extensions warning display.
2425
The warning will not be emitted if set to True.
2427
option_registry.register(
2380
2428
Option('language',
2381
2429
help='Language to translate messages into.'))
2382
2430
option_registry.register(
2431
Option('locks.steal_dead', default=False, from_unicode=bool_from_store,
2433
Steal locks that appears to be dead.
2435
If set to True, bzr will check if a lock is supposed to be held by an
2436
active process from the same user on the same machine. If the user and
2437
machine match, but no process with the given PID is active, then bzr
2438
will automatically break the stale lock, and create a new lock for
2440
Otherwise, bzr will prompt as normal to break the lock.
2442
option_registry.register(
2383
2443
Option('output_encoding',
2384
2444
help= 'Unicode encoding for output'
2385
2445
' (terminal encoding if not specified).'))