On Sun, Nov 12, 2006 at 04:18:29PM +0200, Yuval Kogman wrote:
> On Fri, Nov 10, 2006 at 09:39:08 -0800, David Roundy wrote:
>
> > What do you mean by noisy? Or "false" changes? I have no idea what you are
> > talking about (which would make it hard to fix).
>
> Here is an example I get often:
>
> hunk ./lib/MO/Compile/Attribute/Simple/Compiled.pm 75
> -sub _generate_accessor_method {
> +sub slot {
> Shall I record this change? (7/?) [ynWsfqadjkc], or ? for help: y
> hunk ./lib/MO/Compile/Attribute/Simple/Compiled.pm 78
> - my $slot = ( $self->slots )[0];
> + my @slots = $self->slots;
> +
> + warn "Attribute $self has more than one slot, but the
> generated accessor will only use the first one" if @slots > 1;
> +
> + return $slots[0];
> +}
> +
> +sub _generate_accessor_method {
> + my $self = shift;
>
>
> The patch I would have expected is [hand typed]:
>
>
> +sub slot {
> + my @slots = $self->slots;
> +
> + warn "Attribute $self has more than one slot, but the
> generated accessor will only use the first one" if @slots > 1;
> +
> + return $slots[0];
> +}
>
> sub _generate_accessor_method {
> my $self = shift;
> - my $slot = ( $self->slots )[0];
> + my $slot = $self->slot;
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. 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.
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...
-- Jamie Webb
_______________________________________________
darcs-users mailing list
[email protected]
http://www.abridgegame.org/mailman/listinfo/darcs-users