Friday, December 24, 2010

The AnkhSVN plug-in for Visual Studio

My department recently switched source control tools, moving from Microsoft's Visual Source Safe to Subversion.  We've been using the Windows Explorer-based Tortoise as a front-end, but we've been encountering difficulties with the lack of integration into Visual Studio.  For example, it's very easy to forgot to add new source files to the repository, often resulting in a broken build.

So I've started looking into VS plug-ins for SVN, and have been impressed with the open-source AnkhSVN.  It has a very attractive integration into the Solution Explorer, has Commit, Diff and Annotate/Blame features that display as VS window panes, and it automatically includes new solution files in the commit.  Overall, it appears to have been built with a great deal of care.  For example, the unmodified state is displayed with blue check marks, not green, because this is easier for color blind people to distinguish from red.    I've included some screen shots below the fold.

Setting up AnkhSVN is straight forward.  After installing the download, select Tools/Options, and then Source Control/Plug-in Selection.  Select AnkhSVN in the dropdown list.

If you open a solution that is already under Subversion control, it will automatically displayed as such by AnkhSVN.  If you are working on a solution that is not under source control, you can add it to Subversion by right-clicking on the project and selecting "Add Solution to Subversion".

Also, when creating a new Solution or Project, you have the option to include in Subversion.

Here is the basic layout of AnkhSVN.  The Solution Explorer now shows overlays indicating SVN status, and there is a Pending Check-ins box below, with a space for commit comments.
In Solution Explorer, the blue check mark indicates unmodified, red check mark indicates edited but not saved, and the red square means modified.


Let's see what happens when we add a class file. The file Class1.cs is automatically added to the SVN working copy, and is included in the commit prompt.   
The plug-in features integrate nicely into Visual Studio.  For example, here is the Annotate/Blame screen.  Note how it appears in the Source pane of Visual Studio.
There are still a number of places where Tortoise has the edge. For example, the revision history display does not allow you to grab a list of modified files, which can be very helpful for deployments.  Also, there is no revision graph feature.  So this is a very nice complement to the Tortoise SVN interface, but not yet a replacement for it.

1 comment:

  1. This comment has been removed by a blog administrator.

    ReplyDelete