With Mercurial sunsetting support, it was time to move our repos. But how do you do this en masse?
When we received the first communication about Bitbucket sunsetting Mercurial support, there was quite a lot of excitement around the office. All of our source code was stored as Mercurial repositories on Bitbucket and – being a product company – a lot of the company’s value is in the source code.
A closer look at the problem presented us with the following challenge:
A solution was needed, but many searches and discussions later, nothing suitable was found. So, we decided to wait. There was still plenty of time and we trusted that a solution would surely present itself sooner or later.
However, when the reminder from Bitbucket arrived early in 2020, no solution had as yet presented itself and time was starting to run out. A few searches later we found the fast-export converter by Frej, a python project on Github that we could use to convert our repos one-by-one. While each individual migration seems simple enough, our challenge was the fact that we had to do this in bulk.
The challenge to do this in bulk was a great use case for Linx. Linx excels at the rapid development and deployment of back-end automations. With its visual models, it accelerates the development process for developers to quickly build unattended automations without having to worry about setting up or scaling their backend infrastructure and the related services.
We decided to create an automated process that would perform the entire conversion against each of our repos without any intervention.
We decided to create an automated process that would perform the entire conversion against each of our repos without any intervention.
Within 3 days we developed and tested our Linx solution and it works great. The final solution automatically performed the following steps:
The only limitations we are aware of is that closed branches and issues are not migrated. It seems that the closed branches concept does not exist in Git and we don’t use the Bitbucket Issues feature. However, if you need Issues, building the migration of these into the Linx solution should be quick and easy. Bitbucket has an Issue Export API call that you can implement in Linx to accomplish this.
Once ready, each of our teams would need to run this solution themselves as the conversion needed to fit into each team’s own release cycle. So, the process each team followed was:
Some conversions took a long time to run, but for most teams have completed their conversions now and development has continued smoothly and without interruptions to date.
Some of our results were pretty impressive;
TRY IT
The solution is freely available for anyone to use. Download the Linx Designer and use the sample provided.
Watch the video: https://www.youtube.com/watch?v=ziJXHuQvioc
Previously published at https://linx.software/automating-bulk-transfer-of-mercurial-repos-to-git/