aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Whitton2025-12-29 15:12:41 +0000
committerSean Whitton2025-12-29 15:12:41 +0000
commitfbbce9d405be21ab2982913d827d5de47255d07c (patch)
tree70559fedc3fb731d5736a8e9eaac6ace14dd9d83
parent29dea9ff4620127e9fa65aaa3374ce7c205cc059 (diff)
downloademacs-fbbce9d405be21ab2982913d827d5de47255d07c.tar.gz
emacs-fbbce9d405be21ab2982913d827d5de47255d07c.zip
New commands vc-print-change-log & vc-print-root-change-log
* lisp/vc/vc.el (vc--read-branch-to-log): Call vc-deduce-fileset. Don't wrap return value in a list. (vc-print-fileset-branch-log, vc-print-root-branch-log): Adjust calls to vc--read-branch-to-log. (vc-print-change-log, vc-print-root-change-log): New commands (bug#80037). * etc/NEWS: Announce them.
-rw-r--r--etc/NEWS13
-rw-r--r--lisp/vc/vc.el61
2 files changed, 68 insertions, 6 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 56a9f44ff31..0743d56a20b 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -2717,6 +2717,19 @@ the log entry. If there are marked revisions, it copies the IDs of
2717those, instead. 2717those, instead.
2718 2718
2719--- 2719---
2720*** New commands 'vc-print-change-log' and 'vc-print-root-change-log'.
2721These are just like 'vc-print-log' and 'vc-print-root-log' except that
2722they have a different prefix argument that some users may prefer.
2723With a prefix argument, these commands prompt for a branch, tag or other
2724reference to a revision to log, and a maximum number of revisions to
2725print. If you find this prefix argument more useful, or more mnemonic,
2726than the prefix arguments that 'vc-print-log' and 'vc-print-root-log'
2727already have, consider replacing the default global bindings, like this:
2728
2729 (keymap-global-set "C-x v l" #'vc-print-change-log)
2730 (keymap-global-set "C-x v L" #'vc-print-root-change-log)
2731
2732---
2720*** New command alias 'vc-restore' for 'vc-revert'. 2733*** New command alias 'vc-restore' for 'vc-revert'.
2721 2734
2722** Package 2735** Package
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 9645e8818c5..64538da9880 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -3970,6 +3970,29 @@ shown log style is available via `vc-log-short-style'."
3970 working-revision nil limit))) 3970 working-revision nil limit)))
3971 3971
3972;;;###autoload 3972;;;###autoload
3973(defun vc-print-change-log ()
3974 "Show in another window the VC change history of the current fileset.
3975With a \\[universal-argument] prefix argument, prompt for a branch \
3976or revision to log
3977instead of the working revision, and a number specifying the maximum
3978number of revisions to show; the default is `vc-log-show-limit'.
3979You can also use a numeric prefix argument to specify this.
3980
3981This is like `vc-print-log' but with an alternative prefix argument that
3982some users might prefer for interactive usage."
3983 (declare (interactive-only vc-print-log))
3984 (interactive)
3985 (if current-prefix-arg
3986 (let ((branch
3987 (vc--read-branch-to-log t))
3988 (vc-log-show-limit
3989 (if (equal current-prefix-arg '(4))
3990 (vc--read-limit)
3991 (prefix-numeric-value current-prefix-arg))))
3992 (vc-print-fileset-branch-log branch))
3993 (vc-print-log)))
3994
3995;;;###autoload
3973(defun vc-print-root-log (&optional limit revision) 3996(defun vc-print-root-log (&optional limit revision)
3974 "Show in another window VC change history of the current VC controlled tree. 3997 "Show in another window VC change history of the current VC controlled tree.
3975If LIMIT is non-nil, it should be a number specifying the maximum 3998If LIMIT is non-nil, it should be a number specifying the maximum
@@ -4002,13 +4025,39 @@ with its diffs (if the underlying VCS backend supports that)."
4002 ;; the mode line isn't helpful. 4025 ;; the mode line isn't helpful.
4003 (setq vc-parent-buffer-name nil)))) 4026 (setq vc-parent-buffer-name nil))))
4004 4027
4005(defun vc--read-branch-to-log (&optional files) 4028;;;###autoload
4029(defun vc-print-root-change-log ()
4030 "Show in another window the VC change history of the whole tree.
4031With a \\[universal-argument] prefix argument, prompt for a branch \
4032or revision to log
4033instead of the working revision, and a number specifying the maximum
4034number of revisions to show; the default is `vc-log-show-limit'.
4035You can also use a numeric prefix argument to specify this.
4036
4037This is like `vc-root-print-log' but with an alternative prefix argument
4038that some users might prefer for interactive usage."
4039 (declare (interactive-only vc-print-root-log))
4040 (interactive)
4041 (if current-prefix-arg
4042 (let ((branch
4043 (vc--read-branch-to-log t))
4044 (vc-log-show-limit
4045 (if (equal current-prefix-arg '(4))
4046 (vc--read-limit)
4047 (prefix-numeric-value current-prefix-arg))))
4048 (vc-print-root-branch-log branch))
4049 (vc-print-root-log)))
4050
4051(defun vc--read-branch-to-log (&optional fileset)
4006 "Read the name of a branch to log. 4052 "Read the name of a branch to log.
4007FILES, if supplied, should be a list of file names." 4053FILESET, if non-nil, means to pass the current VC fileset to
4008 (let ((branch (vc-read-revision "Branch to log: " files))) 4054`vc-read-revision'."
4055 (let ((branch (vc-read-revision "Branch to log: "
4056 (and fileset
4057 (cadr (vc-deduce-fileset t))))))
4009 (when (string-empty-p branch) 4058 (when (string-empty-p branch)
4010 (user-error "No branch specified")) 4059 (user-error "No branch specified"))
4011 (list branch))) 4060 branch))
4012 4061
4013;;;###autoload 4062;;;###autoload
4014(defun vc-print-fileset-branch-log (branch) 4063(defun vc-print-fileset-branch-log (branch)
@@ -4021,7 +4070,7 @@ starting at that revision. Tags and remote references also work."
4021 ;; used to prompt for a LIMIT argument like \\`C-x v l' has. Though 4070 ;; used to prompt for a LIMIT argument like \\`C-x v l' has. Though
4022 ;; now we have "Show 2X entries" and "Show unlimited entries" that 4071 ;; now we have "Show 2X entries" and "Show unlimited entries" that
4023 ;; might be a waste of the prefix argument to this command. --spwhitton 4072 ;; might be a waste of the prefix argument to this command. --spwhitton
4024 (interactive (vc--read-branch-to-log (cadr (vc-deduce-fileset t)))) 4073 (interactive (list (vc--read-branch-to-log t)))
4025 (let ((fileset (vc-deduce-fileset t))) 4074 (let ((fileset (vc-deduce-fileset t)))
4026 (vc-print-log-internal (car fileset) (cadr fileset) branch t 4075 (vc-print-log-internal (car fileset) (cadr fileset) branch t
4027 (and (plusp vc-log-show-limit) 4076 (and (plusp vc-log-show-limit)
@@ -4035,7 +4084,7 @@ In addition to logging branches, for VCS for which it makes sense you
4035can specify a revision ID instead of a branch name to produce a log 4084can specify a revision ID instead of a branch name to produce a log
4036starting at that revision. Tags and remote references also work." 4085starting at that revision. Tags and remote references also work."
4037 ;; Prefix argument conserved; see previous command. --spwhitton 4086 ;; Prefix argument conserved; see previous command. --spwhitton
4038 (interactive (vc--read-branch-to-log)) 4087 (interactive (list (vc--read-branch-to-log)))
4039 (vc--with-backend-in-rootdir "VC branch log" 4088 (vc--with-backend-in-rootdir "VC branch log"
4040 (vc-print-log-internal backend (list rootdir) branch t 4089 (vc-print-log-internal backend (list rootdir) branch t
4041 (and (plusp vc-log-show-limit) 4090 (and (plusp vc-log-show-limit)