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: Dmitry Gutov
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 23:59:46 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0

On 30.08.2022 21:36, Stefan Monnier wrote:
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

Except we probably can't rely on 'patch' or 'tar' being installed on the user's system.

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 :-).

The /tmp approach implied 'cp', not storing contents of files in background buffers.




reply via email to

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