Skip to main content

BzrSync - Bazaar repository/branch synchronization tool

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.

Features

  • any number of machines are supported

  • consistency is guaranteed at all times

Installation

To install the latest stable version of BzrSync, using pip:

pip install bzrsync

or using setuptools:

easy_install bzrsync

Otherwise, if neither pip nor setuptools are available, it is possible to download (eg. from PyPI) the source package, extract it and run the usual setup.py commands:

python setup.py install

Usage

Let’s suppose you work from three different workstations, and their hostnames are alpha, beta and gamma. 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 case alpha, beta and gamma. For example, let’s imagine we have a repository named “project-foo.bzr”. We are working on alpha, and have created a trunk and a feature-1 branch. 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/gamma

Let’s suppose we also have a local.bzr repository 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.bzr

We 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 serve

Now let’s sync project-foo.bzr from alpha to beta:

beta$ bzrsync sync ~/bzr/project-foo.bzr

This will pull to beta all the branches from ~/bzr/project-foo.bzr/alpha/ on alpha, and all the branches from ~/bzr/project-foo.bzr/gamma/ on gamma. In our case, only alpha has branches right now, so in practice we’ll get the branches alpha/trunk and alpha/feature-1 from alpha to beta, keeping them as alpha/trunk and alpha/feature-1.

If you want to work on beta, now branch from the newly synchronized branches to their counterparts inside the beta/ 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$ commit

Now on beta 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/beta/feature-1
~/bzr/project-foo.bzr/gamma

When you have finished working on beta, you can sync from alpha:

alpha$ bzrsync sync ~/bzr/project-foo.bzr

and this will create beta/feature-1 on alpha too, which you can pull onto alpha/feature-1 if not diverged, or merge it otherwise, and start working from alpha again.

Please see the example bzrsync.yaml file for a more complete example, which includes also branch sets.

Help and Development

Alternatively, 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 the Bazaar repository hosted on LaunchPad instead. Just follow the procedure outlined below:

  1. Make sure that you have Bazaar installed, and that you can run its commands from a shell. (Enter bzr help at a shell prompt to test this.)

  2. Create a local branch and working tree from the official one:

    bzr branch lp:bzrsync bzrsync
  3. Then from the bzrsync directory you can run the setup.py develop command to install the library in your Python site-packages directory using a link, which allows to continue developing inside the working tree without the need to re-install after every change. See the setuptools development mode documention for more information:

    $ sudo
    # python setup.py develop

LICENSE

This 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.

Metadata

Release files for bzrsync 0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bzrsync 0.2
File Size Uploaded Provenance
bzrsync-0.2.tar.gz 184.3 kB Without provenance Details

Release files / bzrsync-0.2.tar.gz

Download URL bzrsync-0.2.tar.gz
Size 184.3 kB
Tags Source
SHA-256 checksum
How to use checksums
9c768785ff837f573855384b2ee2b371776b3177be235f27500b3f11eb4260c7
BLAKE2b-256 checksum
How to use checksums
c8593ee138a1b0cd088c9fb25b201742dfcb497485765346b19325e3b5cab99a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for bzrsync 0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page