[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: diff wish

From: Morten Kloster <morklo_at_gmail.com>
Date: Tue, 14 Jun 2011 19:53:59 +0200

On Tue, Jun 14, 2011 at 05:21:27PM +0200, Neels J Hofmeyr wrote:
> Hi Johan,
>
> it's been a while and I still haven't sent you my diff wish we briefly
> touched on the Subversion hackathon.
>
> Here is a fabricated example of why I don't like diff to match empty lines:

> A couple of lines get replaced by completely different ones. By matching the
> blank line in the middle, it becomes far less readable, IMHO. In my fantasy
> dream world, this diff would print:
>
> [[[
> Index: x
> ===================================================================
> --- x (revision 1)
> +++ x (working copy)
> @@ -4,11 +4,13 @@
>
> void aaa()
> {
> - if (x)
> - do(things);
> -
> - if (y)
> - do(stuff);
> + while (x || y)
> + {
> + check(something);
> + notify(stuff);
> +
> + try(somethingelse);
> + }
>
> bb(b);
> }
> ]]]

Actually, I was already planning on making the LCS algorithm estimate
how statistically significant each matching section is (just a simple
heuristic, of course, nothing mathematically exact) - I need this for the
proposals in my recent thread "Improvements to diff3 (merge)
performance" - and the standard diff could then take an option -noflukes
(for instance) which would only keep the significant matches. That
should eliminate (or at least reduce) both problems with blank lines and
similar issues with braces being matched in unrelated code.

Estimating the significance should be quite quick, so no worries there.

---
Morten
Received on 2011-06-14 19:54:33 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.