/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/workingtree.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-09-10 18:57:20 UTC
  • mfrom: (1910.2.48 format-bumps)
  • Revision ID: pqm@pqm.ubuntu.com-20060910185720-1bcc17b99fe77687
Add new format to support nested trees

Show diffs side-by-side

added added

removed removed

Lines of Context:
410
410
        else:
411
411
            try:
412
412
                xml = self.read_basis_inventory()
413
 
                inv = bzrlib.xml5.serializer_v5.read_inventory_from_string(xml)
414
 
                inv.root.revision = revision_id
415
 
            except NoSuchFile:
416
 
                inv = None
417
 
            if inv is not None and inv.revision_id == revision_id:
418
 
                return bzrlib.tree.RevisionTree(self.branch.repository, inv,
419
 
                                                revision_id)
 
413
                inv = bzrlib.xml6.serializer_v6.read_inventory_from_string(xml)
 
414
                if inv is not None and inv.revision_id == revision_id:
 
415
                    return bzrlib.tree.RevisionTree(self.branch.repository, 
 
416
                                                    inv, revision_id)
 
417
            except (NoSuchFile, errors.BadInventoryFormat):
 
418
                pass
420
419
        # No cached copy available, retrieve from the repository.
421
420
        # FIXME? RBC 20060403 should we cache the inventory locally
422
421
        # at this point ?
1400
1399
        return self._control_files.get_physical_lock_status()
1401
1400
 
1402
1401
    def _basis_inventory_name(self):
1403
 
        return 'basis-inventory'
 
1402
        return 'basis-inventory-cache'
1404
1403
 
1405
1404
    @needs_write_lock
1406
1405
    def set_last_revision(self, new_revision):
1441
1440
            # root node id can legitimately look like 'revision_id' but cannot
1442
1441
            # contain a '"'.
1443
1442
            xml = self.branch.repository.get_inventory_xml(new_revision)
1444
 
            if not 'revision_id="' in xml.split('\n', 1)[0]:
 
1443
            firstline = xml.split('\n', 1)[0]
 
1444
            if (not 'revision_id="' in firstline or 
 
1445
                'format="6"' not in firstline):
1445
1446
                inv = self.branch.repository.deserialise_inventory(
1446
1447
                    new_revision, xml)
1447
1448
                inv.revision_id = new_revision
1448
 
                xml = bzrlib.xml5.serializer_v5.write_inventory_to_string(inv)
 
1449
                xml = bzrlib.xml6.serializer_v6.write_inventory_to_string(inv)
1449
1450
            assert isinstance(xml, str), 'serialised xml must be bytestring.'
1450
1451
            path = self._basis_inventory_name()
1451
1452
            sio = StringIO(xml)