~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

  • Committer: Martin Pool
  • Date: 2005-09-22 07:04:14 UTC
  • Revision ID: mbp@sourcefrog.net-20050922070414-06a503a1d47b5ce4
- avoid converting inventories to/from StringIO 

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
import sys
19
19
import os
20
20
import errno
21
 
from cStringIO import StringIO
 
21
from warnings import warn
 
22
 
22
23
 
23
24
import bzrlib
24
25
from bzrlib.trace import mutter, note
229
230
 
230
231
    def __del__(self):
231
232
        if self._lock_mode or self._lock:
232
 
            from warnings import warn
233
233
            warn("branch %r was not explicitly unlocked" % self)
234
234
            self._lock.unlock()
235
235
 
687
687
 
688
688
    def get_inventory(self, revision_id):
689
689
        """Get Inventory object by hash."""
690
 
        # FIXME: The text gets passed around a lot coming from the weave.
691
 
        f = StringIO(self.get_inventory_xml(revision_id))
692
 
        return bzrlib.xml5.serializer_v5.read_inventory(f)
 
690
        xml = self.get_inventory_xml(revision_id)
 
691
        return bzrlib.xml5.serializer_v5.read_inventory_from_string(xml)
693
692
 
694
693
 
695
694
    def get_inventory_xml(self, revision_id):
710
709
 
711
710
    def get_revision_inventory(self, revision_id):
712
711
        """Return inventory of a past revision."""
 
712
        # TODO: Unify this with get_inventory()
713
713
        # bzr 0.0.6 and later imposes the constraint that the inventory_id
714
714
        # must be the same as its revision, so this is trivial.
715
715
        if revision_id == None: