Wiki

Clone wiki

BitBucket Hg to Git / About

Home | FAQ

Project Description

bbhg2git is a simple Python 3.7 script that makes use of the BitBucket 2.0 API to identify and create new equivalent Git repositories and a Git/Mercurial compatibility addon to do the conversion. It is completely non-destructive - your existing repositories will not be affected!

I've used it only in a Cygwin environment on Windows but I tried to keep it fairly generic so hopefully it will work anywhere that Python 3 is installed. I used Python 3.7.4.

Its internal functionality is approximately as follows:

1) Ensure git and git-remote-hg are available on PATH
2) Connect (authenticate) to BitBucket API
3) Read list of projects for user
4) For each project:
5)    If it's not a Mercurial project, skip processing
6)    If a Git equivalent project exists already, skip processing
7)    Create Git equivalent project on BitBucket
8)    Clone project locally using git clone --mirror with hg:: prefix
9)    Push local project to new git remote using git push --mirror

Updated