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: Sat, 23 Nov 2019 20:50:10 +0200 Message-ID: <87d0di7959.fsf@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> <877e3wub09.fsf@mail.linkov.net> <5ce7d4f0-3884-fd27-09dc-c38f01a19958@yandex.ru> <83zhgr26c3.fsf@gnu.org> <87blt7qxhz.fsf@mail.linkov.net> <837e3v1aae.fsf@gnu.org> <87y2warzv3.fsf@mail.linkov.net> <83r221xoll.fsf@gnu.org> <83a78pxenu.fsf@gnu.org> <215302ff-8252-1f6c-5f60-aaba01cd615f@yandex.ru> <837e3tx9s8.fsf@gnu.org> 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="156569"; 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: larsi@gnus.org, stephen.berman@gmx.net, 38044@debbugs.gnu.org, Dmitry Gutov To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Nov 23 20:07:04 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 1iYakJ-000ecR-Mm for geb-bug-gnu-emacs@m.gmane.org; Sat, 23 Nov 2019 20:07:04 +0100 Original-Received: from localhost ([::1]:60706 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iYakI-00083T-HU for geb-bug-gnu-emacs@m.gmane.org; Sat, 23 Nov 2019 14:07:02 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46256) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iYajQ-0007HY-Q9 for bug-gnu-emacs@gnu.org; Sat, 23 Nov 2019 14:06:10 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iYajP-0002up-JN for bug-gnu-emacs@gnu.org; Sat, 23 Nov 2019 14:06:08 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49031) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iYajP-0002uj-GB for bug-gnu-emacs@gnu.org; Sat, 23 Nov 2019 14:06:07 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iYajP-0001Wh-9z for bug-gnu-emacs@gnu.org; Sat, 23 Nov 2019 14:06:07 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 23 Nov 2019 19:06:07 +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.15745359065724 (code B ref 38044); Sat, 23 Nov 2019 19:06:07 +0000 Original-Received: (at 38044) by debbugs.gnu.org; 23 Nov 2019 19:05:06 +0000 Original-Received: from localhost ([127.0.0.1]:57838 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iYaiK-0001Tp-Vs for submit@debbugs.gnu.org; Sat, 23 Nov 2019 14:05:03 -0500 Original-Received: from beige.elm.relay.mailchannels.net ([23.83.212.16]:34166) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iYaiH-0001Tb-0F for 38044@debbugs.gnu.org; Sat, 23 Nov 2019 14:05:00 -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 CC51121273; Sat, 23 Nov 2019 19:04:55 +0000 (UTC) Original-Received: from pdx1-sub0-mail-a24.g.dreamhost.com (100-96-196-51.trex.outbound.svc.cluster.local [100.96.196.51]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 33F5320FC4; Sat, 23 Nov 2019 19:04:55 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from pdx1-sub0-mail-a24.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); Sat, 23 Nov 2019 19:04:55 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-Stretch-Ruddy: 385747813c793183_1574535895469_418503414 X-MC-Loop-Signature: 1574535895468:957690975 X-MC-Ingress-Time: 1574535895468 Original-Received: from pdx1-sub0-mail-a24.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a24.g.dreamhost.com (Postfix) with ESMTP id A439B83DB6; Sat, 23 Nov 2019 11:04:49 -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=pkEbrGiFaJsiA++vJGnbKpzR75I=; b= rFllk7C0cN2diVYQ1KIFzUv0sKNhQvKA9O4Q0Um8lDvrIaPmf/N5nvPUCL88eTTq 3RbgqAg9SQ6Y/8PEkvh1wRLjsZKbgtHGiDKhZR7HXB+QEb4x9LxciDAl+zAsGnEm vHQUnt9BwnHQRFnHLciL4kioKJpit/eOF2Y8WdTTBtA= Original-Received: from mail.jurta.org (m91-129-105-73.cust.tele2.ee [91.129.105.73]) (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-a24.g.dreamhost.com (Postfix) with ESMTPSA id B84F783DB9; Sat, 23 Nov 2019 11:04:46 -0800 (PST) X-DH-BACKEND: pdx1-sub0-mail-a24 In-Reply-To: <837e3tx9s8.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 21 Nov 2019 22:19:03 +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:172341 Archived-At: --=-=-= Content-Type: text/plain > Here's an alternative proposal. It seems like almost all VCS backends > we support provide a variant of a "log" command that shows the diffs > together with the usual meta-data shown by "log". Only RCS and CVS > don't have such an option of "log", all the rest do (most of them via > "log -p"). > > So we could make this a subcommand of vc-log, more accurately > vc-print-root-log, such that "C-u C-u C-x v L" will prompt for a > revision ID, and display the information produced by such a "log -p" > command (and fall back to displaying just the diffs for RCS and CVS). > > Does this sound better? This is fine. Here's a new patch that implements 'M-1 C-x v L' to limit the log to one revision expanded with diff: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=vc-print-root-log-revision.patch diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index ca4c66a06d..3b977aa1f4 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -1160,7 +1159,9 @@ vc-git-print-log (list (concat start-revision ".." (if (equal limit "") "HEAD" limit))) - (list start-revision))) + (if (eq limit 1) + (list "-p" start-revision) + (list start-revision)))) '("--"))))))) (defun vc-git-log-outgoing (buffer remote-location) diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 0d29c80d02..90603541b5 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -2475,13 +2475,26 @@ vc-print-log (vc-print-log-internal backend files working-revision nil limit))) ;;;###autoload -(defun vc-print-root-log (&optional limit) +(defun vc-print-root-log (&optional limit revision) "List the change log for the current VC controlled tree in a window. If LIMIT is non-nil, it should be a number specifying the maximum number of revisions to show; the default is `vc-log-show-limit'. -When called interactively with a prefix argument, prompt for LIMIT." +When called interactively with a prefix argument, prompt for LIMIT. +When the prefix argument is a number, use it as LIMIT. +A special case is when the prefix argument is 1, in this case +it asks for the revision and shows it with its diff." (interactive (cond + ((eq current-prefix-arg 1) + (let* ((default (thing-at-point 'word)) + (revision (vc-read-revision + (if default + (format "Revision to show (default %s): " default) + "Revision to show: ") + nil nil default))) + (list 1 revision))) + ((numberp current-prefix-arg) + (list current-prefix-arg)) (current-prefix-arg (let ((lim (string-to-number (read-from-minibuffer @@ -2494,6 +2507,8 @@ vc-print-root-log (list (when (> vc-log-show-limit 0) vc-log-show-limit))))) (let ((backend (vc-deduce-backend)) (default-directory default-directory) + (vc-log-short-style (unless (and (eq limit 1) revision) + vc-log-short-style)) rootdir) (if backend (setq rootdir (vc-call-backend backend 'root default-directory)) @@ -2502,7 +2517,9 @@ vc-print-root-log (unless backend (error "Directory is not version controlled"))) (setq default-directory rootdir) - (vc-print-log-internal backend (list rootdir) nil nil limit))) + (vc-print-log-internal backend (list rootdir) revision revision limit) + (when (and (eq limit 1) revision) + (vc-git-region-history-mode)))) ;;;###autoload (defun vc-print-branch-log (branch) --=-=-=--