Associate a File Type with a Merge Tool (Team Explorer Everywhere)
You can specify one or more tools that you want to use to merge version conflicts. When a conflict occurs, you can use the local version or the server version. If changes were not made to the same line of the file, you can use the Automerge command to resolve the conflict. You can resolve version conflicts by using a tool that is built in to Eclipse, or you can configure one or more external merge tools.
For more information about how to resolve conflicts between files, see Resolve Conflicts between Two Files (Team Explorer Everywhere).
In this topic
To perform this procedure, you must be a member of the Administrators or Users security group on the computer where Team Explorer Everywhere is installed.
External tools must meet the following criteria to enable you to use them with Team Explorer Everywhere:
The tool must accept four arguments: the left and right input files, the common ancestor, and the merge output file. File names must be specified as full paths.
The tool must return zero when the conflicting files have been successfully merged and the merge result has been accepted.
In addition to the four required arguments, the tool may accept other arguments. For example, it might accept labels. The arguments are presented as "tokens" in the configuration, which Team Explorer Everywhere will replace before the external merge tool is called.
Arguments for external merge tools are delimited by white space unless you enclose them in quotation marks (“”). To embed a quotation mark inside a quoted string, use two quotation marks. For example, you could specify the following argument:
"This "" embeds a double quote"
Tokens are implicitly enclosed in quotation marks before they are passed to the shell. Therefore, you do not have to wrap % tokens in quotation marks.
The path of the server version of the file (the original file)
The path of your modified version of the file (the local file)
The path of the baseline common ancestor of these two files (the common file)
The path of the resultant merged file
Diff command-line options
This token is not used but is retained for compatibility with the Visual Studio client for Visual Studio Team Foundation Server.
Label for the server file
Label for the local file
Label for the baseline common ancestor file
Label for the merged file
The following procedure describes how to configure an external merge tool in the Team Foundation Server plug-in for Eclipse. You can also configure an external tool for use with the tf difference command. For more information, see Configure an External Program to use with tf difference.
To configure an external merge tool in the Team Foundation Server plug-in for Eclipse
On the Window menu, click Preferences.
The Preferences dialog box appears.
Expand the Team node, expand the Team Foundation Server node, and then click Merge Tools.
In the results pane, a list of the configured external merge tools appear. By default, no external merge tools are configured.
The Add External Merge Tool dialog box appears.
In File Types, specify the file name extensions for which you want to use this merge tool.
You can specify multiple extensions, separated by commas. You can also use the wildcard character (*) to indicate that you want to use this merge tool for all files.
In Command, specify the command line for the merge tool that you want to use.
This command line includes the path of the merge tool and the arguments that you want to use with it. You can click Browse to specify the merge tool.
For example, to specify the MyDiff tool for Java files, you might specify the following command line:
C:\Program Files\MyDiff\mydiff.exe %3 %2 %1 –o %4
MyDiff also enables you to specify labels for each file. If you do not specify the labels, MyDiff will show the names of temporary files, whose names are difficult to read.
To provide labels, specify the following command line:
C:\Program Files\MyDiff\mydiff.exe %3 %2 %1 –o %4 --L1 %8 --L2 %7 --L3 %6
In this syntax, %8 specifies the label for file %3, %7 specifies the label for file %2, and %6 specifies the label for file %1.
Click OK to add the merge tool.
Click OK to close the Preferences dialog box.
If your merge tool does not meet the required conditions, you may still be able to use it with Team Explorer Everywhere by creating a wrapper script.
For example, the merge tool xxdiff does not meet either condition for use. The tool does not accept the full path of the merge output file, and it writes the output to the current directory. This tool also returns 0 if the versions were identical, 1 if the versions differed, and 2 if an error occurred. You can work around these issues by creating a wrapper script that changes the current directory to the location to write the merge output file and that returns 0 if the exit code was either 0 or 1.
The following sh shell script can enable you to use xxdiff:
#!/bin/sh DIR=`dirname $4` FILE=`basename $4` cd $DIR && /usr/local/bin/xxdiff $1 $2 $3 -M $FILE if [ $? = 0 -o $? = 1 ]; then exit 0 fi exit $?
After you have saved this shell script and made it executable, you can configure Team Explorer Everywhere to use xxdiff as an external merge tool. In Command, specify the path of the shell script that you created, and set the arguments to the following string:
%1 %2 %3 %4