~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

Merge from mbp.

Show diffs side-by-side

added added

removed removed

Lines of Context:
585
585
            return ws
586
586
 
587
587
        if self._branch_format == 4:
588
 
            self.inventory_store = get_store('inventory-store')
589
 
            self.text_store = get_store('text-store')
590
 
            self.revision_store = get_store('revision-store')
 
588
            self.inventory_store = get_store(u'inventory-store')
 
589
            self.text_store = get_store(u'text-store')
 
590
            self.revision_store = get_store(u'revision-store')
591
591
        elif self._branch_format == 5:
592
 
            self.control_weaves = get_weave('')
593
 
            self.weave_store = get_weave('weaves')
594
 
            self.revision_store = get_store('revision-store', compressed=False)
 
592
            self.control_weaves = get_weave(u'')
 
593
            self.weave_store = get_weave(u'weaves')
 
594
            self.revision_store = get_store(u'revision-store', compressed=False)
595
595
        elif self._branch_format == 6:
596
 
            self.control_weaves = get_weave('')
597
 
            self.weave_store = get_weave('weaves', prefixed=True)
598
 
            self.revision_store = get_store('revision-store', compressed=False,
 
596
            self.control_weaves = get_weave(u'')
 
597
            self.weave_store = get_weave(u'weaves', prefixed=True)
 
598
            self.revision_store = get_store(u'revision-store', compressed=False,
599
599
                                            prefixed=True)
600
600
        self.revision_store.register_suffix('sig')
601
601
        self._transaction = None
705
705
 
706
706
    def _rel_controlfilename(self, file_or_path):
707
707
        if not isinstance(file_or_path, basestring):
708
 
            file_or_path = '/'.join(file_or_path)
 
708
            file_or_path = u'/'.join(file_or_path)
709
709
        if file_or_path == '':
710
710
            return bzrlib.BZRDIR
711
 
        return bzrlib.transport.urlescape(bzrlib.BZRDIR + '/' + file_or_path)
 
711
        return bzrlib.transport.urlescape(bzrlib.BZRDIR + u'/' + file_or_path)
712
712
 
713
713
    def controlfilename(self, file_or_path):
714
714
        """See Branch.controlfilename."""
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