Blog of Keith Craig, containing my thoughts, comments and questions. RSS Feed


Using WinMerge with Microsoft Team System

I like Microsoft's Team System for source control--I especially love the shelving functionality, that has gotten my agile team out of some complex little workflow tangles. However, I'm not such a fan of some of the client-side tools.

One of my least favorite tools in Team System is the diff tool. The things I really dislike about it are:

  • It won't show me the specific differences in a long line--it simply highlights the entire line. This is surprisingly annoying for long lines of code where you know something is different because the line is highlighted (and therefore the tool knows what the difference is but won't tell me!) Given this, you have little choice but to visually scan each version of the line character by character to try to notice differences--and hope you don't miss anything! Forgive me, but isn't this what the diff tool was supposed to do?!
  • You cannot change the font size. Given that the split-pane display effectively divides the monitor into two halves, I'd really like to use a smaller font size to allow more text to be visible in the panes, but this isn't possible, which is a surprising limitation.

Here's a sample screenshot of the diff tool from Team System exhibiting these issues:

Standard diff tool from Team System, with large font and no diffs inside a line

Note that on line 307, it's not immediately clear what has changed in the method signature: partially because only the line is highlighted, and partially because the font is so large that the whole line cannot be seen without horizontal scrolling.

Given these issues, I looked into other diff tools. To its credit, Team System is fully extensible in terms of merge and diff tools. James Manning of Microsoft has a great post describing how to configure Team System with a different merge or diff tool. Another nice touch is that you can independently configure the diff and merge tools--I haven't found a better merge tool yet, but I do like WinMerge better for diff. (One of my criteria is perhaps a bit unfair, but I wanted something that was no cost to use.) Since I diff much more frequently than merging, a better diff tool is a clear win for me.

Specifically, the things I like about WinMerge are:

  • It highlights the differences within the line rather than the whole line--this makes looking at diffs much easier, because the tool is actually doing much more of the work.
  • It has a cool "Diff Pane" at the bottom of the window that displays a full-width version of the currently selected difference block--again, this makes things so much faster than having to horizontally scroll back and forth for each change.
  • I can change the font to something a bit smaller to fit more code on the monitor (it's the little things sometimes!)

Here is the same diff as above in WinMerge:

WinMerge diff tool, with smaller font, diffs within a line, and handy full-window-width Diff Pane

Note that the Diff Pane at the bottom allows you to see the currently highlighted difference at the full window width--I cannot say how useful this is in everyday work. In addition, notice that the coloring in the Diff Pane makes it very clear that the only part of the line that changed was the method visibility (private changed to public.) Again, this makes it much less likely that you miss some other change, and it saves a lot of mental work to manually diff the characters yourself.

 

Configuration

So how do you configure it? It's fairly well explained in the blog post above, but here are some screenshots of how I set mine up. In Visual Studio 2005, first click Tools, then Options to bring up the Options dialog:

Visual Studio 2005 Options dialog, showing Source Control: Visual Studio Team Foundation Server property page

On the tree control on the left, expand Source Control, and then click Visual Studio Team Foundation Server. Click Configure User Tools... to display the Configure User Tools dialog:

Configure User Tools dialog without any rows (default setting to use Team System diff and merge tools)

As the Team System tools are the default, nothing is shown in this dialog. Click Add... to display the Configure Tool dialog to add a custom tool mapping:

Configure Tool dialog (initial unpopulated state)

Fill this out for WinMerge according to the post above. It should look something like this when complete:

Configure Tool dialog populated with WinMerge configuration

Click OK, and the Configure User Tools dialog will now show that WinMerge is configured for Comparison (diffs):

Configure User Tools dialog with WinMerge configured to diff

Click OK, and then OK to complete the setup.

Note that the blog post above includes a long list of both merge and diff tools--you may want to do a bit of experimenting to see what works best. Note that a certain amount of caution should be exercised, especially with the merge tool, as an unfamiliar merge tool could be used incorrectly and create a lot of chaos!

 
Posted by Keith Craig | 4 Comments | Trackback Url | Bookmark with:        
Tags:

Links to this Post

Comments

Thursday, 8 May 2008 11:47 by Merges
To set up for a merge, it's the same command only with %4 tacked on at the end for the output file.

Wednesday, 17 Dec 2008 02:39 by Manuel
Thanks for the tip!

Friday, 20 Feb 2009 05:06 by Manuel
Put -e to the commandline parameters to close WinMerge with the ESC key.

Tuesday, 24 Feb 2009 06:46 by Sylvain
Great tip ! WinMerge does only one thing, but it does it very well. Thanks.

Name:
URL:
Email:
Comments:

CAPTCHA Image Validation