winmerge icon indicating copy to clipboard operation
winmerge copied to clipboard

Used as merge tool: 3-way compare shows no syntax hilighting

Open Darkums opened this issue 4 months ago • 1 comments

Command line:

WinMergeU.exe /e /ub /fm /wl /wr /dl %tname /dm %bname /dr %yname %theirs %base %mine /o %merged /am

Options provided /fileext file-extension

Problem SVN client doesn't support file extension passing

Possible resolution Automatic syntax highlighting detection - all files compared have extensions

Darkums avatar Sep 12 '25 11:09 Darkums

Currently TortoiseSVN (and other SVN clients) do not support passing the file extension to external merge tools, so /fileext cannot be used directly.

As a workaround you can wrap the WinMerge invocation in a batch file that extracts the extension from the /o %merged argument and forwards it to WinMerge.

Example:

@echo off
setlocal enabledelayedexpansion

set merged=

:loop
if "%~1"=="" goto after_loop

if /i "%~1"=="/o" (
    set merged=%~2
)
shift
goto loop

:after_loop
if defined merged (
    for %%F in ("%merged%") do (
      set ext=%%~xF
      set "ext=!ext:~1!"
      "C:\Program Files\WinMerge\WinMergeU.exe" %* /fileext !ext!
    )
) else (
    echo /o not found
)

sdottaka avatar Sep 13 '25 22:09 sdottaka