Differences between revisions 5 and 6
Revision 5 as of 2008-10-13 00:59:59
Size: 3554
Editor: TomBa
Comment: path to kdiff3 on Mac
Revision 6 as of 2008-10-19 14:55:15
Size: 3609
Comment: Make ThurnerRupert's bad experience less frightening ;-)
Deletions are marked like this. Additions are marked like this.
Line 52: Line 52:
 * '''Settings / Configure Kdiff3... / Directory Merge / Dir-anti-pattern(s)''': append: {{{;.hg}}}
 * '''Settings / Configure Kdiff3... / Directory Merge / File-anti-pattern(s)''': append: {{{;*~}}}
 * '''Settings / Configure KDiff3... / Directory Merge / Dir-anti-pattern(s)''': append: {{{;.hg}}}
 * '''Settings / Configure KDiff3... / Directory Merge / File-anti-pattern(s)''': append: {{{;*~}}}
Line 66: Line 66:
 * destroys binaries while merging: so choose "whole file" as a workaround  * Will try to merge binaries if you tell it to - so configure your merge-tools properly (or choose "whole file" as a workaround)

KDiff3

This is a subjective evaluation of KDiff3. Please add your opinion.

Description

[http://kdiff3.sourceforge.net/ KDiff3] is a KDE / QT graphical merge and diff tool. For 3-way merge it can show both the 2 parent versions and their common ancestor side-by-side in top panes and the editable merge result in the bottom pane.

It is GPL and runs on "all" platforms. It is included in the TortoiseHg installer for Windows.

KDiff3 as [http://sourceforge.net/projects/kdiff3 project] seems stale but stable.

Usage notes and tips

  • The option --auto will try to auto-merge silently, similar to what Mercurial premerge does. Disabling Mercurial premerge will not disable kdiff3 auto merge.

  • KDiff3 can be used with kdiff3.args=--L1 base --L2 local --L3 other $base $local $other -o $output

  • One change has focus at a time; the currently selected change is yellow-ish - move with up/down triangle buttons or use ctrl+up/down.
  • The 3 input files are labelled A, B and C, and appearance of the 3 sides of a change in the merge result can be toggled with buttons or ctrl+1/2/3.
  • The margin of the merge result shows where the lines come from (or m for manual changes).
  • Usage example in [http://hgbook.red-bean.com/hgbookch3.html hgbook].

More tips

Add to ~/.hgrc:

[extensions]
hgext.extdiff =

[extdiff]
cmd.kdiff3 =

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

This adds a new graphical diff command hg kdiff3 (using ExtdiffExtension), and tells Mercurial to use kdiff3 for merges.

Useful shortcuts that can be defined in Settings / Configure Shortcuts:

  • Ctrl-U: Unfold All Subdirs
  • Ctrl-T: Dir & Split Screen View (on/off)

You can move between file panes and directory pane using Alt-Left and Alt-Right.

You can compare arbitrarily selected files. Click on left square of old file, and "A" appears in the square. Click on right square of new file, and "B" appears in the square. Right-click on the "B", and select "Compare Explicitly Selected Files".

If you want to view some file in your favorite editor (e.g., to get usual syntax highlighting, and large window), you can copy-and-paste file name at the top of the file window pane, and open it in your editor. All other modified or added files are in the same directory, so you can just navigate to them from your editor instead of selecting them in kdiff3 and repeating cut-and-paste. (In order for this to work, don't use the --L1 base --L2 local --L3 other described in earlier section.)

When you run kdiff3 directly, the following may help when comparing two source trees:

  • Settings / Configure KDiff3... / Directory Merge / Dir-anti-pattern(s): append: ;.hg

  • Settings / Configure KDiff3... / Directory Merge / File-anti-pattern(s): append: ;*~

Mac

On Mac, kdiff3.app executable location is /Applications/kdiff3.app/Contents/MacOS/kdiff3. Make sure you add /Applications/kdiff3.app/Contents/MacOS to your $PATH, or create a symlink from a directory in your $PATH to /Applications/kdiff3.app/Contents/MacOS/kdiff3 (or create a wrapper script, or ...), if you want to invoke kdiff3 from command line or from Mercurial invoked from command line.

Issues

  • Will try to merge binaries if you tell it to - so configure your merge-tools properly (or choose "whole file" as a workaround)
  • Doesn't look fancy
  • QT and KDE dependencies

Conclusion

KDiff3 is the "best" merge tool; stable and feature rich.

KDiff3 (last edited 2020-11-11 10:23:21 by aayjaychan)