~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/debug.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-03-06 06:48:25 UTC
  • mfrom: (4070.8.6 debug-config)
  • Revision ID: pqm@pqm.ubuntu.com-20090306064825-kbpwggw21dygeix6
(mbp) debug_flags configuration option

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
"""Set of flags that enable different debug behaviour.
19
19
 
20
 
These are set with eg ``-Dlock`` on the bzr command line.
 
20
These are set with eg ``-Dlock`` on the bzr command line or in
 
21
~/.bazaar/bazaar.conf debug_flags.
21
22
 
22
23
See "bzr help global-options" or bzrlib/help_topics/__init__.py
23
24
for a list of the available options.
24
25
"""
25
26
 
 
27
 
26
28
debug_flags = set()
 
29
 
 
30
 
 
31
def set_debug_flags_from_config():
 
32
    """Turn on debug flags based on the global configuration"""
 
33
 
 
34
    from bzrlib.config import GlobalConfig
 
35
 
 
36
    c = GlobalConfig()
 
37
    value = c.get_user_option("debug_flags")
 
38
    if value is not None:
 
39
        # configobject gives us either a string if there's just one or a list
 
40
        # if there's multiple
 
41
        if isinstance(value, basestring):
 
42
            value = [value]
 
43
        for w in value:
 
44
            w = w.strip()
 
45
            debug_flags.add(w)