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: Mon, 29 Aug 2022 20:05:10 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1

On 29.08.2022 19:46, Eli Zaretskii wrote:
Why cannot this be implemented for every other VCS?

It can.

Given diffs in a
buffer, it should be as simple as running the Patch utility via
shell-command-on-region, then committing the results.  Git has a
special command for that, but we don't need a special command for
other VCSes, if they don't have the equivalent of "git apply".  (I'm
guessing that "git apply" simply runs Patch under the hood.)

No, 'git apply' puts the patch in a different place (index area), which means our implementation doesn't need to bother with moving all existing changes in the selected files somewhere else, then committing, and then restoring the previously-hidden changes.

The best way to implement the latter is not obvious to me. I suppose simply copying the files to /tmp and then overwriting them back at the end might do the trick, but can cause problems if the user edits the file buffer between creating the diff and finishing the checkin.

> Can we please implement this for other VCSes as well?

Personally I hope we discover some popular extension to Mercurial which we'll be able to use in the same way as we do Git's index area here. And then say job well done and keep the less-popular and outdated backends unsupported.

'man hg' didn't give me enough clues, though.



reply via email to

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