~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/debug.py

  • Committer: Launchpad Translations on behalf of bzr-core
  • Date: 2012-07-11 04:34:44 UTC
  • mto: (6581.1.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 6582.
  • Revision ID: launchpad_translations_on_behalf_of_bzr-core-20120711043444-s6bhpt1r22h4fpi1
Launchpad automatic translations update.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
 
 
18
17
"""Set of flags that enable different debug behaviour.
19
18
 
20
19
These are set with eg ``-Dlock`` on the bzr command line or in
24
23
for a list of the available options.
25
24
"""
26
25
 
 
26
from __future__ import absolute_import
27
27
 
28
28
debug_flags = set()
29
29
 
36
36
    c = config.GlobalStack()
37
37
    for f in c.get('debug_flags'):
38
38
        debug_flags.add(f)
 
39
 
 
40
 
 
41
def set_trace():
 
42
    """Pdb using original stdin and stdout.
 
43
 
 
44
    When debugging blackbox tests, sys.stdin and sys.stdout are captured for
 
45
    test purposes and cannot be used for interactive debugging. This class uses
 
46
    the origianl stdin/stdout to allow such use.
 
47
 
 
48
    Instead of doing:
 
49
 
 
50
       import pdb; pdb.set_trace()
 
51
 
 
52
    you can do:
 
53
 
 
54
       from bzrlib import debug; debug.set_trace()
 
55
    """
 
56
    import pdb
 
57
    import sys
 
58
    pdb.Pdb(stdin=sys.__stdin__, stdout=sys.__stdout__
 
59
            ).set_trace(sys._getframe().f_back)