Originally the question was "How do I configure WinMerge as the compare and merge tool for TFS". However, I am changing it because TehOne answered this more general form of the question.
I would have though this would have been asked already on Stackoverflow. I found the answer elsewhere, but I am asking/answering here. It's now a community wiki.
For SourceGear DiffMerge, you need to change the default command line to:
I found the parameters in this thread on the SourceGear support forums, as well as on James Manning's blog mentioned by @TehOne, but the arguments given there are incorrect and result in the auto-merge being executed in reverse, i.e. old code overwrites new code. The correct arguments are:
When I was looking for how to do this, I found this post to be invaluable: http://blogs.msdn.com/jmanning/articles/535573.aspx
The long procedure is provided in a Rory Primrose blog posting
The short answer is the argument list for compare is:
and the argument list for merge is:
Sometimes Winmerge does not return 0 and TFS will think the merge was canceled. You need to use the following wrapper batch file for merging:
And then you set the argument list to:
exit 0