~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

[patch] keep a cached basis inventory (Johan Rydberg)

Show diffs side-by-side

added added

removed removed

Lines of Context:
845
845
    @needs_write_lock
846
846
    def set_revision_history(self, rev_history):
847
847
        """See Branch.set_revision_history."""
 
848
        old_revision = self.last_revision()
 
849
        new_revision = rev_history[-1]
848
850
        self.put_controlfile('revision-history', '\n'.join(rev_history))
 
851
        self.working_tree().set_last_revision(new_revision, old_revision)
849
852
 
850
853
    def has_revision(self, revision_id):
851
854
        """See Branch.has_revision."""
992
995
            inv = self.get_revision_inventory(revision_id)
993
996
            return RevisionTree(self.weave_store, inv, revision_id)
994
997
 
 
998
    def basis_tree(self):
 
999
        """See Branch.basis_tree."""
 
1000
        try:
 
1001
            revision_id = self.revision_history()[-1]
 
1002
            xml = self.working_tree().read_basis_inventory(revision_id)
 
1003
            inv = bzrlib.xml5.serializer_v5.read_inventory_from_string(xml)
 
1004
            return RevisionTree(self.weave_store, inv, revision_id)
 
1005
        except (IndexError, NoSuchFile), e:
 
1006
            return self.revision_tree(self.last_revision())
 
1007
 
995
1008
    def working_tree(self):
996
1009
        """See Branch.working_tree."""
997
1010
        from bzrlib.workingtree import WorkingTree