[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#38044: 27.0.50; There should be an easier way to look at a specific
From: |
Juri Linkov |
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 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) |
>> 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:
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)
- bug#38044: 27.0.50; There should be an easier way to look at a specific vc commit, Lars Ingebrigtsen, 2019/11/03
- bug#38044: 27.0.50; There should be an easier way to look at a specific vc commit, Stephen Berman, 2019/11/03
- bug#38044: 27.0.50; There should be an easier way to look at a specific vc commit, Juri Linkov, 2019/11/03
- bug#38044: 27.0.50; There should be an easier way to look at a specific vc commit, Juri Linkov, 2019/11/13
- bug#38044: 27.0.50; There should be an easier way to look at a specific vc commit, Juri Linkov, 2019/11/16
- bug#38044: 27.0.50; There should be an easier way to look at a specific vc commit, Dmitry Gutov, 2019/11/17
- bug#38044: 27.0.50; There should be an easier way to look at a specific vc commit, Juri Linkov, 2019/11/17
- bug#38044: 27.0.50; There should be an easier way to look at a specific vc commit, Dmitry Gutov, 2019/11/17
- bug#38044: 27.0.50; There should be an easier way to look at a specific vc commit, Juri Linkov, 2019/11/17
- bug#38044: 27.0.50; There should be an easier way to look at a specific vc commit, Dmitry Gutov, 2019/11/17
- bug#38044: 27.0.50; There should be an easier way to look at a specific vc commit,
Juri Linkov <=
- bug#38044: 27.0.50; There should be an easier way to look at a specific vc commit, Eli Zaretskii, 2019/11/18
- bug#38044: 27.0.50; There should be an easier way to look at a specific vc commit, Dmitry Gutov, 2019/11/19
- bug#38044: 27.0.50; There should be an easier way to look at a specific vc commit, Eli Zaretskii, 2019/11/19
- bug#38044: 27.0.50; There should be an easier way to look at a specific vc commit, Dmitry Gutov, 2019/11/19
- bug#38044: 27.0.50; There should be an easier way to look at a specific vc commit, Eli Zaretskii, 2019/11/19
- bug#38044: 27.0.50; There should be an easier way to look at a specific vc commit, Dmitry Gutov, 2019/11/19
- bug#38044: 27.0.50; There should be an easier way to look at a specific vc commit, Eli Zaretskii, 2019/11/19
- bug#38044: 27.0.50; There should be an easier way to look at a specific vc commit, Dmitry Gutov, 2019/11/20
- bug#38044: 27.0.50; There should be an easier way to look at a specific vc commit, Eli Zaretskii, 2019/11/20
- bug#38044: 27.0.50; There should be an easier way to look at a specific vc commit, Dmitry Gutov, 2019/11/20