'C-c C-d' on vc-log buffer shows the diff from 'vc-log-fileset' (bug#52349)

* lisp/vc/log-edit.el (log-edit-diff-fileset): New function.

* lisp/vc/vc-dispatcher.el (vc-log-edit): Set log-edit-diff-function to
log-edit-diff-fileset instead of vc-diff.

* lisp/vc/vc.el (vc-diff): New optional arg ‘fileset’.
If non-nil, use instead of vc-deduce-fileset.
This commit is contained in:
Juri Linkov 2022-08-28 22:44:52 +03:00
parent 4803fba487
commit 78698e9211
3 changed files with 12 additions and 4 deletions

View file

@ -670,6 +670,13 @@ comment history, see `log-edit-comment-ring', and hides `log-edit-files-buf'."
(defun log-edit-diff-patch ()
(vc-diff-patch-string vc-patch-string))
(defvar vc-log-fileset)
(defun log-edit-diff-fileset ()
"Display diffs for the files to be committed."
(interactive)
(vc-diff nil nil (list log-edit-vc-backend vc-log-fileset)))
(defun log-edit-show-diff ()
"Show the diff for the files to be committed."
(interactive)

View file

@ -656,7 +656,7 @@ NOT-URGENT means it is ok to continue if the user says not to save."
(lambda (file) (file-relative-name file root))
fileset))))
(log-edit-diff-function
. ,(if vc-patch-string 'log-edit-diff-patch 'vc-diff))
. ,(if vc-patch-string 'log-edit-diff-patch 'log-edit-diff-fileset))
(log-edit-vc-backend . ,backend)
(vc-log-fileset . ,fileset)
(vc-patch-string . ,vc-patch-string))

View file

@ -2001,19 +2001,20 @@ state of each file in the fileset."
(when buffer-file-name (vc-buffer-sync not-urgent))))
;;;###autoload
(defun vc-diff (&optional historic not-urgent)
(defun vc-diff (&optional historic not-urgent fileset)
"Display diffs between file revisions.
Normally this compares the currently selected fileset with their
working revisions. With a prefix argument HISTORIC, it reads two revision
designators specifying which revisions to compare.
The optional argument NOT-URGENT non-nil means it is ok to say no to
saving the buffer."
saving the buffer. The optional argument FILESET can override the
deduced fileset."
(interactive (list current-prefix-arg t))
(if historic
(call-interactively 'vc-version-diff)
(vc-maybe-buffer-sync not-urgent)
(let ((fileset (vc-deduce-fileset t)))
(let ((fileset (or fileset (vc-deduce-fileset t))))
(vc-buffer-sync-fileset fileset not-urgent)
(vc-diff-internal t fileset nil nil
(called-interactively-p 'interactive)))))