~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/xml4.py

  • Committer: John Arbash Meinel
  • Date: 2009-12-03 04:55:02 UTC
  • mto: This revision was merged to the branch mainline in revision 4887.
  • Revision ID: john@arbash-meinel.com-20091203045502-uvhmg6b1yjbzzt8q
Change from being a per-serializer attribute to being a per-repo attribute.
This means we have some churn on *all* of the serializer apis, but it means
we *don't* have churn on all of the repository apis.

It makes it more thread-safe, since serializers are global instances.
Repositories aren't currently thread-safe anyway. (get_record_stream() specifically
is known not to be thread-safe on 2a format repos.)

Show diffs side-by-side

added added

removed removed

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