Using Mercurial with Visual Studio

Thursday, January 28, 2010 – 4:56 AM

Mercurial ships as a command line tool. Here are some UI based tools to make it work that much better on Windows and in Visual Studio.

TortoiseHg – A Windows Explorer integration for Mercurial (You can download the latest versions of Mercurial and TortoiseHg from the Mercurial site)

HgScc – A source code control package for Visual Studio. This seems to be under pretty active development with versions for VS 2008 and VS 2010 Beta. It supports most of the features you’d expect from a SCC provider; project item state flagging and commit menu items etc.

TortoiseSVN’s TortoiseMerge – I sort of grew to like TortoiseMerge during my time using Subversion so I’m still using that as my diff’ing tool. You can configure both HgScc and TortoiseHg to use this for diff’ing.

Here’s the Mercurial.ini file I use:

[ui]
username = My Name <me@mydomain.com>
editor = "C:\Program Files (x86)\Notepad 2\notepad2.exe"
merge = tortoisemerge
 
[extdiff]
tortoisemerge="C:\Program Files\TortoiseSVN\bin\TortoiseMerge.exe"
 
[merge-tools]
tortoisemerge.executable="C:\Program Files\TortoiseSVN\bin\TortoiseMerge.exe"
tortoisemerge.args=/base:$base /mine:$local /theirs:$other /merged:$output
tortoisemerge.regkey=Software\TortoiseSVN
tortoisemerge.checkchanged=True
tortoisemerge.gui=True
 
[tortoisehg]
vdiff = tortoisemerge
vdiffnowin = True
 
That’s about it. Thus far this seems to give me a pretty good experience within Visual Studio

I also looked at VisualHG but found it to be very unstable. It would hang the IDE. See the following bug thread (which is marked fixed but I still see this behavior when building).

  1. 9 Responses to “Using Mercurial with Visual Studio”

  2. Do TortoiseSVN and TortoiseHg play nice together?

    By Al Gonzalez on Jan 29, 2010

  3. Al,

    They seem to. I have them both installed and don’t seem to get any conflicts. Although I’ve not tried to do anything daft, like attempt to use SVN from within an HG repo of vis-versa.

    Ade

    By Ade Miller on Jan 29, 2010

  4. Ade,
    Thanks for the quick response. That’s what I was hoping for, and if I do something daft then I deserve what I get ;)

    Now to figure out if I can live with Mercurial not handling empty directories.

    By Al Gonzalez on Jan 29, 2010

  5. Thanks a lot for your overview of Mercurial tools for Visual Studio. I usually develop software on linux-based systems and use git for version control, but a new project is requiring that I use Visual Studio and a slightly more “friendly” VCS. Going to give HgScc a try! :)

    By Matt on Feb 9, 2010

  6. How does HgScc compare with VisualSVN?

    By Oliver Smith on Apr 12, 2010

  7. Oliver,

    They’re very similar, although really the differences are more to do with SVN vs. Hg differences.

    Ade

    By Ade Miller on Apr 14, 2010

  1. 3 Trackback(s)

  2. Jan 29, 2010: Tweets that mention Using Mercurial with Visual Studio | #2782 - Thinking about agile (small 'a') software development, patterns and practices for building Microsoft .NET applications. -- Topsy.com
  3. Mar 10, 2010: links for 2010-03-10 « dstelow notes…
  4. May 5, 2010: opinions… » Working with Mercurial and Visual Studio.

Sorry, comments for this entry are closed at this time.