Export (0) Print
Expand All

Associate a File Type with a Merge Tool (Team Explorer Everywhere)

Visual Studio 2010

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

Required Permissions

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.

Required Arguments

Token

Description

%1

The path of the server version of the file (the original file)

%2

The path of your modified version of the file (the local file)

%3

The path of the baseline common ancestor of these two files (the common file)

%4

The path of the resultant merged file

Optional Arguments

Token

Description

%5

Diff command-line options

NoteNote
This token is not used but is retained for compatibility with the Visual Studio client for Visual Studio Team Foundation Server.

%6

Label for the server file

%7

Label for the local file

%8

Label for the baseline common ancestor file

%9

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

  1. On the Window menu, click Preferences.

    The Preferences dialog box appears.

  2. 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.

  3. Click Add.

    The Add External Merge Tool dialog box appears.

  4. 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.

  5. 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.

  6. Click OK to add the merge tool.

  7. 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

Community Additions

ADD
Show:
© 2015 Microsoft