~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/xml5.py

  • Committer: Patch Queue Manager
  • Date: 2016-01-31 13:36:59 UTC
  • mfrom: (6613.1.5 1538480-match-hostname)
  • Revision ID: pqm@pqm.ubuntu.com-20160131133659-ouy92ee2wlv9xz8m
(vila) Use ssl.match_hostname instead of our own. (Vincent Ladeuil)

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