~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/plugins/weave_fmt/xml4.py

  • Committer: Patch Queue Manager
  • Date: 2014-02-12 18:22:22 UTC
  • mfrom: (6589.2.1 trunk)
  • Revision ID: pqm@pqm.ubuntu.com-20140212182222-beouo25gaf1cny76
(vila) The XDG Base Directory Specification uses the XDG_CACHE_HOME,
 not XDG_CACHE_DIR. (Andrew Starr-Bochicchio)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006 Canonical Ltd
 
1
# Copyright (C) 2005-2010 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
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.xml_serializer import (
18
20
    Element,
19
 
    ElementTree,
20
21
    SubElement,
21
22
    XMLSerializer,
 
23
    escape_invalid_chars,
22
24
    )
23
 
from bzrlib.inventory import ROOT_ID, Inventory, InventoryEntry
 
25
from bzrlib.inventory import ROOT_ID, Inventory
24
26
import bzrlib.inventory as inventory
25
27
from bzrlib.revision import Revision
26
28
from bzrlib.errors import BzrError
62
64
        return e
63
65
 
64
66
 
65
 
    def _unpack_inventory(self, elt, revision_id=None, entry_cache=None):
 
67
    def _unpack_inventory(self, elt, revision_id=None, entry_cache=None,
 
68
                          return_from_cache=False):
66
69
        """Construct from XML Element
67
70
 
68
71
        :param revision_id: Ignored parameter used by xml5.
70
73
        root_id = elt.get('file_id') or ROOT_ID
71
74
        inv = Inventory(root_id)
72
75
        for e in elt:
73
 
            ie = self._unpack_entry(e, entry_cache=entry_cache)
 
76
            ie = self._unpack_entry(e, entry_cache=entry_cache,
 
77
                                    return_from_cache=return_from_cache)
74
78
            if ie.parent_id == ROOT_ID:
75
79
                ie.parent_id = root_id
76
80
            inv.add(ie)
77
81
        return inv
78
82
 
79
83
 
80
 
    def _unpack_entry(self, elt, entry_cache=None):
 
84
    def _unpack_entry(self, elt, entry_cache=None, return_from_cache=False):
81
85
        ## original format inventories don't have a parent_id for
82
86
        ## nodes in the root directory, but it's cleaner to use one
83
87
        ## internally.
125
129
        root.text = '\n'
126
130
 
127
131
        msg = SubElement(root, 'message')
128
 
        msg.text = rev.message
 
132
        msg.text = escape_invalid_chars(rev.message)[0]
129
133
        msg.tail = '\n'
130
134
 
131
135
        if rev.parents: