WARNING!!!: Dont forget to git clone --recursive <project url>
this repository as it includes fast-transform submodule that is required for scripts to work.
Since Bitbucket announced end of Mercurial support here is the instruction and scripts to help migrating multiple repositories from Bitbucket Mercurial (Hg) to Git.
Prerequisites: Bash, Python 2.
Please follow instructios below:
Follow instructions here
Using Scraper Chrome extension it is easy to extract repository names from Bitbucket web site. Put extracted repository names into repositories.txt file one line each.
Execute bash clone.sh prefix
command, substituting prefix
with your organisation or personal Bitbucket URL prefix. This will clone all repositories into ./hg/
folder locally.
Execute bash transform.sh
command to convert all Mercurial repositories in hg
folder into Git repositories and output them to git
folder. The proces will drop all non-merged unnamed heads from hg repositories, which is usually OK. If your repository is well maintained and merged nameless heads only represent abandoned lines of work.
.hgignore files has to be converted to .gitignore manually. Fortunately such conversion only needed if you continue to work on the project.
Create Gitlab account (if not already) and configure it to use SSH.
Create groups on Gitlab to match your organization names from Bitbucket.
Execute bash push.sh prefix
to push all repositories from git
folder to Gitlab, substituting prefix
with your Group name or personal URL prefix.