/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/debug.py

  • Committer: Jelmer Vernooij
  • Date: 2011-08-22 15:22:57 UTC
  • mfrom: (6092 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6191.
  • Revision ID: jelmer@samba.org-20110822152257-6z7jx73i59npiauo
merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
for a list of the available options.
25
25
"""
26
26
 
27
 
 
28
27
debug_flags = set()
29
28
 
30
29
 
36
35
    c = config.GlobalStack()
37
36
    for f in c.get('debug_flags'):
38
37
        debug_flags.add(f)
 
38
 
 
39
 
 
40
def set_trace():
 
41
    """Pdb using original stdin and stdout.
 
42
 
 
43
    When debugging blackbox tests, sys.stdin and sys.stdout are captured for
 
44
    test purposes and cannot be used for interactive debugging. This class uses
 
45
    the origianl stdin/stdout to allow such use.
 
46
 
 
47
    Instead of doing:
 
48
 
 
49
       import pdb; pdb.set_trace()
 
50
 
 
51
    you can do:
 
52
 
 
53
       from bzrlib import debug; debug.set_trace()
 
54
    """
 
55
    import pdb
 
56
    import sys
 
57
    pdb.Pdb(stdin=sys.__stdin__, stdout=sys.__stdout__
 
58
            ).set_trace(sys._getframe().f_back)