Versioning: Lossless Conversion from Hg to Git
I recently migrated from a private repository on Bitbucket to a public repository on Github. I didn't want to lose my 168-commit history with the move, so naturally I started searching for ways to export my Mercurial history.
The ironically named Semi-useless rhetoric blog was one of the first hits.
The blog's advice:
1$ git clone git://repo.or.cz/fast-export.git2$ mkdir new_git_repo3$ cd new_git_repo4$ git init5$ /path/to/hg-fast-export.sh -r /path/to/hg_repo6$ git checkout HEAD`
I ran into trouble with the
hg-fast-export line. My terminal issued the
1File "/DIRECTORY_I_CLONED_TO/fast-export/hg-fast-export.py", line 6, in from mercurial import repo,hg,cmdutil,util,ui,revlog,nodeImportError: No module named mercurial
That was nonsense. I suspected I had multiple versions of python installed. Good
python_select tool makes it easy to choose a default installation of
python. So let's install it:
1$ sudo port install python_select2$ sudo python_select -s`3 --> python26-apple*4$ sudo python_select -l`5 --> current none python26 python26-apple*6$ sudo python_select python26`
We can verify this version of Python actually has our module in it
1$ python2>>> help('modules')
Now we're all set for hg-fast-export.
Note My system is Mac OS X 10.6 with Mercurial installed from MacPorts.