Eventum Bazaar to Git migration scripts.
Originally created by Petter Sandholdt, improved by Elan Ruusamäe which now landed here.
This is two way synchronization from Eventum Bazaar repository (trunk) to Eventum Git repository (master).
eventum.bzr |
Eventum Bazaar to Git migration scripts.
Originally created by Petter Sandholdt, improved by Elan Ruusamäe which now landed here.
This is two way synchronization from Eventum Bazaar repository (trunk) to Eventum Git repository (master).
#!/bin/sh | |
set -e | |
dir=$(dirname "$0") | |
dir=$(cd "$dir"; pwd) | |
# checkout bazaar locally, to cut down network traffic if want to restart process | |
test -d eventum.bzr || bzr branch lp:eventum eventum.bzr | |
# live one | |
#bzr_upstream=lp:eventum | |
# test one | |
bzr_upstream=$dir/eventum.bzr | |
# TODO: | |
# - use bare repo: https://github.com/termie/git-bzr-ng/issues/52 | |
# Create repo | |
# mkdir, so it will fail if dir exists | |
mkdir eventum.git | |
cd eventum.git | |
git init | |
# Prepare for bzr | |
install -d .git/bzr/{map,repo} | |
bzr init-repo --no-trees .git/bzr/repo | |
bzr branch $bzr_upstream .git/bzr/repo/master | |
# Fast-export the bzr repo | |
test -s $dir/bzr-fast-export.raw || \ | |
bzr fast-export --plain --export-marks=.git/bzr/map/master-bzr --git-branch=bzr/master .git/bzr/repo/master \ | |
> $dir/bzr-fast-export.raw | |
test -s $dir/bzr-fast-export || \ | |
bzr fast-import-filter --user-map=$dir/authors > $dir/bzr-fast-export < $dir/bzr-fast-export.raw | |
# Import into git | |
git fast-import --export-marks=.git/bzr/map/master-git < $dir/bzr-fast-export | |
rm -f $dir/bzr-fast-export* | |
git branch master bzr/master | |
git config bzr.master.bzr bzr/master | |
git config bzr.bzr/master.upstream $bzr_upstream | |
# make some space | |
# 115MiB -> 36MiB | |
git gc --prune=now --aggressive | |
#git gc --aggressive | |
git repack -a -d -f -F --window=250 --depth=250 | |
#git remote add github [email protected]:petterl/eventum.git | |
#git remote add github [email protected]:glensc/eventum.git | |
#git push -u github master |
#!/bin/sh | |
set -e | |
dir=$(dirname "$0") | |
dir=$(cd "$dir"; pwd) | |
# pull bzr and git changes | |
cd $dir/eventum.bzr | |
bzr pull | |
cd $dir/eventum.git | |
git pull | |
# first pull bzr->git | |
git bzr pull | |
# then push git->bzr | |
git bzr push | |
# and distribute changes | |
#git push origin master | |
cd $dir/eventum.bzr | |
#bzr push |