Is possible to change the default diff tool in Mercurial?

I've solved this using a Mercurial built-in extension... I just have to add the following lines to Mercurial.ini (on Mercurial folder):

[extensions]
hgext.extdiff=

[extdiff]
cmd.vdiff = kdiff3

When I want to use kdiff3 instead of diff I only have to use:

hg vdiff file.ext

With this config

[extdiff]
cmd.kdiff3 =

I use this command to see diffs:

hg kdiff

This shows a directory tree with all files that have changed. You click a file to see diffs for just the file. You may be able to add a file parameter to the command to just see one file.

More info here.


I just had this problem a few minutes ago; I just installed it and added its path (default is at c:\program files\kdiff3) to my system PATH e.v. Restarted my window to pick up the new path, and "hg kdiff3" just worked. As it turns out the following is in my base "mercurial.ini" file, this allows the kdiff3 to work for all hg repos on the system.

[extensions]  
hgext.extdiff =  

[extdiff]  
cmd.kdiff3 =

[merge-tools]  
kdiff3.args = $base $local $other -o $output

If you are looking for something like git difftool, where you don't need to type the filenames and see the diff for all changed files, add these to your ~/.hgrc, and run hg difftool.

[extensions]
extdiff =

[extdiff]
cmd.vimdiff = vimdiff

[alias]
difftool = !for file in $(hg status -n); do hg vimdiff $file; done

or for windows:

[alias]
difftool = !FOR /f %F IN ('hg status -nmar') DO hg vimdiff %F