Differences between revisions 7 and 8
Revision 7 as of 2018-08-02 16:00:28
Size: 1180
Revision 8 as of 2018-08-02 16:05:33
Size: 1184
Deletions are marked like this. Additions are marked like this.
Line 22: Line 22:
Default colors are defined in Source:mercurial/color.py Default colors are defined in [[Source:mercurial/color.py]]

Using diff.word-diff config option (4.7+)

Since Mercurial 4.7 word diff is in core. To enable it, put this in your ~/.hgrc:

word-diff = true

It's also enabled by ui.tweakdefaults.

To configure word diff colors/styles:

diff.deleted.changed = ...
diff.deleted.unchanged = ...
diff.inserted.changed = ...
diff.inserted.unchanged = ...

Default colors are defined in mercurial/color.py

Using extdiff extension

Making a word difference using the ExtdiffExtension and GNU wdiff, somehow what git diff --color-words does.


  1. Download cwdiff, a shell script, which wraps wdiff to support directories and colorizes the output.

  2. Enable ExtdiffExtension (in ~/.hgrc):

  extdiff =
  1. Add wdiff command (in ~/.hgrc):

  # if cwdiff is in your path, otherwise set to wherever you've installed cwdiff
  cmd.wdiff = cwdiff
  #add --no-color below, if you dislike colors!
  opts.wdiff = --diff --ab
  1. Run

$ hg wdiff

WordDiff (last edited 2018-08-02 16:05:33 by AntonShestakov)