From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#38044: 27.0.50; There should be an easier way to look at a specific vc commit Date: Mon, 18 Nov 2019 23:31:50 +0200 Organization: LINKOV.NET Message-ID: <877e3wub09.fsf@mail.linkov.net> References: <87ftj5at1q.fsf@gnus.org> <87r22phsoj.fsf@gmx.net> <87bltslnpo.fsf@mail.linkov.net> <87d0dvmqu8.fsf@mail.linkov.net> <590e595e-8220-1c7e-bd4a-b2eb0968e289@yandex.ru> <87r226xl8m.fsf@mail.linkov.net> <24c56bca-8d7d-3a20-aeef-5d11f8a075e6@yandex.ru> <87pnhquo4k.fsf@mail.linkov.net> <6087186e-a444-0aac-e87d-596d2e36f0ce@yandex.ru> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="85648"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) Cc: Lars Ingebrigtsen , Stephen Berman , 38044@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Nov 18 22:53:18 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iWoxQ-000M4w-60 for geb-bug-gnu-emacs@m.gmane.org; Mon, 18 Nov 2019 22:53:16 +0100 Original-Received: from localhost ([::1]:39894 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iWoxO-0005DO-Ri for geb-bug-gnu-emacs@m.gmane.org; Mon, 18 Nov 2019 16:53:14 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40361) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iWoxF-0005BY-4w for bug-gnu-emacs@gnu.org; Mon, 18 Nov 2019 16:53:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iWoxD-0008Py-Pm for bug-gnu-emacs@gnu.org; Mon, 18 Nov 2019 16:53:05 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:37560) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iWoxD-0008Ps-Jz for bug-gnu-emacs@gnu.org; Mon, 18 Nov 2019 16:53:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iWoxD-0005Is-Gh for bug-gnu-emacs@gnu.org; Mon, 18 Nov 2019 16:53:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 18 Nov 2019 21:53:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38044 X-GNU-PR-Package: emacs Original-Received: via spool by 38044-submit@debbugs.gnu.org id=B38044.157411394220296 (code B ref 38044); Mon, 18 Nov 2019 21:53:03 +0000 Original-Received: (at 38044) by debbugs.gnu.org; 18 Nov 2019 21:52:22 +0000 Original-Received: from localhost ([127.0.0.1]:46373 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iWowX-0005HH-Nb for submit@debbugs.gnu.org; Mon, 18 Nov 2019 16:52:22 -0500 Original-Received: from bongo.elm.relay.mailchannels.net ([23.83.212.21]:46673) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iWowV-0005H9-PU for 38044@debbugs.gnu.org; Mon, 18 Nov 2019 16:52:20 -0500 X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 7ABC33C0782; Mon, 18 Nov 2019 21:52:18 +0000 (UTC) Original-Received: from pdx1-sub0-mail-a6.g.dreamhost.com (100-96-169-13.trex.outbound.svc.cluster.local [100.96.169.13]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 036D63C06C6; Mon, 18 Nov 2019 21:52:18 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from pdx1-sub0-mail-a6.g.dreamhost.com ([TEMPUNAVAIL]. [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.18.5); Mon, 18 Nov 2019 21:52:18 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-Grain-Belong: 32d497b533ccfb1f_1574113938284_3139119331 X-MC-Loop-Signature: 1574113938284:962268052 X-MC-Ingress-Time: 1574113938284 Original-Received: from pdx1-sub0-mail-a6.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a6.g.dreamhost.com (Postfix) with ESMTP id C63CAA7010; Mon, 18 Nov 2019 13:52:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=linkov.net; bh=2I0ovwI4MKDnXUWwh4jik2LCv0k=; b= ux325V38VERgWENE31FuagdUvR42zugfhHLVPSU0BD9/COlNVua7M8E3Wl76MZdL 7bD0DclidZguMEPl7siTX8HUssjEucqZrXjzJORvkV+MfborLg+/QJDlZ/Ir5cMt oJ/HRE90B5A9iKT9hN8iimku2GYq86soCumQEIV68GM= Original-Received: from mail.jurta.org (m91-129-102-1.cust.tele2.ee [91.129.102.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a6.g.dreamhost.com (Postfix) with ESMTPSA id 20EAFA7014; Mon, 18 Nov 2019 13:52:04 -0800 (PST) X-DH-BACKEND: pdx1-sub0-mail-a6 In-Reply-To: <6087186e-a444-0aac-e87d-596d2e36f0ce@yandex.ru> (Dmitry Gutov's message of "Mon, 18 Nov 2019 01:19:20 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:171943 Archived-At: --=-=-= Content-Type: text/plain >> Then no dwim command is needed. We'll just add vc-log-revision and done. >> The user will decide whether to use vc-log-search to search in commit >> messages, or vc-log-revision to show the log message of one commit. > > I'm fine with having two commands. Having a '-dwim-' one could save on key > bindings, but we don't have one for vc-log-search anyway. Ok, here is a new command vc-log-revision: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=vc-log-revision.patch diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 5ab8e7ec53..f379c3d890 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -1189,7 +1189,7 @@ vc-git-log-incoming "@{upstream}" remote-location)))) -(defun vc-git-log-search (buffer pattern) +(defun vc-git-log-search (buffer pattern &optional limit) "Search the log of changes for PATTERN and output results into BUFFER. PATTERN is a basic regular expression by default in Git. @@ -1197,8 +1197,10 @@ vc-git-log-search Display all entries that match log messages in long format. With a prefix argument, ask for a command to run that will output log entries." - (let ((args `("log" "--no-color" "-i" - ,(format "--grep=%s" (or pattern ""))))) + (let ((args (if limit + `("log" "--no-color" "-n" "1" ,(or pattern "")) + `("log" "--no-color" "-i" + ,(format "--grep=%s" (or pattern "")))))) (when current-prefix-arg (setq args (cdr (split-string (read-shell-command diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 0d29c80d02..92faa59502 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -2542,6 +2542,16 @@ vc-log-outgoing (vc-incoming-outgoing-internal backend (or remote-location "") "*vc-outgoing*" 'log-outgoing))) +(defun vc-log-search-internal (backend buffer-name type pattern &optional limit) + (vc-log-internal-common + backend buffer-name nil type + (lambda (bk buf type-arg _files) + (vc-call-backend bk type-arg buf pattern limit)) + (lambda (_bk _files-arg _ret) nil) + nil ;; Don't move point. + (lambda (_ignore-auto _noconfirm) + (vc-log-search-internal backend pattern buffer-name type)))) + ;;;###autoload (defun vc-log-search (pattern) "Search the log of changes for PATTERN. @@ -2558,8 +2568,25 @@ vc-log-search (let ((backend (vc-deduce-backend))) (unless backend (error "Buffer is not version controlled")) - (vc-incoming-outgoing-internal backend pattern - "*vc-search-log*" 'log-search))) + (vc-log-search-internal backend "*vc-search-log*" 'log-search pattern))) + +;;;###autoload +(defun vc-log-revision (revision) + "Search the log of changes for REVISION. +Display the REVISION log entry in long format." + (interactive (list (unless current-prefix-arg + (let ((default (thing-at-point 'word))) + (vc-read-revision + (if default + (format "Revision to log (default %s): " default) + "Revision to log: ") + nil nil default))))) + (when (equal revision "") + (error "No revision specified")) + (let ((backend (vc-deduce-backend))) + (unless backend + (error "Buffer is not version controlled")) + (vc-log-search-internal backend "*vc-search-log*" 'log-search revision 1))) ;;;###autoload (defun vc-log-mergebase (_files rev1 rev2) --=-=-=--