Show P4 file type in vc-dir

This commit is contained in:
Tom Willemse 2022-03-13 21:25:57 -07:00
parent 99ca65c5cb
commit f48d5b449c
2 changed files with 13 additions and 1 deletions

View file

@ -28,6 +28,10 @@ VC expects the status to be reported as ~needs-update~, not ~needs-patch~.
Specifically the Server, root directory, client, and stream are shown in the headers. Specifically the Server, root directory, client, and stream are shown in the headers.
** ADDED Show the P4 file type in =vc-dir=.
This shows whether the file is binary, or text, and whether it has the lock, modification time, etc. modifiers enabled.
* 0.2.1 -- 2020-05-27 * 0.2.1 -- 2020-05-27
** FIXED Recognition of sub-directories of Perforce repos ** FIXED Recognition of sub-directories of Perforce repos

View file

@ -60,6 +60,7 @@
;;; Code: ;;; Code:
(require 'log-edit) (require 'log-edit)
(require 'vc-dir)
(eval-and-compile (eval-and-compile
(if (not (string-match "XEmacs" emacs-version)) (if (not (string-match "XEmacs" emacs-version))
@ -191,11 +192,12 @@ results of this function."
(setq lists (list lists))) (setq lists (list lists)))
(dolist (this-list lists) (dolist (this-list lists)
(let* ((this-file (cdr (assoc "clientFile" this-list))) (let* ((this-file (cdr (assoc "clientFile" this-list)))
(type (cdr (assoc "headType" this-list)))
(state (vc-p4-state this-file this-list t t))) (state (vc-p4-state this-file this-list t t)))
(unless (eq state 'up-to-date) (unless (eq state 'up-to-date)
(funcall update-function (funcall update-function
(list (list
(list (file-relative-name this-file dir) state)) (list (file-relative-name this-file dir) state type))
t)))) t))))
(funcall update-function nil nil))) (funcall update-function nil nil)))
@ -1048,6 +1050,12 @@ documentation for that command for their meanings."
(propertize (alist-get "Server address" extra-info nil nil #'string=) (propertize (alist-get "Server address" extra-info nil nil #'string=)
'face 'font-lock-variable-name-face)))) 'face 'font-lock-variable-name-face))))
(defun vc-p4-dir-printer (fileinfo)
"Call vc-default-dir-printer and append the extra part of FILEINFO."
(vc-default-dir-printer 'P4 fileinfo)
(when-let ((extra (vc-dir-fileinfo->extra fileinfo)))
(insert " <" extra ">")))
(defun vc-p4-rename-file (old new) (defun vc-p4-rename-file (old new)
"Rename OLD to NEW in Perforce." "Rename OLD to NEW in Perforce."
(p4-lowlevel-rename old new)) (p4-lowlevel-rename old new))