GNU bug report logs -
#66113
Apply the entire diff buffer
Previous Next
Reported by: Juri Linkov <juri <at> linkov.net>
Date: Wed, 20 Sep 2023 06:51:01 UTC
Severity: normal
Fixed in version 30.0.50
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
Full log
Message #14 received at 66113 <at> debbugs.gnu.org (full text, mbox):
On 22/09/2023 09:45, Juri Linkov wrote:
>>> + (t
>>> + (dolist (buf buffers)
>>> + (with-current-buffer buf
>>> + (display-buffer buf)))
>>> + (message "%d hunks failed; no buffers saved" failures)))))
>>
>> What happens next in this case? How do you undo in the buffers that had the
>> patch hunks already applied?
>
> Manually, like in case of ediff-patch-buffer.
I've never used this, so I don't understand.
>> Any change you wanted to work on the idea of the "atomic rollback" as well?
>
> This would be an unreliable feature: in case of diff-apply creates a mess,
> such automatic undo can create more mess, because there are many different
> strategies to undo the mess such as using undo-auto-amalgamate, or
> applying the reverse diff partially, doing more damage in case when
> buffers were already modified before diff-apply.
How about we save the tips of buffer-undo-list, then in case the buffer
needs reverting, basically 'undo' each of the buffers until the saved
"tip" is reached? I don't have a quick code anippet, but that seems doable.
> But fortunately the need to undo will be extremely rare, because
> when patch hunks are already applied, it reports the failure,
> but doesn't modify the source buffer. Therefore there is
> nothing to undo!
The problem situations is, of course, when one of the hunks (somewhere
in the middle or near the end) fails to apply cleanly or at all.
Another approach would be to first go through the patch and check that
all hunks apply without problems, and then, on the second pass, actually
apply them.
This bug report was last modified 1 year and 234 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.