I've been hassling Brian to move libmemcached to bazaar for a while now, tonight we finally got a continuous import from mercurial going into bazaar, and published on launchpad. Using bzr fast-import along with hg-fast-export, this was really easy. I'm thrilled to see all the fast-export/fast-import tools that have sprouted up between git, mercurial, and bazaar. Here is the script I stuck in cron to do the continous import (every 6 hours or so), feel free to make fun of my crappy shell scripting.
!/bin/bash # move into the hg repo and check if hg repo has new revisions pushd ../libmemcached # hg incoming will exit 1 if no new revisions, 0 if new revisions hg incoming if [ "$?" -eq "0" ]; then # pull hg repo echo "New mercurial revisions found upstream, pulling" hg pull else echo "No new mercurial revisions found, exiting" exit fi # move back to our bazaar shared repo popd # run fastimport to get the latest revisions into bzr echo "Importing new revisions into bazaar repo" export HG_FAST_EXPORT=~/.bazaar/plugins/fastimport/exporters/hg-fast-export.py $HG_FAST_EXPORT --repo=../libmemcached/ | bzr fast-import - export LAUNCHPAD_ID=`bzr launchpad-login` # loop through all branches, pushing them to launchpad #. for directory in * do if [ -d "$directory" ]; then echo "Pushing $directory to launchpad" pushd $directory > NUL echo "bzr push bzr+ssh://$LAUNCHPAD_ID@bazaar.launchpad.net/~libmemcached-developers/libmemcached/$directory" bzr push bzr+ssh://$LAUNCHPAD_ID@bazaar.launchpad.net/~libmemcached-developers/libmemcached/$directory popd fi done