1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 18:40:39 -08:00

Compare commits

...

2 commits

Author SHA1 Message Date
Sean Whitton
5b07a81bed 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.
2025-11-30 21:35:23 +00:00
Stephen Gildea
77a57041d0 time-stamp: Add test of multi-line start regexp
* test/lisp/time-stamp-tests.el: (time-stamp-custom-start-multiline):
New test, inspired by Amin Bandali.
2025-11-30 12:36:12 -08:00
4 changed files with 49 additions and 4 deletions

View file

@ -2529,6 +2529,11 @@ bindings:
- 'C-x v O L' is bound to 'vc-log-outgoing'
- 'C-x v O D' is bound to 'vc-root-diff-outgoing'.
---
*** New display of outgoing revisions count in VC-Dir.
If there are outgoing revisions, VC-Dir now includes a count of how many
in its headers, to remind you to push them.
+++
*** New user option 'vc-async-checkin' to enable async checkin operations.
Currently only supported by the Git and Mercurial backends.

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.

View file

@ -164,7 +164,7 @@
(iter-yield-from (time-stamp-test-pattern-sequential))
(iter-yield-from (time-stamp-test-pattern-multiply)))
(ert-deftest time-stamp-custom-start ()
(ert-deftest time-stamp-custom-start-0 ()
"Test that `time-stamp' isn't stuck by a start matching 0 characters."
(with-time-stamp-test-env
(with-time-stamp-test-time ref-time1
@ -189,6 +189,18 @@
(time-stamp)
(should (equal (buffer-string) "::05::05")))))))
(ert-deftest time-stamp-custom-start-multiline ()
"Test `time-stamp-start' matching across multiple lines."
(with-time-stamp-test-env
(with-time-stamp-test-time ref-time1
(let ((time-stamp-pattern "l.1\n%Y-%m-%d<-TS")) ;start includes newline
(with-temp-buffer
(insert "l.1\n<-TS\n")
;; we should look for the end on the line where the start ends,
;; not the line where the start starts
(time-stamp)
(should (equal (buffer-string) "l.1\n2006-01-02<-TS\n")))))))
(ert-deftest time-stamp-custom-pattern ()
"Test that `time-stamp-pattern' is parsed correctly."
(iter-do (pattern-parts (time-stamp-test-pattern-all))