Convert mercurial repos to git
15
Mar
2010
Because I want all my submodules to be on the same SCM. And because git is awesome, and mercurial is just a bit less awesome. (don’t take it personal)
- Get hg-fast-export: git clone git://repo.or.cz/fast-export.git
- Go to your mercurial [sic!] repo.
- git init
- /path/to/hg-fast-export.sh -r /path/to/hg_repo
- win! add remaining files, commit and push to github!
And if you are using macports you probably get this error instead:
ImportError: No module named mercurial
That’s easy to fix. Add this to your ~/.bash_profile:
export LC_CTYPE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export PYTHONPATH=/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages:/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/mercurial:$PYTHONPATH
got that from here and the ImportError-fix from here.
Related posts:
- git and cvs turnaround ‘guerilla style’
- Fix man-pages in mac os & macports
1 Response to Convert mercurial repos to git
Dan Theurer
August 3rd, 2011 at 1:18 am
Hey Peter! That fixed it for me. I had to do a
$git checkout HEAD
between steps 4 and 5 to see the source files.