~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/xml5.py

  • Committer: John Arbash Meinel
  • Date: 2008-12-12 20:06:28 UTC
  • mto: This revision was merged to the branch mainline in revision 3912.
  • Revision ID: john@arbash-meinel.com-20081212200628-xmm9i33jq3d6tsh3
Start moving things around so that the entry cache is passed in.

This has a negligible effect on performance, and means that we can have the
cache lifetime associated with a repository, rather than 'always on'.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
    format_num = '5'
31
31
    root_id = inventory.ROOT_ID
32
32
 
33
 
    def _unpack_inventory(self, elt, revision_id):
 
33
    def _unpack_inventory(self, elt, revision_id, entry_cache=None):
34
34
        """Construct from XML Element
35
35
        """
36
36
        root_id = elt.get('file_id') or inventory.ROOT_ID
51
51
        #   avoiding attributes     2.46s
52
52
        #   adding assertions       2.50s
53
53
        #   last_parent cache       2.52s (worse, removed)
 
54
        if entry_cache is None:
 
55
            entry_cache = xml8._entry_cache
54
56
        unpack_entry = self._unpack_entry
55
57
        byid = inv._byid
56
58
        for e in elt:
57
 
            ie = unpack_entry(e)
 
59
            ie = unpack_entry(e, entry_cache=entry_cache)
58
60
            parent_id = ie.parent_id
59
61
            if parent_id is None:
60
62
                ie.parent_id = parent_id = root_id
74
76
            byid[ie.file_id] = ie
75
77
        if revision_id is not None:
76
78
            inv.root.revision = revision_id
77
 
        self._check_cache_size(len(inv))
 
79
        self._check_cache_size(len(inv), entry_cache)
78
80
        return inv
79
81
 
80
82
    def _check_revisions(self, inv):