Sometimes it’s convenient to be able to view modifications to a file in a file difference GUI on a Windows machine on which it is undesirable to install TortoiseSVN. Here’s a way to do it…
Have a GUI based file difference tool, such as WinMerge installed.
Create a batch file as follows. Call it, for example <winmerge_svn.bat>.
@echo off if "%1" == "" ( goto :EOF ) setlocal set bname="BASE" set yname="%~nx1" set base="%~dp1.svn\text-base\%~nx1.svn-base" set mine="%~dpnx1" "C:\Program Files\WinMerge\WinMergeU.exe" /wl /e /x /ub /dl %bname% /dr %yname% %base% %mine%
The flags used here are
- /wl : left read only [important: to ensure no changes can be made to SVN’s internal file]
- /e : let WinMerge close with ESC [optional]
- /x : close WinMerge if left = right [optional]
- /ub: don’t add the paths to MRU (most recently used) [optional]
- /dl lefttitle : description for left
- /dr righttitle : description for right
Locate that file in, for example,
Then create a registry file <winmerge_svn.reg> containing, for example,
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\*\shell\WinMerge_SVN] @="WinMerge SVN Diff" [HKEY_CLASSES_ROOT\*\shell\WinMerge_SVN\Command] @="\"C:\\Utilities\\WinMerge_SVN\\winmerge_svn.bat\" \"%1\""
When this is loaded into the registry (by double-clicking on the file icon), a new entry
WinMerge SVN Diff
will appear in the context menu (right-click) for files.
Now there’s one minor problem with this: whilst the WinMerge GUI is open, there is also a blank Command Window open; that closes automatically when the WinMerge GUI closes, and that window may also be closed manually beforehand.
I have tried to lose or minimise this window with combinations of:
- call filename.bat
- cmd /C command
- start /B command
- start /MIN command
- use of *.lnk files (shortcuts) with a Run Minimised property
but without success. My problem could simply be one of getting the exact syntax, or nesting, of these just right. Please let me know if you know how to do this.