unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: Lars Ingebrigtsen <larsi@gnus.org>,
	Stephen Berman <stephen.berman@gmx.net>,
	38044@debbugs.gnu.org
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	[thread overview]
Message-ID: <877e3wub09.fsf@mail.linkov.net> (raw)
In-Reply-To: <6087186e-a444-0aac-e87d-596d2e36f0ce@yandex.ru> (Dmitry Gutov's message of "Mon, 18 Nov 2019 01:19:20 +0200")

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

>> 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:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: vc-log-revision.patch --]
[-- Type: text/x-diff, Size: 3026 bytes --]

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)

  reply	other threads:[~2019-11-18 21:31 UTC|newest]

Thread overview: 98+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-03 15:17 bug#38044: 27.0.50; There should be an easier way to look at a specific vc commit Lars Ingebrigtsen
2019-11-03 15:43 ` Stephen Berman
2019-11-03 20:16   ` Juri Linkov
2019-11-13 21:03     ` Juri Linkov
2019-11-16 20:31       ` Juri Linkov
2019-11-17 11:53       ` Dmitry Gutov
2019-11-17 21:20         ` Juri Linkov
2019-11-17 21:58           ` Dmitry Gutov
2019-11-17 22:36             ` Juri Linkov
2019-11-17 23:19               ` Dmitry Gutov
2019-11-18 21:31                 ` Juri Linkov [this message]
2019-11-19  3:34                   ` Eli Zaretskii
2019-11-19 11:12                   ` Dmitry Gutov
2019-11-19 16:12                     ` Eli Zaretskii
2019-11-19 16:59                       ` Dmitry Gutov
2019-11-19 17:43                         ` Eli Zaretskii
2019-11-19 23:17                           ` Dmitry Gutov
2019-11-20  3:43                             ` Eli Zaretskii
2019-11-20 12:19                               ` Dmitry Gutov
2019-11-20 16:34                                 ` Eli Zaretskii
2019-11-20 19:40                                   ` Dmitry Gutov
2019-11-20 19:57                                     ` Dmitry Gutov
2019-11-20 20:12                                       ` Eli Zaretskii
2019-11-20 20:07                                     ` Eli Zaretskii
2019-11-20 11:04                         ` Lars Ingebrigtsen
2019-11-21 15:00                           ` Eli Zaretskii
2019-11-19 22:20                       ` Juri Linkov
2019-11-20  3:44                         ` Eli Zaretskii
2019-11-20 21:50                           ` Juri Linkov
2019-11-20 23:37                             ` Dmitry Gutov
2019-11-21 23:08                               ` Juri Linkov
2019-11-22 18:51                                 ` Dmitry Gutov
2019-11-21 14:59                             ` Eli Zaretskii
2019-11-21 15:34                               ` Dmitry Gutov
2019-11-21 15:50                               ` Dmitry Gutov
2019-11-21 18:33                                 ` Eli Zaretskii
2019-11-21 19:08                                   ` Dmitry Gutov
2019-11-21 20:19                                     ` Eli Zaretskii
2019-11-21 21:05                                       ` Dmitry Gutov
2019-11-22  7:20                                         ` Eli Zaretskii
2019-11-22 19:59                                           ` Dmitry Gutov
2019-11-22 21:03                                             ` Eli Zaretskii
2019-11-22 21:43                                               ` Dmitry Gutov
2019-11-22 21:51                                                 ` Eli Zaretskii
2019-11-23 13:59                                                 ` Eli Zaretskii
2019-11-23 18:52                                                   ` Dmitry Gutov
2019-11-21 21:15                                       ` Stephen Berman
2019-11-22  7:24                                         ` Eli Zaretskii
2019-11-22  9:25                                           ` Stephen Berman
2019-11-23 12:13                                             ` Eli Zaretskii
2019-11-23 13:16                                               ` Stephen Berman
2019-11-22 11:19                                           ` Dmitry Gutov
2019-11-22 12:12                                             ` Lars Ingebrigtsen
2019-11-22 13:04                                             ` Eli Zaretskii
2019-11-22 16:27                                               ` Dmitry Gutov
2019-12-01 13:13                                           ` Stephen Berman
2019-12-01 17:53                                             ` Eli Zaretskii
2019-12-01 20:43                                               ` Stephen Berman
2019-12-01 21:29                                               ` Dmitry Gutov
2019-12-01 21:39                                                 ` Stephen Berman
2019-12-01 22:30                                                   ` Dmitry Gutov
2019-12-02  3:34                                                     ` Eli Zaretskii
2019-12-02 10:39                                                       ` Dmitry Gutov
2019-12-02 11:07                                                         ` Andreas Schwab
2019-12-02 15:58                                                         ` Eli Zaretskii
2019-12-02 16:05                                                           ` Dmitry Gutov
2019-11-23 18:50                                       ` Juri Linkov
2019-11-23 19:11                                         ` Dmitry Gutov
2019-11-23 22:43                                           ` Juri Linkov
2019-11-24 16:05                                             ` Eli Zaretskii
2019-11-26 23:01                                               ` Juri Linkov
2019-11-27  5:39                                                 ` Eli Zaretskii
2019-11-27 22:15                                                   ` Juri Linkov
2019-11-25  0:12                                             ` Dmitry Gutov
2019-11-26 23:06                                               ` Juri Linkov
2019-11-27  0:09                                                 ` Dmitry Gutov
2019-11-27  5:40                                                 ` Eli Zaretskii
2019-11-27 21:32                                                   ` Juri Linkov
2019-11-28  3:34                                                     ` Eli Zaretskii
2019-11-21 23:13                               ` Juri Linkov
2019-11-22  8:03                                 ` Eli Zaretskii
2019-11-22 11:20                                   ` Dmitry Gutov
2019-11-22 13:06                                     ` Eli Zaretskii
2019-11-22 16:26                                       ` Dmitry Gutov
2019-11-22 16:38                                         ` Eli Zaretskii
2019-11-21 22:36 ` Andrii Kolomoiets
2019-11-22  7:40   ` Eli Zaretskii
2020-07-19 15:31 ` Lars Ingebrigtsen
2020-07-19 17:14   ` Dmitry Gutov
2020-07-19 17:16     ` Lars Ingebrigtsen
2020-07-19 19:43       ` Dmitry Gutov
2020-07-19 19:51         ` Lars Ingebrigtsen
2020-07-20 20:56           ` Dmitry Gutov
2020-07-21 21:44             ` Lars Ingebrigtsen
2020-07-22 15:36               ` Dmitry Gutov
2020-07-22 16:14                 ` Dmitry Gutov
2020-07-22 16:25                 ` Eli Zaretskii
2020-07-22 16:38                   ` Dmitry Gutov

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=877e3wub09.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=38044@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    --cc=larsi@gnus.org \
    --cc=stephen.berman@gmx.net \
    /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).