I have several Bitbucket-hosted Mercurial repos for my binary baseline and some development projects. I started to use Mercurial because the syntax was easier. In the meantime I have been using Git at work and could not remember the Mercurial commands. Time to convert. How?
Thanks to this article, “Converting Mercurial to Git”, it is easy. Kind of. Had to install ActiveState Python, then install the Mercurial package
>pypm install mercurial
Then here are the basic instructions:
$ cd ~/Desktop $ git clone git://repo.or.cz/fast-export.git $ git init git_repo $ cd git_repo $ ~/Desktop/fast-export/hg-fast-export.sh -r /path/to/old/mercurial_repo $ git checkout HEAD
Since I use the wonderful msysgit git-bash shell, the script worked, except the `dirname $0` failed for some reason. I just replaced the dynamically generated value with the actual location of the repo.
So mine was
~/Desktop/git_repo (master) $ ~/Desktop/fast-export/hg-fast-export.sh -r /c/bin ROOT=/c/Documents and Settings/Loaner/Desktop/fast-export master: Exporting full revision 1/130 with 1/0/0 added/changed/removed files master: Exporting simple delta revision 2/130 with 7118/0/0 added/changed/removed files Exported 1000/7118 files Exported 2000/7118 files ... master: Exporting simple delta revision 127/130 with 0/1/0 added/changed/removed files master: Exporting simple delta revision 128/130 with 1/0/0 added/changed/removed files master: Exporting simple delta revision 129/130 with 3/9/0 added/changed/removed files master: Exporting thorough delta revision 130/130 with 6/25/1 added/changed/removed files Issued 130 commands
Everything was on master, so this was an easy test. So far so good. Of course, the EOL issues exist – so on the validation comparison, I set WinMerge to ignore line endings. We’ll see how that works out.
BTW make sure you update the source repo before you convert. I’m just sayin’.