Subject: Re: bug#73604: [PATCH] Properly operate on current fileset revision in vc-hg-print-log

From: Spencer Baugh <[email-masked]>
Date: Thu, 03 Oct 2024 11:18:37 -0400

Sean Whitton <[email-masked]> writes:
> Hello,
>
> On Thu 03 Oct 2024 at 09:50am +03, Eli Zaretskii wrote:
>
>>> From: Sean Whitton <[email-masked]>
>>> Cc: Spencer Baugh <[email-masked]>, [email-masked]
>>> Date: Thu, 03 Oct 2024 10:16:33 +0800
>>>
>>> Eli, can this go on emacs-30?
>>
>> Why is it important enough to install on emacs-30?  The situation
>> sounds quite rare to me.
>
> Yeah, it's relatively rare, but I was thinking that it would be
> appropriate because of the simplicity of the fix.  Anyway, master is
> fine, I just wanted to ask.

I'm in no rush to put this on emacs-30 (I've already backported it for
my users anyway)

>> Moreover, I'm not sure the change is correct in general.  If you
>> invoke "C-x v l" with an argument, the prompt says "...(default: last
>> revision)".  It says "last", and doesn't say anything about the
>> working revision.  So I don't understand why you say the current
>> operation of the command is incorrect even when the tip and the
>> current working revision are different.  I think this is precisely a
>> use case where the user should invoke the command with a prefix arg
>> and specify the revision from which to start.
>
> Well, the description of C-x v l is
>
>     Show in another window the VC change history of the current fileset.
>
> If the current fileset doesn't exist in tip, then we'd better not just
> log tip.
>
> Possibly the prompt should also change.  Let's see what Spencer thinks.

I think you both may be misinterpreting this prompt - the typed-in
revision doesn't actually specify where the log starts.  It doesn't
affect what goes in the buffer at all; the value typed in doesn't get
passed to 'print-log at all.

The prompt is just about where point goes in the buffer - "last
revision" just means that point starts at point-min.  Typing a revision
at the prompt just moves point to that revision.

(This is of course extremely confusing; I have definitely typed
revisions in the vc-print-log prompt and expected them to change the log
output.  Maybe this prompt and command should be changed in other ways,
but let's defer that for other bugs.  Also note that this is very
different behavior from M-1 C-x v L (vc-print-root-log), where typing a
revision at the prompt *does* change what's logged.)

So, anyway, that prompt says nothing about what actual logs should print
with vc-print-log.  And (potentially) including commits which don't even
contain the current fileset seems very wrong.

Note also that the print-log docs also say:

;;   If START-REVISION is given, then show the log starting from that
;;   revision ("starting" in the sense of it being the _newest_
;;   revision shown, rather than the working revision, which is normally
;;   the case).

vc-print-log always passes nil for START-REVISION, so it seems we expect
to start from the working revision.