From SVN to Mercurial

Moving from SVN to Mercurial is obvious if you don't want history. Folder copy/paste action is more than enough. If we want to get whole history, that is where things get more involved. This guide is written with assumption of Ubuntu installation of Mercurial. If you are using something other, do adjust a little (yes, it also works on Windows).

First thing that we need is "python-subversion" package installed. For some reason I could not find this through Ubuntu Software Center. It worked from Synaptic Package Manager without issues. Afterward we need to enable Mercurial's convert extension. Just edit "/home/josip/.hgrc" (do change folder if your name is not Josip) and add these lines to it:

[extensions]
hgext.convert=

Last thing to do is actual conversion:

$ mkdir TestRepo

$ hg convert svn://192.168.0.3/TestRepo TestRepo
initializing destination TestRepo repository
scanning source...
sorting...
converting...
32
31
...
1
0

$ cd TestRepo

$ hg update
49 files updated, 0 files merged, 0 files removed, 0 files unresolved

Your Mercurial repository awaits. :)

P.S. If folder with Mercurial repository is empty, you probably forgot to do "hg update".

Leave a Reply

Your email address will not be published. Required fields are marked *