unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Spencer Baugh via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Sean Whitton <spwhitton@spwhitton.name>
Cc: Dmitry Gutov <dmitry@gutov.dev>, Eli Zaretskii <eliz@gnu.org>,
	73604@debbugs.gnu.org
Subject: bug#73604: [PATCH] Properly operate on current fileset revision in vc-hg-print-log
Date: Fri, 11 Oct 2024 16:53:29 -0400	[thread overview]
Message-ID: <iero73qgy46.fsf@janestreet.com> (raw)
In-Reply-To: <875xpz45d5.fsf@melete.silentflame.com> (Sean Whitton's message of "Fri, 11 Oct 2024 12:43:02 +0800")

[-- Attachment #1: Type: text/plain, Size: 1862 bytes --]

Sean Whitton <spwhitton@spwhitton.name> writes:
> Hello,
>
> On Thu 03 Oct 2024 at 11:18am -04, Spencer Baugh wrote:
>
>> 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.
>
> Thanks.  Based on this explanation I'd like to install your patch, but
> can you move the substantive commentary in the commit message into the
> code as a comment, please?  Generally that is preferred in this repo.

Sure - even better, I put it in the docstring.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Properly-operate-on-current-fileset-revision-in-vc-h.patch --]
[-- Type: text/x-patch, Size: 1742 bytes --]

From d353b8eef6134cd2a25e0a778d9ac9cd7fcae50f Mon Sep 17 00:00:00 2001
From: Spencer Baugh <sbaugh@janestreet.com>
Date: Wed, 2 Oct 2024 15:20:31 -0400
Subject: [PATCH] Properly operate on current fileset revision in
 vc-hg-print-log

* lisp/vc/vc-hg.el (vc-hg-print-log): If start-revision is nil,
reliably log the working revision. (bug#73604)
---
 lisp/vc/vc-hg.el | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el
index c0afb225871..677cb3fd166 100644
--- a/lisp/vc/vc-hg.el
+++ b/lisp/vc/vc-hg.el
@@ -397,8 +397,11 @@ vc-hg-log-format
 (defun vc-hg-print-log (files buffer &optional shortlog start-revision limit)
   "Print commit log associated with FILES into specified BUFFER.
 If SHORTLOG is non-nil, use a short format based on `vc-hg-root-log-format'.
-If START-REVISION is non-nil, it is the newest revision to show.
-If LIMIT is non-nil, show no more than this many entries."
+If LIMIT is non-nil, show no more than this many entries.
+
+If START-REVISION is nil, the commit log is printed starting from the
+working directory parent (revset \".\").  If START-REVISION is non-nil,
+the log is printed starting from that revision."
   ;; `vc-do-command' creates the buffer, but we need it before running
   ;; the command.
   (vc-setup-buffer buffer)
@@ -408,8 +411,8 @@ vc-hg-print-log
     (with-current-buffer
 	buffer
       (apply #'vc-hg-command buffer 'async files "log"
+             (format "-r%s:0" (or start-revision "."))
 	     (nconc
-	      (when start-revision (list (format "-r%s:0" start-revision)))
 	      (when limit (list "-l" (format "%s" limit)))
               (when (eq vc-log-view-type 'with-diff)
                 (list "-p"))
-- 
2.39.3


  reply	other threads:[~2024-10-11 20:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-02 19:21 bug#73604: [PATCH] Properly operate on current fileset revision in vc-hg-print-log Spencer Baugh via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-03  2:16 ` Sean Whitton
2024-10-03  6:50   ` Eli Zaretskii
2024-10-03  7:04     ` Sean Whitton
2024-10-03 15:18       ` Spencer Baugh via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-11  4:43         ` Sean Whitton
2024-10-11 20:53           ` Spencer Baugh via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-10-12  7:36             ` Eli Zaretskii
2024-10-12  8:58               ` Sean Whitton
2024-10-12  8:56             ` Sean Whitton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=iero73qgy46.fsf@janestreet.com \
    --to=bug-gnu-emacs@gnu.org \
    --cc=73604@debbugs.gnu.org \
    --cc=dmitry@gutov.dev \
    --cc=eliz@gnu.org \
    --cc=sbaugh@janestreet.com \
    --cc=spwhitton@spwhitton.name \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).