[darcs-users] What if darcs is generating too inclusive of hunks?

Yuval Kogman nothingmuch at woobling.org
Sun Nov 12 17:11:21 UTC 2006


On Sun, Nov 12, 2006 at 15:47:00 +0000, Jamie Webb wrote:

> I suspect your hand-typed version is not quite correct: I think both
> subs start with the line 'my $self = shift'. When Darcs encounters
> that line in the new function, it matches it up with the existing
> identical line.

Both are "correct" in that sense (i did have a small erro, as David
noted). However, the OP mentioned that sometimes the algorithm
behaves in a way which is suboptimal, even if correct. I wouldn't
have complained unless the OP implied that svn et al somehow know to
do this better ;-)

> Darcs knows nothing about program structure, and so
> doesn't know that it's moved the existing line into a different
> function. Either set of edits look equally good, and it has no way of
> knowing that you'd prefer the latter.

Of course, I don't expect it to, but a "retry diffing" option in the
interactive mode could be nice, whereby some parameters are cycled
and the LCS is redone.

That way I could choose the patch that best describes the high level
change from a list of possibilities, or even manually tweak the
patch.

> Whether Darcs can be taught is another matter. It might help if the
> diff algorithm at least favoured breaking hunks on blank lines
> (actually, I can see an argument for /always/ starting a new hunk when
> hitting a blank line). Maybe it could additionally avoid breaking the
> indent structure if possible. I have a feeling stuff like that changes
> the complexity from polynomial to exponential though...

Indentation is tough, because most editors eliminate indentation on
blank lines, too.

I think that this favouring of blank lines is actually going to be
bad for my code. Maybe double blank lines ;-)

Anyway, this is obviously not a true solution, but maybe some sort
of plugin could be used in the future.

-- 
  Yuval Kogman <nothingmuch at woobling.org>
http://nothingmuch.woobling.org  0xEBD27418

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.osuosl.org/pipermail/darcs-users/attachments/20061112/178f5ba5/attachment.pgp 


More information about the darcs-users mailing list