~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/clone.py

Move working tree initialisation out from  Branch.initialize, deprecated Branch.initialize to Branch.create.

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
from bzrlib.trace import mutter, note
54
54
from bzrlib.store import copy_all
55
55
from bzrlib.errors import InvalidRevisionId
 
56
from bzrlib.workingtree import WorkingTree
56
57
 
57
58
def copy_branch(branch_from, to_location, revision=None, basis_branch=None):
58
59
    """Copy branch_from into the existing directory to_location.
81
82
        history = _get_truncated_history(branch_from, revision)
82
83
        if not bzrlib.osutils.lexists(to_location):
83
84
            os.mkdir(to_location)
84
 
        branch_to = Branch.initialize(to_location)
 
85
        branch_to = Branch.create(to_location)
85
86
        mutter("copy branch from %s to %s", branch_from, branch_to)
86
 
        branch_to.working_tree().set_root_id(branch_from.get_root_id())
87
87
        _copy_control_weaves(branch_from, branch_to, history)
88
88
        _copy_text_weaves(branch_from, branch_to, history)
89
89
        _copy_revision_store(branch_from, branch_to, history)
90
90
        branch_to.set_parent(branch_from.base)
91
91
        # must be done *after* history is copied across
92
92
        branch_to.append_revision(*history)
93
 
        build_working_dir(to_location)
 
93
        WorkingTree.create(branch_to, to_location).set_root_id(branch_from.get_root_id())
94
94
        mutter("copied")
95
95
        return branch_to
96
96
    finally: