~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

(broken) merge aaron's workingtree format changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
644
644
            format = bzrdir.BzrDirMetaFormat1()
645
645
            format.repository_format = weaverepo.RepositoryFormat7()
646
646
        else:
647
 
            format = self.repository.bzrdir.cloning_metadir()
 
647
            format = self.repository.bzrdir.checkout_metadir()
648
648
            format.branch_format = self._format
649
649
        return format
650
650
 
664
664
        except errors.FileExists:
665
665
            pass
666
666
        if lightweight:
667
 
            checkout = bzrdir.BzrDirMetaFormat1().initialize_on_transport(t)
 
667
            format = self._get_checkout_format()
 
668
            checkout = format.initialize_on_transport(t)
668
669
            BranchReferenceFormat().initialize(checkout, self)
669
670
        else:
670
671
            format = self._get_checkout_format()
675
676
            # pull up to the specified revision_id to set the initial 
676
677
            # branch tip correctly, and seed it with history.
677
678
            checkout_branch.pull(self, stop_revision=revision_id)
678
 
        return checkout.create_workingtree(revision_id)
 
679
        tree = checkout.create_workingtree(revision_id)
 
680
        for path, entry in tree.iter_reference_entries():
 
681
            path = tree.id2path(entry.file_id)
 
682
            reference_parent = self.reference_parent(entry.file_id, path)
 
683
            reference_parent.create_checkout(tree.abspath(path),
 
684
                                             entry.reference_revision,
 
685
                                             lightweight)
 
686
        return tree
 
687
 
 
688
    def reference_parent(self, file_id, path):
 
689
        """Return the parent branch for a tree-reference file_id
 
690
        :param file_id: The file_id of the tree reference
 
691
        :param path: The path of the file_id in the tree
 
692
        :return: A branch associated with the file_id
 
693
        """
 
694
        # FIXME should provide multiple branches, based on config
 
695
        return Branch.open(self.bzrdir.root_transport.clone(path).base)
679
696
 
680
697
 
681
698
class BranchFormat(object):