[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: |
Sat, 23 Nov 2019 20:50:10 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) |
> 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:
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)
- bug#38044: 27.0.50; There should be an easier way to look at a specific vc commit, (continued)
- bug#38044: 27.0.50; There should be an easier way to look at a specific vc commit, Dmitry Gutov, 2019/11/23
- bug#38044: 27.0.50; There should be an easier way to look at a specific vc commit, Stephen Berman, 2019/11/21
- bug#38044: 27.0.50; There should be an easier way to look at a specific vc commit, Eli Zaretskii, 2019/11/22
- bug#38044: 27.0.50; There should be an easier way to look at a specific vc commit, Stephen Berman, 2019/11/22
- bug#38044: 27.0.50; There should be an easier way to look at a specific vc commit, Eli Zaretskii, 2019/11/23
- bug#38044: 27.0.50; There should be an easier way to look at a specific vc commit, Stephen Berman, 2019/11/23
- bug#38044: 27.0.50; There should be an easier way to look at a specific vc commit, Dmitry Gutov, 2019/11/22
- bug#38044: 27.0.50; There should be an easier way to look at a specific vc commit, Lars Ingebrigtsen, 2019/11/22
- bug#38044: 27.0.50; There should be an easier way to look at a specific vc commit, Eli Zaretskii, 2019/11/22
- bug#38044: 27.0.50; There should be an easier way to look at a specific vc commit, Dmitry Gutov, 2019/11/22
- 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, Dmitry Gutov, 2019/11/23
- bug#38044: 27.0.50; There should be an easier way to look at a specific vc commit, Juri Linkov, 2019/11/23
- bug#38044: 27.0.50; There should be an easier way to look at a specific vc commit, Dmitry Gutov, 2019/11/25
- bug#38044: 27.0.50; There should be an easier way to look at a specific vc commit, Juri Linkov, 2019/11/26
- bug#38044: 27.0.50; There should be an easier way to look at a specific vc commit, Dmitry Gutov, 2019/11/26
- bug#38044: 27.0.50; There should be an easier way to look at a specific vc commit, Eli Zaretskii, 2019/11/27
- bug#38044: 27.0.50; There should be an easier way to look at a specific vc commit, Juri Linkov, 2019/11/27
- bug#38044: 27.0.50; There should be an easier way to look at a specific vc commit, Eli Zaretskii, 2019/11/27
- bug#38044: 27.0.50; There should be an easier way to look at a specific vc commit, Eli Zaretskii, 2019/11/25
- bug#38044: 27.0.50; There should be an easier way to look at a specific vc commit, Juri Linkov, 2019/11/26