emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: master 4803fba487 1/2: 'C-x v v' on a diff buffer commits it as a pa


From: Stefan Monnier
Subject: Re: master 4803fba487 1/2: 'C-x v v' on a diff buffer commits it as a patch (bug#52349)
Date: Tue, 30 Aug 2022 14:36:21 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Dmitry Gutov [2022-08-30 18:26:41] wrote:
> On 30.08.2022 18:16, Stefan Monnier wrote:
>>> I can look into adapting this approach for other VCS if nobody beats me to
>>> it. As long as we fundamentally agree on the behavior.
>> Fine by me.  I'll just mention that I think we should be careful to make
>> sure no info is lost if Emacs crashes in the middle of the operation.
> File contents' backups should remain somewhere in /tmp, *shrug*.
> It might take some effort to find them, though.

We could do something like:

    run-the-vcs-diff-on-the FILES >VC-pending-changes
    patch -R <VC-pending-changes
    ...do the vc-checkin-patch...
    patch <VC-pending-changes
    rm VC-pending-changes

or (closer to Git's behavior):

    tar -cf VC-pending-changes.tar FILES
    vc-revert FILES
    ...do the vc-checkin-patch...
    tar xf VC-pending-changes.tar
    rm VC-pending-changes.tar

> I think it's hard to implement this with even more safety somehow.

I'm just worried that the uncommmitted changes we need to temporarily
remove are the rare parts that contain information that's not yet
duplicated in the VCS's data, so if we only store it in an Emacs buffer
it's vulnerable to an Emacs crash (which is something that *does*
happen, especially for us poor souls who run with experimental code and
with all assertions enabled :-).

> Git makes it uniquely easier to do.

Indeed.


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]