Synchronize Bitbucket to Github automatically

Written by fredrik

24 juli, 2013

Introducing BitSyncHub

Since I’m an automation nut, when I found Travis CI, I was understandably excited – automatic running of my testcases for hgapi from the repository as opposed to a pre-push hook (as I have had it set up since the beginning of time) would avoid the oh-so embarrassing mistakes of forgetting to add a new file to the repository and having a non-working version in the repo. I just have to set up some service to synch to the GitHub mirror and all will… be… well?

Turns out there was no such service. A hundred advices on how to mirror using push-hooks in your local repository, but since I don’t always commit from the same computer, I would need to keep all instances (including future) set up properly, and never again could I be a tad lazy and accept a pull request instead of pushing it from my local repo. This, to me, is not an acceptable state of affairs.

So last week I spent a couple of hours setting up a new service, dubbed BitSyncHub, that will accept POST requests from Bitbucket and synchronize a (Mercurial) repository with it’s Github mirror. It is set up using UWSGI, hgapi with hg-git, and Celery for job control. It’s a bit rough in that it does not report errors (since it does not run synchronously), and always pushes to Github using the same certificate and user, but I’ve not been able to break it (recently), and it only requires a one-time setup and it will keep your branches in synch!

You May Also Like…

0 kommentarer