Package: bzrsync
BzrSync is a tool to help a developer using Bazaar on multiple machines.
It automatically keeps selected repositories and branches synchronized across
the machines. Bazaar itself is used for the synchronization (with “bzr pull”),
ensuring consistency at all times.Featuresany number of machines are supportedconsistency is guaranteed at all timesInstallationTo install the latest stable version of BzrSync, usingpip:pip install bzrsyncor usingsetuptools:easy_install bzrsyncOtherwise, if neitherpipnorsetuptoolsare available, it is possible
to download (eg. fromPyPI) thesourcepackage, extract it and run the
usualsetup.pycommands:python setup.py installUsageLet’s suppose you work from three different workstations, and their hostnames
arealpha,betaandgamma. You want to keep your Bazaar repositories and
branches synchronized between all three nodes using BzrSync.
BzrSync is meant to be used with shared repositories, so if you are not
using these, you should re-organize your branches to use shared repositories.
It’s easier to keep all the repositories inside the same directory.
In our example our repositories will reside in ~/bzr and their names will
end in “.bzr”.
In each shared repository, at the top level there should be a directory for
each node. In our casealpha,betaandgamma.
For example, let’s imagine we have a repository named “project-foo.bzr”.
We are working onalpha, and have created atrunkand afeature-1branch.
We’ll have:~/bzr/project-foo.bzr/
~/bzr/project-foo.bzr/alpha
~/bzr/project-foo.bzr/alpha/trunk
~/bzr/project-foo.bzr/alpha/feature-1
~/bzr/project-foo.bzr/beta
~/bzr/project-foo.bzr/gammaLet’s suppose we also have alocal.bzrrepository we don’t want to
synchronize, in either direction.BzrSync needs a YAML config file, by default~/.bazaar/bzrsync.yaml,
listing the repositories and the branches we.
In this example its contents will be:# remote nodes
# (a host can be specified with an optional port as HOST:PORT)
hosts:
- alpha
- beta
- gamma

# where repositories specified with a relative path/pattern are located
root: ~/bzr

# *all* repositories
repositories: "*.bzr"

# specific repositories to exclude from 'repositories'
exclude:
- local.bzr

# repositories to export to remote nodes
export: "*.bzr"

# specific repositories excluded from export
export_exclude:
- local.bzr

# repositories to sync from remotes
sync: "*.bzr"

# specific repositories excluded from sync
sync_exclude:
- local.bzrWe can use exactly this same configuration file on all three nodes.BzrSync won’t create the shared repositories for you, so before proceeding,
do so now on all the nodes, remembering to create also the node
subdirectories.Then launch the BzrSync daemon on all the nodes:alpha$ bzrsync serve

beta$ bzrsync serve

gamma$ bzrsync serveNow let’s sync project-foo.bzr from alpha to beta:beta$ bzrsync sync ~/bzr/project-foo.bzrThis will pull tobetaall the branches from~/bzr/project-foo.bzr/alpha/onalpha, and all the branches from~/bzr/project-foo.bzr/gamma/ongamma.
In our case, only alpha has branches right now, so in practice we’ll
get the branchesalpha/trunkandalpha/feature-1fromalphatobeta, keeping them asalpha/trunkandalpha/feature-1.If you want to work onbeta, now branch from the newly synchronized branches
to their counterparts inside thebeta/subdirectory:beta$ bzr branch ~/bzr/project-foo.bzr/alpha/feature-1 ~/bzr/project-foo.bzr/beta/feature-1
beta$ bzr co ~/bzr/project-foo.bzr/beta/feature-1 foo-feature-1
beta$ cd foo-feature-1
...
hack hack hack
...
beta$ commitNow onbetawe’ll have:~/bzr/project-foo.bzr/
~/bzr/project-foo.bzr/alpha
~/bzr/project-foo.bzr/alpha/trunk
~/bzr/project-foo.bzr/alpha/feature-1
~/bzr/project-foo.bzr/beta
~/bzr/project-foo.bzr/beta/feature-1
~/bzr/project-foo.bzr/gammaWhen you have finished working on beta, you can sync from alpha:alpha$ bzrsync sync ~/bzr/project-foo.bzrand this will createbeta/feature-1onalphatoo, which you can
pull ontoalpha/feature-1if not diverged, or merge it otherwise,
and start working fromalphaagain.Please see the examplebzrsync.yamlfile for a more complete example, which
includes also branch sets.Help and DevelopmentAlternatively, if you’d like to update the software occasionally to pick
up the latest bug fixes and enhancements before they make it into an
offical release, branch from theBazaarrepository hosted onLaunchPadinstead.
Just follow the procedure outlined below:Make sure that you haveBazaarinstalled, and that you can run its
commands from a shell. (Enterbzr helpat a shell prompt to test
this.)Create a local branch and working tree from the official one:bzr branch lp:bzrsync bzrsyncThen from thebzrsyncdirectory you can run thesetup.py developcommand to install the library in your Pythonsite-packagesdirectory
using a link, which allows to continue developing inside the working tree
without the need to re-install after every change. See thesetuptools development modedocumention for more information:$ sudo
# python setup.py developLICENSEThis software is covered by the GNU General Public License version 2.
It is:Copyright (C) 2010-2011  Marco Pantaleoni. All rights reserved.This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2 as
published by the Free Software Foundation.This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.