Convert from Subversion to Mercurial fast

In my previous post about converting from Subversion to Mercurial I assumed that I would want to migrate the history of changes from my svn repository to the new hg repository.

For some projects, I don’t really care about the history so I decided to take the quick and dirty route:

  • Create a new, empty master hg repository (on a server)
  • Clone that hg repository to a local directory
  • Check out the project from svn to the same local directory
  • Add a new .hgignore file to ignore the .svn subdirectory
  • Add the .hg subdirectory to the svn:ignore property
  • Add .hgignore to svn and commit that change
  • Add everything to hg, commit and push that change

That’s it. Now you have got a directory that contains your sources and they are managed with both, Subversion and Mercurial. Now, get into the habit of committing changes to both as long as you want. Once you are comfortable with Mercurial, just stop using Subversion. You might want to delete the .svn subdirectory at that point.