26

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.

Community
  • 1
  • 1
Justin Dearing
  • 14,270
  • 22
  • 88
  • 161

3 Answers3

33

When I was looking for how to do this, I found this post to be invaluable: http://blogs.msdn.com/jmanning/articles/535573.aspx

TehOne
  • 2,569
  • 3
  • 26
  • 36
  • 1
    Your answer made me change the question and make it a community wiki. – Justin Dearing Aug 23 '09 at 20:46
  • 1
    Glad I could be of help, but the real credit of course goes to James Manning for that blog post of his. It really helped me out. I can't stand the built in tools of VSS/TFS. So, being able to use my already installed Beyond Compare is great. Thanks for making this a wiki for everyone to refer back to later. – TehOne Aug 24 '09 at 16:59
  • The parameters he uses for SourceGear DiffMerge are incorrect. The correct parameters can be found [here](http://stackoverflow.com/a/17523972/7850) – Shaul Behr Jul 10 '13 at 15:00
12

The long procedure is provided in a Rory Primrose blog posting

The short answer is the argument list for compare is:

/x /e /ub /wl /dl %6 /dr %7 %1 %2

and the argument list for merge is:

/x /e /ub /wl /dl %6 /dr %7 %1 %2 %4

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:

@rem winmergeFromTFS.bat
@rem 2007-08-01
@rem File created by Paul Oliver to get Winmerge to play nicely with TFS
@rem
@rem To use, tell TFS to use this command as the merge command
@rem And then set this as your arguments:
@rem  %6 %7 %1 %2 %4
"C:\Program Files\WinMerge\WinMerge.exe" /x /e /ub /wl /dl %1 /dr %2 %3 %4 %5
exit 0

And then you set the argument list to:

%6 %7 %1 %2 %

exit 0

Justin Dearing
  • 14,270
  • 22
  • 88
  • 161
0

For SourceGear DiffMerge, you need to change the default command line to:

C:\Program Files (x86)\SourceGear\Vault Client\sgdm.exe

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:

/m /t1=%6 /t2=%7 /t3=%8 /c=%9 %1 %3 %2 /r=%4

Shaul Behr
  • 36,951
  • 69
  • 249
  • 387