MS Office file diff under TFS
Asked Answered
H

3

11

When you compare two versions of MS Word doc/Excel book in Team Foundation Server Source Explorer, the result is the boring "Binary filles differ" dialog.

It does not have to be that way though. The relevant apps (Word/Excel) have an excellent built-in diff interface. You can witness it when you work with versioning-enabled SharePoint file library and do compare with a previous version. Also, TortoiseSVN brings it up when you do diffs.

Question - can I enable this in TFS?

Hierolatry answered 10/5, 2011 at 20:4 Comment(0)
L
10

You can configure comparison (diff) and merge tools per file type (extension). This is available via Tools -> Options -> Source Control -> Visual Studio Team Foundation Server -> Configure User Tools" button or via the command-line with tf diff /configure

In order to set up a comparison tool, you'll specify the extension (use .* if you want it to be used for all files not otherwise specified), the operation you're setting up (Compare or Merge), the command to invoke and the arguments to the command. For arguments, the variables available for use are the following:

%1 = Original file (in diff, the pre-changes file, in merge, the "server" or "theirs" file, the file that is the base file after "their" changes were applied)
%2 = Modified file (in diff, the post-changes file, in merge the "yours" file - the base file with "your" changes applied)
%3 = Base file (in the 3-way merge operation, the file which both "theirs" and "yours" are derived from - the common ancestor.  This doesn't mean it's the version the changes were based from, since this may be a cherry-pick merge)
%4 = Merged file (The output file for the merge operation - the filename that the merge tool should write to)
%5 = Diff options (any additional command-line options you want to pass to your diff tool - this comes into play only when using "tf diff /options" from the command-line)
%6 = Original file label (The label for the %1 file)
%7 = Modified file label (The label for the %2 file)
%8 = Base file label (The label for the %3 file)
%9 = Merged file label (The label for the %4 file)

To use TortoiseSVN -- which seems like it does what you want -- you would specify the command as the file path to TortoiseMerge.exe

For comparisons, specify the arguments: /base:%1 /mine:%2 /basename:%6 /minename:%7

For merges, specify the arguments: /base:%3 /mine:%2 /theirs:%1 /basename:%8 /minename:%7 /theirsname:%6 /merged:%4 /mergedname:%9

This and other information on the arguments for various merge tools (including other word comparison tools like DiffDoc.exe) can be found on James Manning's MSDN blog. You may also find use in another stackoverflow question on invoking the word comparison tool from the command line.

Linzer answered 10/5, 2011 at 22:16 Comment(3)
I saved a copy of diff-doc.js to a directory for use as the Command and gave it the arguments "%1 %2". Works great.Castorina
Just to expand on what @DanielBallinger said, there are actually scripts for a number of file formats (Word, Excel, Powerpoint, exe/dll etc) here.Agueweed
Just tried to find the scripts mentioned by @Agueweed - but as they've moved from code.google.com - they can now be found at svn.osdn.netRevealment
N
1

You can also use WinMerge + xdocdiff plugin in TFS, apply these two steps:

  1. Associate WinMerge with VS-TFS: http://manual.winmerge.org/Version_control.html#d0e9669

  2. Enable xdocdiff plugin in WinMerge: http://freemind.s57.xrea.com/xdocdiffPlugin/en/index.html

This way, you will also be able to use all file types that xdocdiff supports.

Nip answered 2/9, 2016 at 9:15 Comment(0)
A
1

The best way now I thought is to use MS Word compare which is much better than other doc diff tools (MS word native support compare except merge). By using a powershell script which is provided by (https://github.com/ForNeVeR/ExtDiff), you can trigger the MS word compare function insde TFS compare. In order to solve the PS execution policy issue, you need to alter the content in diff-word.cmd by adding "-ExecutionPolicy Bypass". After introudce the "diff-word.cmd" for .docx compare, it works very well.

Ariana answered 4/4, 2020 at 8:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.