~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

Merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
581
581
            mainline_parent_id = revision_id
582
582
        return BranchCheckResult(self)
583
583
 
 
584
    def _get_checkout_format(self):
 
585
        """Return the most suitable metadir for a checkout of this branch.
 
586
        Weaves are used if this branch's repostory uses weaves.
 
587
        """
 
588
        if isinstance(self.bzrdir, bzrdir.BzrDirPreSplitOut):
 
589
            from bzrlib import repository
 
590
            format = bzrdir.BzrDirMetaFormat1()
 
591
            format.repository_format = repository.RepositoryFormat7()
 
592
        else:
 
593
            format = self.repository.bzrdir.cloning_metadir()
 
594
        return format
 
595
 
584
596
    def create_checkout(self, to_location, revision_id=None, 
585
597
                        lightweight=False):
586
598
        """Create a checkout of a branch.
591
603
        produce a bound branch (heavyweight checkout)
592
604
        :return: The tree of the created checkout
593
605
        """
 
606
        t = transport.get_transport(to_location)
 
607
        try:
 
608
            t.mkdir('.')
 
609
        except errors.FileExists:
 
610
            pass
594
611
        if lightweight:
595
 
            t = transport.get_transport(to_location)
596
 
            try:
597
 
                t.mkdir('.')
598
 
            except errors.FileExists:
599
 
                pass
600
612
            checkout = bzrdir.BzrDirMetaFormat1().initialize_on_transport(t)
601
613
            BranchReferenceFormat().initialize(checkout, self)
602
614
        else:
 
615
            format = self._get_checkout_format()
603
616
            checkout_branch = bzrdir.BzrDir.create_branch_convenience(
604
 
                to_location, force_new_tree=False)
 
617
                to_location, force_new_tree=False, format=format)
605
618
            checkout = checkout_branch.bzrdir
606
619
            checkout_branch.bind(self)
607
620
            if revision_id is not None: