Subject: Re: bug#79408: 31.0.50; VC commands for cherry-picking

From: Sean Whitton <[email-masked]>
Date: Tue, 09 Sep 2025 10:57:16 +0100

Hello,

On Mon 08 Sep 2025 at 09:34pm +03, Juri Linkov wrote:

>> These are my proposed commands:
>>
>> vc-cherry-pick:
>>  - Gets the log message for REV with get-change-comment API function.
>>  - Gets the string to append with cherry-pick-comment API function.
>>  - Puts these together, starts a Log Edit session for the user to amend
>>    the message (e.g. for Git, doing C-c C-s to add a sign-off).
>
> Will 'C-c C-d' be supported to show diff from the Log Edit buffer?

Yes, it should be no problem to support that.

>>  We'll be expecting the user to invoke this from Log View mode.
>
> I guess the basic workflow would be to view a branch log
> with e.g. 'C-x v b l', then after marking the required commits
> invoke the new commands.

Right.

>>  If multiple commits are marked, then I think we have to skip the Log Edit
>>  session, for now, because we don't have a nice way to prompt for
>>  multiple messages.
>
> Maybe even for the single commit 'vc-cherry-pick' could ask
> for confirmation (maybe with a multiple choice), and optionally
> commit straight away without showing a Log Edit buffer.

I would say that is a bit complex, because just typing C-c C-c
immediately is not a lot of effort.

>> vc-cherry-apply:
>>  The advantage of having a backend API function for this is that the
>>  backend can use its full merging logic.
>>  A generic vc-default-cherry-apply can be implementated similarly to
>>  vc-apply-to-other-working-tree.
>>
>> vc-undo-apply:
>>  Like vc-cherry-apply except passes REVERSE non-nil at the appropriate
>>  point.  Similarly there can be a vc-default-reverse-cherry-apply.
>
> Are the last two commands equivalent to showing diff and invoking
> 'C-c RET a' on it, with or without the prefix argument REVERSE?

Yes, except that using 'C-c RET a' uses Emacs's merging logic, which may
be less sophisticated than the backend's.  Hmm.  Maybe I should skip
those commands for now.  What do you think?

-- 
Sean Whitton