3
This is a plugin for the Bazaar-NG revision control system.
7
import bzrlib, bzrlib.commands
9
class cmd_rsync_pull(bzrlib.commands.Command):
10
"""Update the current working tree using rsync.
11
With no arguments, look for a .bzr/x-rsync-location file
12
to determine which remote system to rsync from.
13
Otherwise, you can specify a new location to rsync from.
15
Normally the first time you use it, you would write:
16
bzr rsync-pull . path/to/otherdirectory
18
takes_args = ['local?', 'remote?']
19
takes_options = ['verbose']
22
def run(self, local=None, remote=None, verbose=True):
23
from rsync_update import get_branch_remote_update, \
24
check_should_pull, set_default_remote_info, pull
26
b, remote, last_revno, last_revision = \
27
get_branch_remote_update(local=local, remote=remote)
29
if not check_should_pull(b, last_revno, last_revision):
31
b = pull(b, remote, verbose=verbose)
33
set_default_remote_info(b, remote)
35
class cmd_rsync_pull_bzr(cmd_rsync_pull):
36
takes_args = ['remote?']
37
def run(self, remote=None, verbose=True):
38
from rsync_update import get_branch_remote_update, \
39
check_should_pull, set_default_remote_info, pull
41
bzr_path = os.path.dirname(bzrlib.__path__[0])
42
b, remote, last_revno, last_revision = \
43
get_branch_remote_update(local=bzr_path, remote=remote
44
, alt_remote='bazaar-ng.org::bazaar-ng/bzr/bzr.dev/')
46
if not check_should_pull(b, last_revno, last_revision):
48
b = pull(b, remote, verbose=verbose)
50
set_default_remote_info(b, remote)
52
class cmd_rsync_push(bzrlib.commands.Command):
53
"""Update the remote tree using rsync.
54
With no arguments, look for a .bzr/x-rsync-location file
55
to determine which remote system to rsync to.
56
Otherwise, you can specify a new location to rsync to.
58
takes_args = ['local?', 'remote?']
59
takes_options = ['verbose']
62
def run(self, local=None, remote=None, verbose=True):
63
from rsync_update import get_branch_remote_update, \
64
check_should_push, set_default_remote_info, push
66
b, remote, last_revno, last_revision = \
67
get_branch_remote_update(local=local, remote=remote)
69
if not check_should_push(b, last_revno, last_revision):
72
push(b, remote, verbose=verbose)
74
set_default_remote_info(b, remote)
77
if hasattr(bzrlib.commands, 'register_plugin_command'):
78
bzrlib.commands.register_plugin_command(cmd_rsync_pull)
79
bzrlib.commands.register_plugin_command(cmd_rsync_pull_bzr)
80
bzrlib.commands.register_plugin_command(cmd_rsync_push)
81
elif hasattr(bzrlib.commands, 'register_command'):
82
bzrlib.commands.register_command(cmd_rsync_pull)
83
bzrlib.commands.register_command(cmd_rsync_pull_bzr)
84
bzrlib.commands.register_command(cmd_rsync_push)