/breezy/unstable

To get this branch, use:
bzr branch https://code.breezy-vcs.org/breezy/unstable

« back to all changes in this revision

Viewing changes to breezy/xml8.py

  • Committer: Jelmer Vernooij
  • Date: 2017-05-24 01:39:33 UTC
  • mfrom: (3815.3776.6)
  • Revision ID: jelmer@jelmer.uk-20170524013933-ir4y4tqtrsiz2ka2
New upstream snapshot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
from __future__ import absolute_import
18
18
 
19
 
import cStringIO
20
 
 
21
 
from bzrlib import (
 
19
from . import (
22
20
    cache_utf8,
23
21
    lazy_regex,
24
22
    revision as _mod_revision,
25
23
    trace,
26
24
    )
27
 
from bzrlib.xml_serializer import (
 
25
from .sixish import (
 
26
    BytesIO,
 
27
    )
 
28
from .xml_serializer import (
28
29
    Element,
29
30
    SubElement,
30
31
    XMLSerializer,
35
36
    unpack_inventory_entry,
36
37
    unpack_inventory_flat,
37
38
    )
38
 
from bzrlib.revision import Revision
39
 
from bzrlib.errors import BzrError
 
39
from .revision import Revision
 
40
from .errors import BzrError
40
41
 
41
42
 
42
43
_xml_unescape_map = {
78
79
    # This format supports the altered-by hack that reads file ids directly out
79
80
    # of the versionedfile, without doing XML parsing.
80
81
 
81
 
    supported_kinds = set(['file', 'directory', 'symlink'])
 
82
    supported_kinds = {'file', 'directory', 'symlink'}
82
83
    format_num = '8'
83
84
    revision_format_num = None
84
85
 
133
134
        return self.write_inventory(inv, None)
134
135
 
135
136
    def write_inventory_to_string(self, inv, working=False):
136
 
        """Just call write_inventory with a StringIO and return the value.
 
137
        """Just call write_inventory with a BytesIO and return the value.
137
138
 
138
139
        :param working: If True skip history data - text_sha1, text_size,
139
140
            reference_revision, symlink_target.
140
141
        """
141
 
        sio = cStringIO.StringIO()
 
142
        sio = BytesIO()
142
143
        self.write_inventory(inv, sio, working)
143
144
        return sio.getvalue()
144
145