Migrating to Git thanks to CloudBees
Join the DZone community and get the full member experience.
Join For Free
I got a free account (FOSS account) on CloudBees.com for my open source project (Qualitas).
I decided to use the Maven and Jenkins parts of the CloudBees (for
now), but was quite dissapointed when I saw that CloudBees' Jenkins
supported only Git and SVN. My project used Hg. I wasn't emotionally
attached to Hg so I decided to migrate my Hg repository to Git.
Thankfully Google Code gave my a hint to use hg-fast-export tool. See below how easy it is to migrate your Hg repository to Git.
Installing Git
OK, first you have to install Git on your machine (if you don't have it
already). If you're on Linux with yum installed, execute the following
command:
yum install git
Installing hg-fast-export
Just clone their repo (Git repo of course :) ):
git clone git://repo.or.cz/fast-export.git
There will some shell and some Python scripts in there. Names indicate what they do.
Migrating repositories
OK. So to migrate my Hg repo I had to execute the following commands (change names of directories and you should be fine):
cd /work/qualitas/repository/qualitas hg pull # just to make sure there are no pending changes in master repository cd .. mkdir tmp-qualitas-git cd tmp-qualitas-git git init /your-path-to/hg-fast-export.sh -r ../qualitas
See the log for any errors.
Now clone tmp-qualitas-git and verify if both repositories are the same:
git clone tmp-qualitas-git qualitas-git diff --brief -r qualitas qualitas-git
You should see only the differences in all files which were added to .hgignore. If there are differences in other files then something went wrong... which thankfully was not my case :)
Last step was to move .hgignore and tags files.
Migrating tags
Hg stores tags in .hgtags file. hg-fast-export took care of that and if you execute:
git tag
you will see all original tags copied from the Hg repo.
Migrating .hgignore
Migrating .hgignore to .gitignore is just a matter of copying and renaming the file :)
Summary
That's all, childishly simple.
Cloudbees.com I'm comming!
Published at DZone with permission of Łukasz Budnik, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments