~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/xml4.py

  • Committer: Andrew Bennetts
  • Date: 2009-12-03 02:24:54 UTC
  • mfrom: (4634.101.4 2.0)
  • mto: This revision was merged to the branch mainline in revision 4857.
  • Revision ID: andrew.bennetts@canonical.com-20091203022454-m2gyhbcdqi1t7ujz
Merge lp:bzr/2.0 into lp:bzr.

Show diffs side-by-side

added added

removed removed

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