[PATCH] Highlight word differences in diffs

Martin Geisler mg at lazybytes.net
Sat May 30 13:33:31 CDT 2009


Martin Geisler <mg at lazybytes.net> writes:

> # HG changeset patch
> # User Martin Geisler <mg at lazybytes.net>
> # Date 1243707986 -7200
> # Node ID 964cf1c47c0df37da99540b83a7aefed9b34a305
> # Parent  27cc4fa6722d97fa0d23bc990906d4d47ff43cff
> Highlight word differences in diffs

I forgot to update the commit message -- here are the changes.

> Things that are missing:
>
> * adjacent changes should probably be merged (like "_small_" and
>   "_paragraph_" above)

I now merge changed words together, and highlight them all in one go.

> * it is not clear if splitting on \W+ is the best choice

It wasn't, I don't know why I used that -- splitting on \s+ works much
better.

> * underlining can look funny, especially when a large amount of
>   inserted text is underlined

I've now made invert the default as suggested by Benoit. There are also
highlighters for GNU wdiff format, underline and HTML.

> * changes in the stuff between words is not highlighted. So if you
>   insert a comma, it wont be highlighted.

When splitting on whitespace this problem goes away.

> * this feature would look much better in hgweb...

Done with a simple style sheet change that colors the background
red/green.

> * probably some more :-)

It's probably still a bit hackish...

-- 
Martin Geisler

VIFF (Virtual Ideal Functionality Framework) brings easy and efficient
SMPC (Secure Multiparty Computation) to Python. See: http://viff.dk/.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://selenic.com/pipermail/mercurial-devel/attachments/20090530/a449fa27/attachment.pgp 


More information about the Mercurial-devel mailing list