2
votes

I am attempting to diff two files in svn and see the side by side differences in winmerge as described in this post.

However when I try to do that Winmerge opens but complains that the file paths are invalid. It appears that svn diff outputs files in a temp folder then deletes them before WinMerge can open them. Is there a workaround for this?

Console output:

C:\blah>svn diff -r 14055:14056 web.xml
Index: web.xml
===================================================================

C:\blah>start "WinMerge" /B "C:\Program Files (x86)\WinMerge\WinMergeU.exe" /e /s /ub /dl "web.xml      (revision 14055)" /dr "web.xml(revision 14056)" C:\Users\standeph\AppData\Local\Temp\svn-E6927443 C:\Users\standeph\AppData\Local\Temp\svn-E69F9C4A

Winmerge gui: enter image description here

2

2 Answers

0
votes

See "Using WinMerge with other tools". The command-line you should run looks like

svn diff --diff-cmd "C:\Program Files\WinMerge\WinMergeU.exe" -x "-dl -dr" myfile

(See --diff-cmd option description in SVNBook).

or configure [helpers] section in client's runtime configuration area to launch WinMerge by default:

[HKEY_CURRENT_USER\Software\Tigris.org\Subversion\Config\helpers]
"#diff-cmd"=""
"#diff-extensions"="-u"
"#diff3-cmd"=""
"#diff3-has-program-arg"=""
"#editor-cmd"="notepad"
"#merge-tool-cmd"=""

Read SVNBook!

0
votes

The problem is that START runs WinMerge in a background process and returns control back to SVN before WinMerge is fully loaded. SVN thinks it's job of displaying a diff is done and deletes all temporary files it created for the diff. By the time WinMerge is ready the files it is supposed to display are already gone.

There are two possible workarounds.

Don't start WinMerge in the background:

"C:\Program Files (x86)\WinMerge\WinMergeU.exe" /e /s /u /wr /dl %3 /dr %5 %6 %7

However now you cannot use your shell anymore until you close WinMerge.

Load copies of temporary files:

For that you have to add more logic to your diff-cmd script. Here's an example:

@echo off
set lpath=%6
set rpath=%7

if /i not %lpath:C:\Temp\svn-=%==%lpath% (
    copy /y %lpath% %lpath%.bak 1> NUL
    set lpath=%lpath%.bak
)

if /i not %rpath:C:\Temp\svn-=%==%rpath% (
    copy /y %rpath% %rpath%.bak 1> NUL
    set rpath=%rpath%.bak
)

start "WinMerge" /B "C:\Program Files (x86)\WinMerge\WinMergeU.exe" /e /s /u /wr /dl %3 /dr %5 %lpath% %rpath%

This will backup any files that are in C:\Temp\ and load the backups instead.