There are plenty of posts about configuring alternative diff/merge tools to use with Team Foundation Server. The one I liked the most is http://blog.iannelson.systems/tfs-alternative-diff-merge-tools/ by Ian Nelson, who shows with nice screenshots HOW to change the TFS tools, and also includes a link to another post that explains the order in which the parameters are passed.
Putting together both posts I arrived at my current configuration to launch ediff when running compares from TFS:


The little helper ediff.bat lives in my command line "binaries" folder (so it’s part of PATH) and its contents are pretty straigthforward:
@echo off set command=%1 set original=%2 set original=%original:\=\\% set original=%original:"=\"% set modified=%3 set modified=%modified:\=\\% set modified=%modified:"=\"% :compare c:\HomeFolder\emacs\bin\emacsclientw -c -n -e "(ediff-files %original% %modified%)" goto exit :merge set ancestor=%4 set ancestor=%ancestor:\=\\% set ancestor=%ancestor:"=\"% set output=%5 set output=%output:\=\\% set output=%output:"=\"% c:\HomeFolder\emacs\bin\emacsclientw -c -n -e "(ediff-merge-with-ancestor %original% %modified% %ancestor% nil %output%)" goto exit :exit
Dissecting this, at first we have some string replace to escape the paths (\ becomes \\). As per the MSDN blog article, the paths are already quoted. Then through the -e parameter of emacsclientw we use elisp start ediff, for just a compare or merging. The list of entry points for ediff are in the Emacs manual. You can also find a copy of the batch file in my Emacs configuration repository, but the above is all there is to it.
I figure an alternative would be an elisp funcion that you invoke and does the conversion of the strings to paths and then starts ediff. But since I already had some experience with batch files replaces, I just went with this approach.
Bonus! there are two configuration options that make this smoother:
-
ediff-highlight-all-diffs: set to t to highlight the char-to-char differences instead of just blocks.
-
ediff-keep-variants: if you set this to nil, when quitting the ediff session you will be prompted to closed the buffers you just compared.