comparison lisp/vc-cvs.el @ 95049:438808a998aa

Improved extra-headers method for CVS.
author Eric S. Raymond <esr@snark.thyrsus.com>
date Fri, 16 May 2008 19:15:26 +0000
parents 4a0b47d5274d
children f362398714d9
comparison
equal deleted inserted replaced
95048:883c17cb4544 95049:438808a998aa
919 ;; (file-relative-name dir) 919 ;; (file-relative-name dir)
920 ;; "-f" "-n" "update" "-d" "-P") 920 ;; "-f" "-n" "update" "-d" "-P")
921 (vc-exec-after 921 (vc-exec-after
922 `(vc-cvs-after-dir-status (quote ,update-function)))) 922 `(vc-cvs-after-dir-status (quote ,update-function))))
923 923
924 (defun vc-cvs-file-to-string (file)
925 "Read the content of FILE and return it as a string."
926 (condition-case nil
927 (with-temp-buffer
928 (insert-file-contents file)
929 (goto-char (point-min))
930 (buffer-substring (point) (point-max)))
931 (file-error nil)))
932
924 (defun vc-cvs-status-extra-headers (dir) 933 (defun vc-cvs-status-extra-headers (dir)
934 "Extract and represent per-directory properties of a CVS working copy."
925 (let ((repo 935 (let ((repo
926 (condition-case nil 936 (condition-case nil
927 (save-excursion 937 (with-temp-buffer
928 (set-buffer (find-file-noselect "CVS/Root" t)) 938 (insert-file-contents "CVS/Root")
939 (goto-char (point-min))
929 (and (looking-at ":ext:") (delete-char 5)) 940 (and (looking-at ":ext:") (delete-char 5))
930 (prog1 (buffer-string) (not-modified) (kill-buffer nil))) 941 (buffer-substring (point) (point-max)))
931 nil))) 942 (file-error nil)))
943 (module
944 (condition-case nil
945 (with-temp-buffer
946 (insert-file-contents "CVS/Repository")
947 (goto-char (point-min))
948 (re-search-forward "[^/]*" nil t)
949 (concat (match-string 0) "\n"))
950 (file-error nil))))
932 (concat 951 (concat
933 ;; FIXME: see how PCL-CVS gets the data to print all these 952 (cond (module
934 (propertize "Module : " 'face 'font-lock-type-face) 953 (concat
935 (propertize "ADD CODE TO PRINT THE MODULE\n" 954 (propertize "Module: " 'face 'font-lock-type-face)
936 'face 'font-lock-warning-face) 955 (propertize module 'face 'font-lock-variable-name-face)))
956 (t ""))
937 (cond (repo 957 (cond (repo
938 (concat 958 (concat
939 (propertize "Repository : " 'face 'font-lock-type-face) 959 (propertize "Repository: " 'face 'font-lock-type-face)
940 (propertize repo 'face 'font-lock-warning-face))) 960 (propertize repo 'face 'font-lock-variable-name-face)))
941 (t "")) 961 (t ""))
942 (propertize "Branch : " 'face 'font-lock-type-face) 962 ;; In CVS, branch is a per-file property, not a per-directory property. We
943 (propertize "ADD CODE TO PRINT THE BRANCH NAME\n" 963 ;; can't really do this here without making dangerous assumptions.
944 'face 'font-lock-warning-face)))) 964 ;;(propertize "Branch: " 'face 'font-lock-type-face)
965 ;;(propertize "ADD CODE TO PRINT THE BRANCH NAME\n"
966 ;; 'face 'font-lock-warning-face)
967 )))
945 968
946 (defun vc-cvs-get-entries (dir) 969 (defun vc-cvs-get-entries (dir)
947 "Insert the CVS/Entries file from below DIR into the current buffer. 970 "Insert the CVS/Entries file from below DIR into the current buffer.
948 This function ensures that the correct coding system is used for that, 971 This function ensures that the correct coding system is used for that,
949 which may not be the one that is used for the files' contents. 972 which may not be the one that is used for the files' contents.