~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/xml4.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-12-19 17:14:59 UTC
  • mfrom: (3882.6.23 xml_cache)
  • Revision ID: pqm@pqm.ubuntu.com-20081219171459-521qbou7ho7g297f
(jam) Add a cache for deserializing inventory entries from XML.

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
        return e
58
58
 
59
59
 
60
 
    def _unpack_inventory(self, elt, revision_id=None):
 
60
    def _unpack_inventory(self, elt, revision_id=None, entry_cache=None):
61
61
        """Construct from XML Element
62
62
 
63
63
        :param revision_id: Ignored parameter used by xml5.
65
65
        root_id = elt.get('file_id') or ROOT_ID
66
66
        inv = Inventory(root_id)
67
67
        for e in elt:
68
 
            ie = self._unpack_entry(e)
 
68
            ie = self._unpack_entry(e, entry_cache=entry_cache)
69
69
            if ie.parent_id == ROOT_ID:
70
70
                ie.parent_id = root_id
71
71
            inv.add(ie)
72
72
        return inv
73
73
 
74
74
 
75
 
    def _unpack_entry(self, elt):
 
75
    def _unpack_entry(self, elt, entry_cache=None):
76
76
        ## original format inventories don't have a parent_id for
77
77
        ## nodes in the root directory, but it's cleaner to use one
78
78
        ## internally.