mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-06-14 12:31:25 +00:00
Fix fontification in short unintegrated changes logs (bug#81215)
* lisp/vc/vc.el (vc-log-view-type): Replace with ... (vc-log-view-types): ... this. All uses changes. (vc-log-remote-unintegrated): Newly pass a value for the log view types. This matters for Hg repositories. (vc-print-log-internal): Ensure log view types always contains either 'long' or 'short'. (vc-root-log-incoming, vc-root-log-outgoing, vc-log-search): * lisp/vc/vc-dir.el (vc-dir--count-outgoing): Pass both log-incoming/log-outgoing/log-search and short/long for the log view types. This is necessary because these functions don't call vc-print-log-internal. This will need to be refactored when implementing the new fileset-specific vc-log-incoming and vc-log-outgoing.
This commit is contained in:
parent
8486669e37
commit
cda9d9c733
6 changed files with 48 additions and 41 deletions
|
|
@ -726,18 +726,18 @@ or a superior directory.")
|
|||
(setq-local log-view-per-file-logs nil)
|
||||
(setq-local log-view-file-re regexp-unmatchable)
|
||||
(setq-local log-view-message-re
|
||||
(if (eq vc-log-view-type 'short)
|
||||
(if (memq 'short vc-log-view-types)
|
||||
"^ *\\([0-9.]+\\): \\(.*?\\)[ \t]+\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}\\)\\( \\[merge\\]\\)?"
|
||||
"^ *\\(?:revno: \\([0-9.]+\\)\\|merged: .+\\)"))
|
||||
;; Allow expanding short log entries
|
||||
(when (eq vc-log-view-type 'short)
|
||||
(when (memq 'short vc-log-view-types)
|
||||
(setq truncate-lines t)
|
||||
(setq-local log-view-expanded-log-entry-function
|
||||
'vc-bzr-expanded-log-entry))
|
||||
(setq-local log-view-font-lock-keywords
|
||||
;; log-view-font-lock-keywords is careful to use the buffer-local
|
||||
;; value of log-view-message-re only since Emacs-23.
|
||||
(if (eq vc-log-view-type 'short)
|
||||
(if (memq 'short vc-log-view-types)
|
||||
(append `((,log-view-message-re
|
||||
(1 'log-view-message)
|
||||
(2 'change-log-name)
|
||||
|
|
@ -785,7 +785,7 @@ If LIMIT is non-nil, show no more than this many entries."
|
|||
"-r%s"
|
||||
"-r..%s")
|
||||
start-revision)))
|
||||
(if (eq vc-log-view-type 'with-diff) (list "-p"))
|
||||
(if (memq 'with-diff vc-log-view-types) (list "-p"))
|
||||
(when limit (list "-l" (format "%s" limit)))
|
||||
;; There is no sensible way to combine --limit and --forward,
|
||||
;; and it breaks the meaning of START-REVISION as the
|
||||
|
|
|
|||
|
|
@ -1438,7 +1438,8 @@ uses OVERLAY."
|
|||
(condition-case _
|
||||
(progn
|
||||
(vc-incoming-outgoing-internal backend nil
|
||||
(current-buffer) 'log-outgoing)
|
||||
(current-buffer)
|
||||
'(log-outgoing short))
|
||||
(overlay-put overlay 'proc (get-buffer-process (current-buffer)))
|
||||
(setq proc (get-buffer-process (current-buffer)))
|
||||
(vc-run-delayed
|
||||
|
|
|
|||
|
|
@ -1898,7 +1898,7 @@ If LIMIT is a non-empty string, use it as a base revision."
|
|||
(if shortlog vc-git-shortlog-switches vc-git-log-switches))
|
||||
(when (numberp limit)
|
||||
(list "-n" (format "%s" limit)))
|
||||
(when (eq vc-log-view-type 'with-diff)
|
||||
(when (memq 'with-diff vc-log-view-types)
|
||||
(list "-p"))
|
||||
(list (concat (and (stringp limit)
|
||||
(concat limit ".."))
|
||||
|
|
@ -1970,17 +1970,16 @@ log entries."
|
|||
(setq-local log-view-file-re regexp-unmatchable)
|
||||
(setq-local log-view-per-file-logs nil)
|
||||
(setq-local log-view-message-re
|
||||
(if (not (memq vc-log-view-type '(long log-search with-diff)))
|
||||
(if (memq 'short vc-log-view-types)
|
||||
(cadr vc-git-root-log-format)
|
||||
"^commit +\\([0-9a-z]+\\)"))
|
||||
;; Allow expanding short log entries.
|
||||
(when (memq vc-log-view-type
|
||||
'(short log-outgoing log-incoming log-unintegrated mergebase))
|
||||
(when (memq 'short vc-log-view-types)
|
||||
(setq truncate-lines t)
|
||||
(setq-local log-view-expanded-log-entry-function
|
||||
'vc-git-expanded-log-entry))
|
||||
(setq-local log-view-font-lock-keywords
|
||||
(if (not (memq vc-log-view-type '(long log-search with-diff)))
|
||||
(if (memq 'short vc-log-view-types)
|
||||
(list (cons (nth 1 vc-git-root-log-format)
|
||||
(nth 2 vc-git-root-log-format)))
|
||||
(append
|
||||
|
|
|
|||
|
|
@ -446,15 +446,15 @@ the log starting from that revision."
|
|||
;; commits from all branches are included in the log.
|
||||
(cond ((not (stringp limit))
|
||||
(format "-r%s:0" start))
|
||||
((memq vc-log-view-type '(log-outgoing
|
||||
log-unintegrated))
|
||||
((cl-intersection vc-log-view-types
|
||||
'(log-outgoing log-unintegrated))
|
||||
(format "-rreverse(only(%s, %s))" start limit))
|
||||
(t
|
||||
(format "-r%s:%s & !%s" start limit limit)))
|
||||
(nconc
|
||||
(and (numberp limit)
|
||||
(list "-l" (format "%s" limit)))
|
||||
(and (eq vc-log-view-type 'with-diff)
|
||||
(and (memq 'with-diff vc-log-view-types)
|
||||
(list "-p"))
|
||||
(if shortlog
|
||||
`(,@(and vc-hg-log-graph '("--graph"))
|
||||
|
|
@ -471,8 +471,7 @@ the log starting from that revision."
|
|||
|
||||
(define-derived-mode vc-hg-log-view-mode log-view-mode "Hg-Log-View"
|
||||
(require 'add-log) ;; we need the add-log faces
|
||||
(let ((shortp (memq vc-log-view-type
|
||||
'(short log-incoming log-outgoing log-unintegrated))))
|
||||
(let ((shortp (memq 'short vc-log-view-types)))
|
||||
(setq-local log-view-file-re regexp-unmatchable)
|
||||
(setq-local log-view-per-file-logs nil)
|
||||
(setq-local log-view-message-re
|
||||
|
|
|
|||
|
|
@ -585,7 +585,7 @@ If LIMIT is non-nil, show no more than this many entries."
|
|||
;; subsequent commits. At least that's what the
|
||||
;; vc-cvs.el code does.
|
||||
"-rHEAD:0"))
|
||||
(if (eq vc-log-view-type 'with-diff)
|
||||
(if (memq 'with-diff vc-log-view-types)
|
||||
(list "--diff"))
|
||||
(when limit (list "--limit" (format "%s" limit))))))
|
||||
;; Dump log for the entire directory.
|
||||
|
|
@ -593,7 +593,7 @@ If LIMIT is non-nil, show no more than this many entries."
|
|||
(append
|
||||
(list
|
||||
(if start-revision (format "-r%s" start-revision) "-rHEAD:0"))
|
||||
(if (eq vc-log-view-type 'with-diff)
|
||||
(if (memq 'with-diff vc-log-view-types)
|
||||
(list "--diff"))
|
||||
(when limit (list "--limit" (format "%s" limit)))))))))
|
||||
|
||||
|
|
|
|||
|
|
@ -3531,7 +3531,7 @@ When called from Lisp, optional argument FILESET overrides the fileset."
|
|||
(vc-print-log-internal backend (cadr fileset) nil nil
|
||||
(vc--outgoing-base-mergebase backend
|
||||
upstream-location)
|
||||
'log-unintegrated)))
|
||||
'(log-unintegrated))))
|
||||
|
||||
;;;###autoload
|
||||
(defun vc-root-log-unintegrated (&optional upstream-location)
|
||||
|
|
@ -3643,7 +3643,8 @@ When called from Lisp, optional argument FILESET overrides the fileset."
|
|||
;; REFRESH nil here because we just refreshed.
|
||||
(vc--outgoing-base-mergebase backend
|
||||
upstream-location
|
||||
nil 'force-topic))))
|
||||
nil 'force-topic)
|
||||
'(log-unintegrated))))
|
||||
|
||||
;;;###autoload
|
||||
(defun vc-root-log-remote-unintegrated (&optional upstream-location)
|
||||
|
|
@ -4309,7 +4310,7 @@ button for. Same for CURRENT-REVISION. LIMIT means the usual."
|
|||
before-after))))
|
||||
|
||||
(defun vc-print-log-internal (backend files working-revision
|
||||
&optional is-start-revision limit type)
|
||||
&optional is-start-revision limit types)
|
||||
"For specified BACKEND and FILES, show the VC log.
|
||||
Leave point at WORKING-REVISION, if it is non-nil.
|
||||
If IS-START-REVISION is non-nil, start the log from WORKING-REVISION
|
||||
|
|
@ -4323,9 +4324,9 @@ LIMIT can also be a string, which means the revision before which to stop."
|
|||
(shortlog (not (null (memq (if dir-present 'directory 'file)
|
||||
vc-log-short-style))))
|
||||
(buffer-name "*vc-change-log*")
|
||||
(type (or type (if shortlog 'short 'long))))
|
||||
(types (cl-adjoin (if shortlog 'short 'long) types)))
|
||||
(vc-log-internal-common
|
||||
backend buffer-name files type
|
||||
backend buffer-name files types
|
||||
(lambda (bk buf _type-arg files-arg)
|
||||
(vc-call-backend bk 'print-log files-arg buf shortlog
|
||||
(when is-start-revision working-revision) limit)
|
||||
|
|
@ -4353,11 +4354,12 @@ LIMIT can also be a string, which means the revision before which to stop."
|
|||
(vc-call-backend bk 'show-log-entry working-revision)))
|
||||
(lambda (_ignore-auto _noconfirm)
|
||||
(vc-print-log-internal backend files working-revision
|
||||
is-start-revision limit type)))))
|
||||
is-start-revision limit types)))))
|
||||
|
||||
(defvar vc-log-view-type nil
|
||||
"Set this to record the type of VC log shown in the current buffer.
|
||||
Supported values are:
|
||||
(define-obsolete-variable-alias 'vc-log-view-type 'vc-log-view-types "32.1")
|
||||
(defvar vc-log-view-types nil
|
||||
"List of types of the VC log shown in the current buffer.
|
||||
Supported elements are:
|
||||
|
||||
`short' -- short log form, one line for each commit
|
||||
`long' -- long log form, including full log message and author
|
||||
|
|
@ -4367,7 +4369,7 @@ Supported values are:
|
|||
`log-unintegrated' -- log of changes you've not yet finished sharing
|
||||
`log-search' -- log entries matching a pattern; shown in long format
|
||||
`mergebase' -- log created by `vc-log-mergebase'.")
|
||||
(put 'vc-log-view-type 'permanent-local t)
|
||||
(put 'vc-log-view-types 'permanent-local t)
|
||||
(defvar vc-sentinel-movepoint)
|
||||
|
||||
(defvar vc-log-finish-functions '(vc-shrink-buffer-window)
|
||||
|
|
@ -4377,21 +4379,22 @@ Each function runs in the log output buffer without args.")
|
|||
(defun vc-log-internal-common (backend
|
||||
buffer-name
|
||||
files
|
||||
type
|
||||
types
|
||||
backend-func
|
||||
setup-buttons-func
|
||||
goto-location-func
|
||||
rev-buff-func)
|
||||
(let (retval (buffer (get-buffer-create buffer-name)))
|
||||
(with-current-buffer buffer
|
||||
(setq-local vc-log-view-type type))
|
||||
(setq retval (funcall backend-func backend buffer-name type files))
|
||||
(setq-local vc-log-view-types types))
|
||||
(setq retval
|
||||
(funcall backend-func backend buffer-name (car types) files))
|
||||
(with-current-buffer buffer
|
||||
(let ((inhibit-read-only t))
|
||||
;; log-view-mode used to be called with inhibit-read-only bound
|
||||
;; to t, so let's keep doing it, just in case.
|
||||
(vc-call-backend backend
|
||||
(if (and (eq type 'with-diff)
|
||||
(if (and (memq 'with-diff types)
|
||||
(vc-find-backend-function
|
||||
backend 'region-history-mode))
|
||||
'region-history-mode
|
||||
|
|
@ -4411,15 +4414,16 @@ Each function runs in the log output buffer without args.")
|
|||
(set-buffer-modified-p nil)
|
||||
(run-hooks 'vc-log-finish-functions)))))
|
||||
|
||||
(defun vc-incoming-outgoing-internal (backend upstream-location buffer-name type)
|
||||
(defun vc-incoming-outgoing-internal
|
||||
(backend upstream-location buffer-name types)
|
||||
(vc-log-internal-common
|
||||
backend buffer-name (list (vc-root-dir)) type
|
||||
backend buffer-name (list (vc-root-dir)) types
|
||||
(lambda (bk buf type-arg _files)
|
||||
(vc-call-backend bk type-arg buf upstream-location))
|
||||
(lambda (_bk _files-arg _ret) nil)
|
||||
nil ;; Don't move point.
|
||||
(lambda (_ignore-auto _noconfirm)
|
||||
(vc-incoming-outgoing-internal backend upstream-location buffer-name type))))
|
||||
(vc-incoming-outgoing-internal backend upstream-location buffer-name types))))
|
||||
|
||||
(defun vc--read-limit ()
|
||||
"Read a LIMIT argument for a VC log command."
|
||||
|
|
@ -4509,7 +4513,7 @@ with its diffs (if the underlying VCS backend supports that)."
|
|||
(let* ((with-diff (and (eq limit 1) revision))
|
||||
(vc-log-short-style (and (not with-diff) vc-log-short-style)))
|
||||
(vc-print-log-internal backend (list rootdir) revision revision limit
|
||||
(and with-diff 'with-diff))
|
||||
(and with-diff '(with-diff)))
|
||||
;; We're looking at the root, so displaying " from <some-file>" in
|
||||
;; the mode line isn't helpful.
|
||||
(setq vc-parent-buffer-name nil))))
|
||||
|
|
@ -4673,7 +4677,8 @@ can be a remote branch name."
|
|||
(interactive (list (vc--maybe-read-upstream-location)))
|
||||
(vc--with-backend-in-rootdir "VC root-log"
|
||||
(vc-incoming-outgoing-internal backend upstream-location
|
||||
"*vc-incoming*" 'log-incoming)))
|
||||
"*vc-incoming*"
|
||||
'(log-incoming short))))
|
||||
;; We plan to reuse the name `vc-log-incoming' for the fileset-specific
|
||||
;; command in Emacs 32.1. --spwhitton
|
||||
(define-obsolete-function-alias 'vc-log-incoming #'vc-root-log-incoming
|
||||
|
|
@ -4697,7 +4702,8 @@ can be a remote branch name."
|
|||
(interactive (list (vc--maybe-read-upstream-location)))
|
||||
(vc--with-backend-in-rootdir "VC root-log"
|
||||
(vc-incoming-outgoing-internal backend upstream-location
|
||||
"*vc-outgoing*" 'log-outgoing)))
|
||||
"*vc-outgoing*"
|
||||
'(log-outgoing short))))
|
||||
;; We plan to reuse the name `vc-log-outgoing' for the fileset-specific
|
||||
;; command in Emacs 32.1. --spwhitton
|
||||
(define-obsolete-function-alias 'vc-log-outgoing #'vc-root-log-outgoing
|
||||
|
|
@ -4729,7 +4735,8 @@ will output log entries, and displays those log entries instead."
|
|||
(unless backend
|
||||
(error "Buffer is not version controlled"))
|
||||
(vc-incoming-outgoing-internal backend pattern
|
||||
"*vc-search-log*" 'log-search)))
|
||||
"*vc-search-log*"
|
||||
'(log-search long))))
|
||||
|
||||
;;;###autoload
|
||||
(defun vc-log-mergebase (_files rev1 rev2)
|
||||
|
|
@ -4738,8 +4745,9 @@ The merge base is a common ancestor of revisions REV1 and REV2."
|
|||
(interactive
|
||||
(vc-diff-build-argument-list-internal
|
||||
(or (ignore-errors (vc-deduce-fileset t))
|
||||
(let ((backend (or (vc-deduce-backend) (vc-responsible-backend default-directory))))
|
||||
(list backend (list (vc-call-backend backend 'root default-directory)))))))
|
||||
(let ((backend (or (vc-deduce-backend)
|
||||
(vc-responsible-backend default-directory))))
|
||||
`(,backend (,(vc-call-backend backend 'root default-directory)))))))
|
||||
(vc--with-backend-in-rootdir "VC root-log"
|
||||
(setq rev1 (vc-call-backend backend 'mergebase rev1 rev2))
|
||||
(vc-print-log-internal backend (list rootdir) (or rev2 "") t rev1)))
|
||||
|
|
@ -4759,7 +4767,7 @@ mark."
|
|||
(unless backend
|
||||
(error "Buffer is not version controlled"))
|
||||
(with-current-buffer buf
|
||||
(setq-local vc-log-view-type 'long))
|
||||
(setq-local vc-log-view-types '(long)))
|
||||
(vc-call region-history file buf lfrom lto)
|
||||
(with-current-buffer buf
|
||||
(vc-call-backend backend 'region-history-mode)
|
||||
|
|
|
|||
Loading…
Reference in a new issue