~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/xml5.py

  • Committer: Andrew Bennetts
  • Date: 2010-10-08 08:15:14 UTC
  • mto: This revision was merged to the branch mainline in revision 5498.
  • Revision ID: andrew.bennetts@canonical.com-20101008081514-dviqzrdfwyzsqbz2
Split NEWS into per-release doc/en/release-notes/bzr-*.txt

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
 
from __future__ import absolute_import
18
 
 
19
17
from bzrlib import (
20
18
    cache_utf8,
21
19
    errors,
22
20
    inventory,
23
21
    xml6,
24
 
    )
25
 
from bzrlib.xml_serializer import (
26
 
    encode_and_escape,
27
 
    get_utf8_or_ascii,
28
 
    unpack_inventory_entry,
29
 
    )
30
 
 
 
22
    xml8,
 
23
    )
31
24
 
32
25
class Serializer_v5(xml6.Serializer_v6):
33
26
    """Version 5 serializer
42
35
        """Construct from XML Element
43
36
        """
44
37
        root_id = elt.get('file_id') or inventory.ROOT_ID
45
 
        root_id = get_utf8_or_ascii(root_id)
 
38
        root_id = xml8._get_utf8_or_ascii(root_id)
46
39
 
47
40
        format = elt.get('format')
48
41
        if format is not None:
59
52
        #   avoiding attributes     2.46s
60
53
        #   adding assertions       2.50s
61
54
        #   last_parent cache       2.52s (worse, removed)
 
55
        unpack_entry = self._unpack_entry
62
56
        byid = inv._byid
63
57
        for e in elt:
64
 
            ie = unpack_inventory_entry(e, entry_cache=entry_cache,
 
58
            ie = unpack_entry(e, entry_cache=entry_cache,
65
59
                              return_from_cache=return_from_cache)
66
60
            parent_id = ie.parent_id
67
61
            if parent_id is None:
98
92
        """Append the inventory root to output."""
99
93
        if inv.root.file_id not in (None, inventory.ROOT_ID):
100
94
            fileid1 = ' file_id="'
101
 
            fileid2 = encode_and_escape(inv.root.file_id)
 
95
            fileid2 = xml8._encode_and_escape(inv.root.file_id)
102
96
        else:
103
97
            fileid1 = ""
104
98
            fileid2 = ""
105
99
        if inv.revision_id is not None:
106
100
            revid1 = ' revision_id="'
107
 
            revid2 = encode_and_escape(inv.revision_id)
 
101
            revid2 = xml8._encode_and_escape(inv.revision_id)
108
102
        else:
109
103
            revid1 = ""
110
104
            revid2 = ""