1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-05 22:20:24 -08:00

New display of outgoing revisions count in VC-Dir

This relies on how vc--incoming-revision now caches incoming
revisions.

* lisp/vc/vc.el (vc--count-outgoing): New function.
* lisp/vc/vc-dir.el (vc-dir-header-urgent-value): New face.
(vc-dir-outgoing-revisions-map): New keymap.
(vc-dir-headers): Use them.
* etc/NEWS: Document the change.
This commit is contained in:
Sean Whitton 2025-11-30 21:35:23 +00:00
parent 77a57041d0
commit 5b07a81bed
3 changed files with 36 additions and 3 deletions

View file

@ -64,6 +64,11 @@ See `run-hooks'."
:group 'vc
:version "28.1")
(defface vc-dir-header-urgent-value '((t :inherit font-lock-warning-face))
"Face for urgent header values in VC-Dir buffers."
:group 'vc
:version "31.1")
(defface vc-dir-directory '((t :inherit font-lock-comment-delimiter-face))
"Face for directories in VC-Dir buffers."
:group 'vc
@ -1328,19 +1333,31 @@ the *vc-dir* buffer.
(hack-dir-local-variables-non-file-buffer)
(vc-dir-refresh)))
(defvar-keymap vc-dir-outgoing-revisions-map
:doc "Local keymap for viewing outgoing revisions."
"<down-mouse-1>" #'vc-log-outgoing)
(defun vc-dir-headers (backend dir)
"Display the headers in the *VC dir* buffer.
"Display the headers in the *VC-Dir* buffer.
It calls the `dir-extra-headers' backend method to display backend
specific headers."
(concat
;; First layout the common headers.
(propertize "VC backend : " 'face 'vc-dir-header)
(propertize (format "%s\n" backend) 'face 'vc-dir-header-value)
(propertize "Working dir: " 'face 'vc-dir-header)
(propertize (format "%s\n" (abbreviate-file-name dir))
'face 'vc-dir-header-value)
;; Then the backend specific ones.
(vc-call-backend backend 'dir-extra-headers dir)
(and-let* ((count (ignore-errors (vc--count-outgoing backend)))
(_ (plusp count)))
(concat (propertize "\nOutgoing : "
'face 'vc-dir-header)
(propertize (format "%d unpushed revisions\n" count)
'face 'vc-dir-header-urgent-value
'mouse-face 'highlight
'keymap vc-dir-outgoing-revisions-map
'help-echo "\\<vc-dir-outgoing-revisions-map>\
\\[vc-log-outgoing]: List outgoing revisions")))
"\n"))
(defun vc-dir-refresh-files (files)

View file

@ -4077,6 +4077,17 @@ can be a remote branch name."
""
(vc-call-backend backend 'mergebase incoming)))))
(defun vc--count-outgoing (backend)
"Return number of changes that will be sent with a `vc-push'."
(with-temp-buffer
(let ((display-buffer-overriding-action
'(display-buffer-no-window (allow-no-window . t))))
(vc-incoming-outgoing-internal backend nil
(current-buffer) 'log-outgoing))
(let ((proc (get-buffer-process (current-buffer))))
(while (accept-process-output proc)))
(how-many log-view-message-re)))
;;;###autoload
(defun vc-log-search (pattern)
"Search the VC log of changes for PATTERN and show log of matching changes.