Skip to content

Instantly share code, notes, and snippets.

@petterl
Created November 28, 2012 05:30
Show Gist options
  • Save petterl/4159212 to your computer and use it in GitHub Desktop.
Save petterl/4159212 to your computer and use it in GitHub Desktop.
Sync of repo from bzr (lauchpad) to git (github) (manually since some commits where bad according to github)
# Create repo
mkdir eventum
cd eventum
git init
# Prepare for bzr
mkdir .git/bzr
mkdir .git/bzr/repo
mkdir .git/bzr/map
bzr init-repo --no-trees .git/bzr/repo
bzr branch lp:eventum .git/bzr/repo/master
# Fast-export the bzr repo
bzr fast-export --plain --export-marks=.git/bzr/map/master-bzr --git-branch=bzr/master .git/bzr/repo/master > bzr-fast-export
# Fixing the repo committers
sed "s/^committer <Elan>/committer Elan Ruusamäe <[email protected]>/" bzr-fast-export > bzr-fast-export-fix
sed "s/^committer <>/committer Unknown <[email protected]>/" bzr-fast-export-fix > bzr-fast-export
rm bzr-fast-export-fix
# Import into git
git fast-import --quiet --export-marks=.git/bzr/map/master-git < bzr-fast-export
rm bzr-fast-export
git branch master bzr/master
git config bzr.master.bzr bzr/master
git config bzr.bzr/master.upstream lp:eventum
git checkout master
git bzr sync
git remote add github [email protected]:petterl/eventum.git
git push github master
REPOBASE=$HOME/repos
for REPO in eventum; do
cd $REPOBASE/$REPO/
echo "Syncing $REPO repository from launchpad.."
git bzr pull
echo "Pushing $REPO repository to github.."
git push github master
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment