~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bzrdir.py

  • Committer: Andrew Bennetts
  • Date: 2008-07-31 08:35:25 UTC
  • mto: This revision was merged to the branch mainline in revision 3598.
  • Revision ID: andrew.bennetts@canonical.com-20080731083525-3moul1ak25t2eaoj
Use source_branch.sprout in BzrDir.sprout when possible.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1086
1086
            result_repo.fetch(source_repository, revision_id=revision_id)
1087
1087
 
1088
1088
        # Create/update the result branch
 
1089
        format_forced = False
1089
1090
        if ((stacked 
1090
1091
             or repository_policy._require_stacking 
1091
1092
             or repository_policy._stack_on)
1092
1093
            and not result._format.get_branch_format().supports_stacking()):
1093
 
            # force a branch that can support stacking 
 
1094
            # We need to make a stacked branch, but the default format for the
 
1095
            # target doesn't support stacking.  So force a branch that *can*
 
1096
            # support stacking. 
1094
1097
            from bzrlib.branch import BzrBranchFormat7
1095
1098
            format = BzrBranchFormat7()
1096
1099
            result_branch = format.initialize(result)
1097
1100
            mutter("using %r for stacking" % (format,))
 
1101
            format_forced = True
1098
1102
        elif source_branch is None:
1099
1103
            # this is for sprouting a bzrdir without a branch; is that
1100
1104
            # actually useful?
1101
1105
            result_branch = result.create_branch()
1102
1106
        else:
1103
 
            result_branch = source_branch._format.initialize(result)
 
1107
            result_branch = source_branch.sprout(
 
1108
                result, revision_id=revision_id)
1104
1109
        mutter("created new branch %r" % (result_branch,))
1105
1110
        repository_policy.configure_branch(result_branch)
1106
 
        if source_branch is not None:
 
1111
        if source_branch is not None and format_forced:
1107
1112
            # XXX: this duplicates Branch.sprout(); it probably belongs on an
1108
1113
            # InterBranch method? -- mbp 20080724
1109
1114
            source_branch.copy_content_into(result_branch,