/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/workingtree.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:
31
31
 
32
32
from __future__ import absolute_import
33
33
 
34
 
from cStringIO import StringIO
 
34
import errno
35
35
import os
 
36
import re
36
37
import sys
37
38
 
38
39
from bzrlib.lazy_import import lazy_import
39
40
lazy_import(globals(), """
40
41
from bisect import bisect_left
41
42
import collections
42
 
import errno
43
43
import itertools
44
44
import operator
45
45
import stat
46
 
import re
47
46
 
48
47
from bzrlib import (
49
48
    branch,
74
73
# is guaranteed to be registered.
75
74
from bzrlib import (
76
75
    bzrdir,
 
76
    osutils,
77
77
    symbol_versioning,
78
78
    )
79
 
 
80
79
from bzrlib.decorators import needs_read_lock, needs_write_lock
81
80
from bzrlib.i18n import gettext
82
81
from bzrlib.lock import LogicalLockResult
83
82
import bzrlib.mutabletree
84
83
from bzrlib.mutabletree import needs_tree_write_lock
85
 
from bzrlib import osutils
86
84
from bzrlib.osutils import (
87
85
    file_kind,
88
86
    isdir,
92
90
    safe_unicode,
93
91
    splitpath,
94
92
    )
 
93
from bzrlib.revision import CURRENT_REVISION
 
94
from bzrlib.sixish import (
 
95
    BytesIO,
 
96
    )
95
97
from bzrlib.trace import mutter, note
96
 
from bzrlib.revision import CURRENT_REVISION
97
98
from bzrlib.symbol_versioning import (
98
99
    deprecated_passed,
99
100
    DEPRECATED_PARAMETER,
1944
1945
    def _write_basis_inventory(self, xml):
1945
1946
        """Write the basis inventory XML to the basis-inventory file"""
1946
1947
        path = self._basis_inventory_name()
1947
 
        sio = StringIO(xml)
 
1948
        sio = BytesIO(xml)
1948
1949
        self._transport.put_file(path, sio,
1949
1950
            mode=self.bzrdir._get_file_mode())
1950
1951
 
2202
2203
        # TODO: Maybe this should only write on dirty ?
2203
2204
        if self._control_files._lock_mode != 'w':
2204
2205
            raise errors.NotWriteLocked(self)
2205
 
        sio = StringIO()
 
2206
        sio = BytesIO()
2206
2207
        self._serialize(self._inventory, sio)
2207
2208
        sio.seek(0)
2208
2209
        self._transport.put_file('inventory', sio,