matlabmercurialsimulinkmercurial-extension

Mistake in Mercurial Extdiff Configuration?


I use Mercurial with the Extdiff extensions to diff Simulink (.slx) files with Mathworks' diff tool. To setup the Extdiff extension I followed the instructions on this website. Diffing Simulink (.slx) files works really great.

However (and this not at all great) since I set up the extdiff extension, not only Simulink files are diffed with the Mathworks' tool, but also classical Matlab files (.m).

I don't want that, as the Mathworks' diff tool is a bit limited and Matlab files are (they are pure text files) can be easily diffed with Mercurial's standard diff tool.

Below you find my mercurial.ini. As you can see, it's configured to use extdiff for .slx-files. However there is no setting setting for .m-files.

# Generated by TortoiseHg settings dialog

[tortoisehg]
confirmaddfiles = True
confirmdeletefiles = True

[ui]
username = myname

[extensions]
largefiles = 
extdiff = 

[extdiff]
# Simulink
slxdiff = matlab -wait -nodesktop -r \"disp(\'Starting visdiff, please wait (even after the prompt appears).\');visdiff(\'$parent\',\'$child\')\"

[diff-patterns]
**.slx = slxdiff

So, the question is:

How do I need to change my configuration to diff .slx files with Mathworks' diff tool and Matlab files with Mercurial's standard diff tool?


Solution

  • Finally I've found a solution. By adding a diff-pattern for m-files I could force kdiff for m-files.

    [diff-patterns]
    **.slx = slxdiff
    **.m  = kdiff3
    
    [extdiff]
    # Simulink
    slxdiff = matlab -wait -nodesktop -r \"disp(\'Starting visdiff, please wait  (even after the prompt appears).\');visdiff(\'$parent\',\'$child\')\"
    kdiff3.args = $base $local $other -o $output