~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Vincent Ladeuil
  • Date: 2017-01-30 14:30:10 UTC
  • mfrom: (6615.3.7 merges)
  • mto: This revision was merged to the branch mainline in revision 6621.
  • Revision ID: v.ladeuil+lp@free.fr-20170130143010-p31t1ranfeqbaeki
Merge  2.7 into trunk including fix for bug #1657238

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,
22
23
    escape_invalid_chars,
23
24
    )
24
 
from bzrlib.inventory import ROOT_ID, Inventory, InventoryEntry
 
25
from bzrlib.inventory import ROOT_ID, Inventory
25
26
import bzrlib.inventory as inventory
26
27
from bzrlib.revision import Revision
27
28
from bzrlib.errors import BzrError
63
64
        return e
64
65
 
65
66
 
66
 
    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):
67
69
        """Construct from XML Element
68
70
 
69
71
        :param revision_id: Ignored parameter used by xml5.
71
73
        root_id = elt.get('file_id') or ROOT_ID
72
74
        inv = Inventory(root_id)
73
75
        for e in elt:
74
 
            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)
75
78
            if ie.parent_id == ROOT_ID:
76
79
                ie.parent_id = root_id
77
80
            inv.add(ie)
78
81
        return inv
79
82
 
80
83
 
81
 
    def _unpack_entry(self, elt, entry_cache=None):
 
84
    def _unpack_entry(self, elt, entry_cache=None, return_from_cache=False):
82
85
        ## original format inventories don't have a parent_id for
83
86
        ## nodes in the root directory, but it's cleaner to use one
84
87
        ## internally.