GNU bug report logs -
#38044
27.0.50; There should be an easier way to look at a specific vc commit
Previous Next
Reported by: Lars Ingebrigtsen <larsi <at> gnus.org>
Date: Sun, 3 Nov 2019 15:18:03 UTC
Severity: wishlist
Tags: fixed
Found in version 27.0.50
Fixed in version 27.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #35 received at 38044 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
>> 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:
[vc-log-revision.patch (text/x-diff, inline)]
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)
This bug report was last modified 4 years and 355 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.