~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree.py

  • Committer: Aaron Bentley
  • Date: 2006-08-24 03:35:48 UTC
  • mto: (1910.2.43 format-bumps)
  • mto: This revision was merged to the branch mainline in revision 1997.
  • Revision ID: aaron.bentley@utoronto.ca-20060824033548-104450f485b42c75
Fix bugs in basis inventory handling, change filename

Show diffs side-by-side

added added

removed removed

Lines of Context:
399
399
        if revision_id is not None:
400
400
            try:
401
401
                xml = self.read_basis_inventory()
402
 
                inv = bzrlib.xml5.serializer_v5.read_inventory_from_string(xml)
403
 
                inv.root.revision = revision_id
404
 
            except NoSuchFile:
405
 
                inv = None
406
 
            if inv is not None and inv.revision_id == revision_id:
407
 
                return bzrlib.tree.RevisionTree(self.branch.repository, inv,
408
 
                                                revision_id)
 
402
                inv = bzrlib.xml6.serializer_v6.read_inventory_from_string(xml)
 
403
                if inv is not None and inv.revision_id == revision_id:
 
404
                    return bzrlib.tree.RevisionTree(self.branch.repository, 
 
405
                                                    inv, revision_id)
 
406
            except (NoSuchFile, errors.BadInventoryFormat):
 
407
                pass
409
408
        # FIXME? RBC 20060403 should we cache the inventory here ?
410
409
        return self.branch.repository.revision_tree(revision_id)
411
410
 
1209
1208
        return self._control_files.get_physical_lock_status()
1210
1209
 
1211
1210
    def _basis_inventory_name(self):
1212
 
        return 'basis-inventory'
 
1211
        return 'basis-inventory-cache'
1213
1212
 
1214
1213
    @needs_write_lock
1215
1214
    def set_last_revision(self, new_revision):
1252
1251
            xml = self.branch.repository.get_inventory_xml(new_revision)
1253
1252
            firstline = xml.split('\n', 1)[0]
1254
1253
            if (not 'revision_id="' in firstline or 
1255
 
                'format="5"' not in firstline):
 
1254
                'format="6"' not in firstline):
1256
1255
                inv = self.branch.repository.deserialise_inventory(
1257
1256
                    new_revision, xml)
1258
1257
                inv.revision_id = new_revision
1259
 
                xml = bzrlib.xml5.serializer_v5.write_inventory_to_string(inv)
 
1258
                xml = bzrlib.xml6.serializer_v6.write_inventory_to_string(inv)
1260
1259
            assert isinstance(xml, str), 'serialised xml must be bytestring.'
1261
1260
            path = self._basis_inventory_name()
1262
1261
            sio = StringIO(xml)