/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/transport/log.py

  • Committer: Martin
  • Date: 2017-05-21 18:16:32 UTC
  • mto: (6621.2.22 py3)
  • mto: This revision was merged to the branch mainline in revision 6624.
  • Revision ID: gzlist@googlemail.com-20170521181632-kll0wqnsq8pipfpj
Use BytesIO or StringIO from bzrlib.sixish

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
# see also the transportstats plugin, which gives you some summary information
22
22
# in a machine-readable dump
23
23
 
24
 
import StringIO
25
 
import cStringIO
26
24
import time
27
25
import types
28
26
 
109
107
            return_result = iter(result)
110
108
        else:
111
109
            return_result = result
112
 
        if isinstance(result, (cStringIO.OutputType, StringIO.StringIO)):
113
 
            val = repr(result.getvalue())
 
110
        # Is this an io object with a getvalue() method?
 
111
        getvalue = getattr(result, 'getvalue', None)
 
112
        if getvalue is not None:
 
113
            val = repr(getvalue())
114
114
            result_len = len(val)
115
115
            shown_result = "%s(%s) (%d bytes)" % (result.__class__.__name__,
116
116
                self._shorten(val), result_len)