File: mirror.py

package info (click to toggle)
bzrtools 2.6.0-4
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid
  • size: 740 kB
  • sloc: python: 4,299; sh: 13; makefile: 10
file content (17 lines) | stat: -rw-r--r-- 822 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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())
    source_config = source_branch.get_config()
    child_submit_to = source_config.get_user_option('child_submit_to')
    if child_submit_to is not None:
        mirror.get_config().set_user_option('child_submit_to', child_submit_to)
    return mirror