New commands to report diffs of all local changes

* lisp/vc/vc.el (vc-root-diff-outgoing-and-edited)
(vc-diff-outgoing-and-edited): New commands (bug#80434).
* lisp/vc/vc-dir.el (vc-dir-mode-map):
* lisp/vc/vc-hooks.el (vc-prefix-map): Bind them.
* doc/emacs/maintaining.texi (VC Change Log):
* etc/NEWS: Document them.
This commit is contained in:
Sean Whitton 2026-04-29 14:46:37 +01:00
parent dee5ca5acd
commit ae40c3a438
5 changed files with 73 additions and 0 deletions

View file

@ -1109,6 +1109,15 @@ but limited to the current fileset.
If you customize @code{vc-use-incoming-outgoing-prefixes} to
non-@code{nil}, this command becomes available on @kbd{C-x v O =}.
@item C-x v E D
Display a combined diff of all changes that will be sent by the next
push operation plus any uncommitted changes.
@item C-x v E =
Display a combined diff of all changes that will be sent by the next
push operation plus any uncommitted changes, but limited to the current
fileset.
@item C-x v h
Display the history of changes made in the region of file visited by
the current buffer (@code{vc-region-history}).
@ -1223,6 +1232,17 @@ The difference is that the diffs reported are limited to the current
fileset. Don't forget that actual pull and push operations always
affect the whole working tree, not just the current fileset.
@kindex C-x v E =
@kindex C-x v E D
@findex vc-diff-outgoing-and-edited
@findex vc-root-diff-outgoing-and-edited
Finally, there is also @kbd{C-x v E D}
(@code{vc-root-diff-outgoing-and-edited}) which shows a combined diff of
all changes that would be pushed plus any uncommitted changes. It is
useful to show all work that's present only locally. There is also
@kbd{C-x v E =} (@code{vc-diff-outgoing-and-edited}) which is the same
but limited to the current fileset.
@cindex VC log buffer, commands in
@cindex vc-log buffer
In the @file{*vc-change-log*} buffer, you can use the following keys

View file

@ -3008,6 +3008,13 @@ These are useful to view all outstanding (unmerged, unpushed) changes on
the current branch. They are also available as 'T =', 'T D', 'T l' and
'T L' in VC Directory buffers.
+++
*** New commands to report combined diffs of all local changes.
'C-x v E =' ('vc-diff-outgoing-and-edited') and 'C-x v E D'
('vc-root-diff-outgoing-and-edited') report combined diffs of all
outgoing changes plus any uncommitted changes. They are useful to show
all work that's present only locally.
+++
*** New user option 'vc-use-incoming-outgoing-prefixes'.
If this is customized to non-nil, 'C-x v I' and 'C-x v O' become prefix

View file

@ -412,6 +412,9 @@ an \\+`up-to-date' or \\+`ignored' file."
(define-key map "TL" #'vc-root-log-unintegrated)
(define-key map "T=" #'vc-diff-unintegrated)
(define-key map "TD" #'vc-root-diff-unintegrated)
(define-key map "EL" #'vc-root-log-outgoing)
(define-key map "E=" #'vc-diff-outgoing-and-edited)
(define-key map "ED" #'vc-root-diff-outgoing-and-edited)
(define-key map "V" #'vc-dir-root-next-action)
(let ((branch-map (make-sparse-keymap)))

View file

@ -1040,6 +1040,14 @@ In the latter case, VC mode is deactivated for this buffer."
"T L" #'vc-root-log-unintegrated
"T =" #'vc-diff-unintegrated
"T D" #'vc-root-diff-unintegrated
;; There are no -log-outgoing-and-edited commands because by
;; definition these are the same as -log-outgoing.
;; Additionally bind the -log-outgoing commands under C-x v E l/L as
;; nothing else could conceivably go there and it might help someone.
;; (Fileset-specific outgoing log command coming in Emacs 32. --spwhitton)
"E L" #'vc-root-log-outgoing
"E =" #'vc-diff-outgoing-and-edited
"E D" #'vc-root-diff-outgoing-and-edited
"m" #'vc-merge
"r" #'vc-retrieve-tag
"s" #'vc-create-tag

View file

@ -3459,6 +3459,41 @@ When called from Lisp, optional argument FILESET overrides the fileset."
nil
(called-interactively-p 'interactive))))
;;;###autoload
(defun vc-root-diff-outgoing-and-edited (&optional upstream-location)
"Report combined diff of all outgoing and uncommitted changes.
Outgoing changes are those that would be pushed to UPSTREAM-LOCATION.
When unspecified UPSTREAM-LOCATION is the place \\[vc-push] would push
to. When called interactively with a prefix argument, prompt for
UPSTREAM-LOCATION. In some version control systems UPSTREAM-LOCATION
can be a remote branch name.
When called from Lisp optional argument FILESET overrides the VC
fileset.
This command is the same as `vc-root-diff-unintegrated' used on a trunk."
(declare (interactive-only vc-root-diff-unintegrated))
(interactive (list (or (vc--maybe-read-outgoing-base) t)))
(vc-root-diff-unintegrated upstream-location))
;;;###autoload
(defun vc-diff-outgoing-and-edited (&optional upstream-location fileset)
"Report combined diff of outgoing and uncommitted changes to VC fileset.
Outgoing changes are those that would be pushed to UPSTREAM-LOCATION.
When unspecified UPSTREAM-LOCATION is the place \\[vc-push] would push
to. When called interactively with a prefix argument, prompt for
UPSTREAM-LOCATION. In some version control systems UPSTREAM-LOCATION
can be a remote branch name.
When called from Lisp optional argument FILESET overrides the VC
fileset.
This command is the same as `vc-diff-unintegrated' used on a trunk."
(declare (interactive-only vc-diff-unintegrated))
(interactive (let ((fileset (vc-deduce-fileset t)))
(list (or (vc--maybe-read-outgoing-base (car fileset))
t)
fileset)))
(vc-diff-unintegrated upstream-location fileset))
;;;###autoload
(defun vc-log-unintegrated (&optional upstream-location fileset)
"Show log for the VC fileset since the merge base with UPSTREAM-LOCATION.