Alternative to bzr-mirror?

Nicholas Allen nick.allen at onlinehome.de
Wed Feb 3 15:20:42 GMT 2010


I wrote my own shell script to do this which I use it for backup
purposes. It makes use of the branches command. To use it you should
create a repository and then run this script inside the repository:

#!/bin/sh
# Mirrors all Bazaar branches from a remove location to locations under
the current directory.

set -e

USER=user
HOST=host
REMOTE_PATH=/path/to/mirror
BRANCHES=$(ssh $USER@$HOST bzr branches $REMOTE_PATH)
LOCAL_ROOT="$PWD"
REMOTE_ROOT="bzr+ssh://$USER@$HOST/$REMOTE_PATH"

for BRANCH in $BRANCHES
do
    REMOTE_BRANCH="$REMOTE_ROOT/$BRANCH"
    LOCAL_BRANCH="$LOCAL_ROOT/$BRANCH"
   
    if ! test -d $LOCAL_BRANCH; then
        echo "Branching $REMOTE_BRANCH to $LOCAL_BRANCH";
        mkdir -p $(dirname "$LOCAL_BRANCH");
        bzr branch "$REMOTE_BRANCH" "$LOCAL_BRANCH"
    else
        echo "Pulling changes from $REMOTE_BRANCH";
        cd $LOCAL_BRANCH;
        bzr pull --overwrite $REMOTE_BRANCH || true;
    fi
done

Óscar Fuentes wrote:
> I need to replicate a large number of branches across several machines
> through sftp. The plugin `bzr-mirror' looks like the right tool for the
> job, but it does not work and seems unmaintained (no activity for almost
> two years).
>
> Is there any other method for doing this?
>
>
>   




More information about the bazaar mailing list