Page 1 of 1

Using Code Compare as a merge tool for TFS 2010

Posted: Wed 14 Mar 2012 14:59
by Artem
We have received several feedbacks about bad impression of using Code Compare as a merge tool for TFS 2010. This is due to the fact that TFS does not perform automatic conflict resolution before handing it in a diff tool, and Code Compare at the moment can't do automatic merge. In connection with this, users are forced to resolve all the changes, and not only the conflict ones, manually. We have planned to implement automatic merge in the next version.

As a workaround, we wrote a special batch, which calls automatic merge before opening Code Compare. A disadvantage of using it will be the appearance of the console window. If you decide to use this solution, you should perform the following steps:
  1. Create a file with .bat extension with the following content:

    Code: Select all

    if not defined ProgramW6432 set ProgramW6432=%programfiles%
    "%programfiles%\Microsoft Visual Studio 10.0\Common7\IDE\diffmerge.exe" /merge /noprompt %1 %2 %3 %4
    "%ProgramW6432%\Devart\Code Compare\CodeMerge.exe" /TF=%1 /MF=%2 /RF=%4 /BF=%3 /TT=%6 /MT=%7 /SC=TFS
    exit /B 0
    
  2. Open the merge tool settings in Visual Studio: Tools -> Options -> Source Control -> Visual Studio Team Foundation Server -> Configure User Tools -> Add .*/Modify
  3. Specify the path to the batch file
  4. Specify the following arguments:

    Code: Select all

    %1 %2 %3 %4 %6 %7 %8 %9

%ProgramFiles% is the 32bit version by default

Posted: Fri 23 Mar 2012 13:48
by phenry
I'm trying this command line batch file out for the merge, but I found one small hiccup. The batch file is being run with x32 command line, which means the %ProgramFiles% env var gets evaluated to the wrong directory for where Code Compare is installed. I'm going to tweak to run the x64 ver, but is there a better way (ie get VS to run the x64 command line tool)?

Posted: Mon 26 Mar 2012 10:21
by Artem
On 64-bit Windows, specify %ProgramW6432% instead of %programfiles%, so the content of the batch file should be:

Code: Select all

"%programfiles%\Microsoft Visual Studio 10.0\Common7\IDE\diffmerge.exe" /merge /noprompt %1 %2 %3 %4 
"%ProgramW6432%\Devart\Code Compare\CodeMerge.exe" /TF=%1 /MF=%2 /RF=%4 /BF=%3 /TT=%6 /MT=%7 /SC=TFS
exit /B 0

Posted: Thu 19 Apr 2012 09:36
by StaffanW
This works great, but do you think you can either get it built into CodeCompare or at least have a way to let the installer set up the batch-file and settings?

Re: Using Code Compare as a merge tool for TFS 2010

Posted: Wed 20 Jun 2012 11:26
by Jorgen
Why wasn't automerge included in version 2.80 as promised?

Even with the batch file, merge is *really* bad in CodeCompare. I tried just now to merge a file which was marked with conflicts in CodeCompare with the batch file, but the changes which were not merged were totally incomprehensible, and the amount of code which needed to be merged in CodeCompare was 30-40 lines.

I disabled CodeCompare for merge completely and used Visual Studio's built in tool instead: ONE line of code had to be merged, the rest was handled automatically.

Re: Using Code Compare as a merge tool for TFS 2010

Posted: Wed 20 Jun 2012 14:32
by phenry
Unfortunately using this tool with tfs has also caused me more harm then relief and I've had to uninstall as well. :< Sorry guys, LOTS of potential, but when push comes to shove, I can't trust the output. Email me when things change and I'll re-evaluate.

Re: Using Code Compare as a merge tool for TFS 2010

Posted: Thu 21 Jun 2012 11:46
by Artem
Unfortunately, due to time constraints we were forced to exclude automatic merge from the list of improvements in version 2.80. Earlier it was planned that the auto merge would perform actions similar to the running by the above batch, so if you see any inconvenience in usage of this temporary solution, then please speak up in this topic. Examples with screenshots and description of the problem would be very useful.