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 http://bitbucket.org/durin42/hgsubversion/ 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:
[extensions]
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:
svn+https://autofac.googlecode.com/svn/trunk
So Clone Repository command should give you something like:

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:
[extensions]
rebase=
It is invoked by:
hg rebase --svn
More details could be found in a really detailed article: hgsubversion and named branches for dummies
本文介绍如何利用最新版本的TortoiseHg客户端轻松访问Subversion仓库,并详细说明了安装扩展、配置及操作流程。通过使用hgsubversion扩展,可以实现本地快速提交、丰富的分支和合并能力,以及解决版本控制差异问题。此外,文章还提到了如何避免在SVN分支中进行合并,推荐使用重放命令来处理仓库间的变化。
3635







Reader Comments (4)
I'm getting the following error when trying to clone:
*** failed to import extension hgsubversion from D:\repos\hgsubversion\hgsubversion\: No module named
There should not be trailing slash. This is what worked for me:
[extensions]
hgsubversion = D:\repos\hgsubversion\hgsubversion
Konstantin, thanks, I've added a note to the post!
Please change it to exactly how Konstantin has it, with the nested hgsubversion directory.