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:
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:
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:
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:
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:
Fill this out for WinMerge according to the post above. It should look something like this when complete:
Click OK, and the Configure User Tools dialog will now show that WinMerge is configured for Comparison (diffs):
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!