Re: libxdiff and patience diff
- From
- Davide Libenzi <davidel@xmailserver.org>
- Date
- Nov 4, 2008, 03:17 UTC
- Message-ID
- <Pine.LNX.4.64.0811031904130.9116@alien.or.mcafeemobile.com>
- In-Reply-To
- <20081104004001.GB29458@artemis.corp>
On Tue, 4 Nov 2008, Pierre Habouzit wrote:
Show 30 quoted lines
> Hi Davide, > > I've been working tonight, trying to make libxdiff support the patience > diff algorithm, but I've totally failed, because I _thought_ I > understood what xdl_split was doing, but it appears I don't. > > > [ For the readers playing at home, the patience diff algorithm is > explained after my sig. ] > > > What I did is to: > (1) add a flag to the xenv in xdl_split that says that I want a > patience "split". > (2) Then in xdl_split, if that bit is set, I compute the longest common > subsequence from the patience diff. > (3) for each split it computes I call xdl_recs_cmp on that interval. > > > What I thought it would achieve is that I force some boundaries at which > libxdiff _must_ resync. Though, it seems that for some reason it doesn't > work, probably because the "ha" stuff and the boundaries absolutely > don't work the way I thought it did. > > So where is the place I should do that ? I suspect it should be > partly in xprepare.c but I'm a bit stuck right now. > > > Any pointer on how the stuff in xprepare.c and xdiffi.c work would help > greatly, it's really not self-evident to me :)
What makes you think it'd self-evident to me? :) Seriously, I forgot stuff I wrote the last month, this is way beyond my memory limits. You definitely need to look at xprepare.c, especially at xdl_trim_ends() and xdl_cleanup_records(). Lines are re-arranged in indexes, and this might screw up your logic if you're not prepared for it. What xdl_split() does, is find the start of an LCS and return the coordinate. Then xdl_recs_cmp() does the box reducing (first two "for" loops) and different-lines marking (first and second "if").
- Davide