Search code examples
svnmergeconflictkdiff3

How to set kdiff3 as merge tool for SVN


I would like to be able to resolve conflicts using kdiff3, when SVN notifies me about the conflict. How can I set it as a default tool for this?


Solution

  • Go to the Subversion configuration file (/etc/subversion/config or ~/.subversion/config), and set merge-tool-cmd variable with your favourite tool:

    ### Set merge-tool-cmd to the command used to invoke your external
    ### merging tool of choice. Subversion will pass 4 arguments to
    ### the specified command: base theirs mine merged
    # merge-tool-cmd = merge_command
    

    Although there is a problem with kdiff3 which does not support four plain arguments (SVN passes four plain arguments to kdiff3, and it does not work), so it is usually called with a simple script to translate the arguments, e.g., "kdiff3caller":

    #!/bin/sh
    kdiff3 "$1" "$2" "$3" -o "$4"
    

    This kdiff3 problem and solution is explained here.