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:
$ git clone git://repo.or.cz/fast-export.git
$ mkdir new_git_repo
$ cd new_git_repo
$ git init
$ /path/to/hg-fast-export.sh -r /path/to/hg_repo
$ git checkout HEAD`
I ran into trouble with the hg-fast-export
line. My terminal issued the
following:
File "/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
news! The python_select
tool makes it easy to choose a default installation of
python. So let’s install it:
$ sudo port install python_select
$ sudo python_select -s`
--> python26-apple*
$ sudo python_select -l`
--> current none python26 python26-apple*
$ sudo python_select python26`
We can verify this version of Python actually has our module in it
$ python
>>> 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.