~abentley/bzrtools/bzrtools.dev

1
2
3
4
5
6
7
8
9
10
11
12
13
from bzrlib.transport import get_transport


def create_mirror(source_branch, target_location, possible_transports):
    possible_transports.append(source_branch.bzrdir.root_transport)
    t = get_transport(target_location, possible_transports)
    mirror = source_branch.bzrdir.clone_on_transport(t).open_branch()
    mirror.set_public_branch(source_branch.base)
    mirror.set_parent(source_branch.base)
    if source_branch.get_config().has_explicit_nickname():
        mirror.nick = source_branch.nick
    mirror.set_submit_branch(source_branch.get_submit_branch())
    return mirror