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 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:

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:

[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

« DDDD, CQRS and Other Enterprise Development Buzz-words | Main | More is Less - Lines of Code, Project Complexity and Business Value »

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

May 15, 2010 | Unregistered CommenterKonstantin

There should not be trailing slash. This is what worked for me:

[extensions]
hgsubversion = D:\repos\hgsubversion\hgsubversion

May 15, 2010 | Unregistered CommenterKonstantin

Konstantin, thanks, I've added a note to the post!

May 18, 2010 | Registered CommenterRinat Abdullin

Please change it to exactly how Konstantin has it, with the nested hgsubversion directory.

May 27, 2010 | Unregistered CommenterAnonymous
Comments for this entry have been disabled. Additional comments may not be added to this entry at this time.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值