Software Design Blog

Journey of Rinat Abdullin

Use TortoiseHg (Mercurial) With SVN Repository

It is trivial to use Mercurial client (TortoiseHg) to access Subversion repositories.

Once you have the latest TortoiseHg, the process works easily.

First you need to grab the hgsubversion extension:

mkdir C:\repos
hg clone C:\repos\hgsubversion

Info about the hgsubversion extension.

Then, you enable the extension:

Right-click context menu - TortoiseHg - Global Settings - Edit File - add the lines below to your Mercurial.ini file:

hgsubversion = C:\repos\hgsubversion

Keep in mind, that there should be no trailing slash!

Now you can, for example, grab the Autofac repository, using the usual check-out path prefixed with SVN:


So Clone Repository command should give you something like:

Clone SVN repository with Mercurial (TortoiseHg)

Once the process is complete, we get features like:

  • Full repository history.
  • Extremely fast local commits and other operations.
  • Rich branching and merging capabilities.
  • Ability to use solution-wide refactoring of ReSharper without the risk of corrupting something.
  • Awesome “Guess Renames” feature of TortoiseHg.

If this is the first time you access the SVN repository from TortoiseHg, you might want to add the proper hgignores.

Synchronize would let you sync the local changes back to the original SVN repository as needed. Although if you’ve got some merges in the history, that’s where the problems could start due to the logical Version Control disparities between the SVN and Mercurial.

Rebase might help here, but you need to keep in mind an important rule: don’t merge INTO Subversion branches.

That’s because:

The important point to note is that hgsubversion cannot push merge changesets to a svn repository

So instead of merging, we use rebase command, which essentially manually replays changes from one branch in another branch. This command is enabled in the config:


It is invoked by:

hg rebase --svn

More details could be found in a really detailed article: hgsubversion and named branches for dummies