diff options
author | Eric S. Raymond <esr@snark.thyrsus.com> | 2008-05-16 19:15:26 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@snark.thyrsus.com> | 2008-05-16 19:15:26 +0000 |
commit | 98712492e73fbc31f6751fc13ac3416b44ee9221 (patch) | |
tree | 6b438968f307e85e15a04681239222ac5ee00661 /lisp/vc-cvs.el | |
parent | 2ec0d864c1e39c8603a330bbca1684c6dc5d5a90 (diff) | |
download | emacs-98712492e73fbc31f6751fc13ac3416b44ee9221.tar.gz emacs-98712492e73fbc31f6751fc13ac3416b44ee9221.tar.bz2 emacs-98712492e73fbc31f6751fc13ac3416b44ee9221.zip |
Improved extra-headers method for CVS.
Diffstat (limited to 'lisp/vc-cvs.el')
-rw-r--r-- | lisp/vc-cvs.el | 51 |
1 files changed, 37 insertions, 14 deletions
diff --git a/lisp/vc-cvs.el b/lisp/vc-cvs.el index 40f601a7738..193fcfad5ea 100644 --- a/lisp/vc-cvs.el +++ b/lisp/vc-cvs.el @@ -921,27 +921,50 @@ state." (vc-exec-after `(vc-cvs-after-dir-status (quote ,update-function)))) +(defun vc-cvs-file-to-string (file) + "Read the content of FILE and return it as a string." + (condition-case nil + (with-temp-buffer + (insert-file-contents file) + (goto-char (point-min)) + (buffer-substring (point) (point-max))) + (file-error nil))) + (defun vc-cvs-status-extra-headers (dir) + "Extract and represent per-directory properties of a CVS working copy." (let ((repo - (condition-case nil - (save-excursion - (set-buffer (find-file-noselect "CVS/Root" t)) + (condition-case nil + (with-temp-buffer + (insert-file-contents "CVS/Root") + (goto-char (point-min)) (and (looking-at ":ext:") (delete-char 5)) - (prog1 (buffer-string) (not-modified) (kill-buffer nil))) - nil))) + (buffer-substring (point) (point-max))) + (file-error nil))) + (module + (condition-case nil + (with-temp-buffer + (insert-file-contents "CVS/Repository") + (goto-char (point-min)) + (re-search-forward "[^/]*" nil t) + (concat (match-string 0) "\n")) + (file-error nil)))) (concat - ;; FIXME: see how PCL-CVS gets the data to print all these - (propertize "Module : " 'face 'font-lock-type-face) - (propertize "ADD CODE TO PRINT THE MODULE\n" - 'face 'font-lock-warning-face) + (cond (module + (concat + (propertize "Module: " 'face 'font-lock-type-face) + (propertize module 'face 'font-lock-variable-name-face))) + (t "")) (cond (repo (concat - (propertize "Repository : " 'face 'font-lock-type-face) - (propertize repo 'face 'font-lock-warning-face))) + (propertize "Repository: " 'face 'font-lock-type-face) + (propertize repo 'face 'font-lock-variable-name-face))) (t "")) - (propertize "Branch : " 'face 'font-lock-type-face) - (propertize "ADD CODE TO PRINT THE BRANCH NAME\n" - 'face 'font-lock-warning-face)))) + ;; In CVS, branch is a per-file property, not a per-directory property. We + ;; can't really do this here without making dangerous assumptions. + ;;(propertize "Branch: " 'face 'font-lock-type-face) + ;;(propertize "ADD CODE TO PRINT THE BRANCH NAME\n" + ;; 'face 'font-lock-warning-face) + ))) (defun vc-cvs-get-entries (dir) "Insert the CVS/Entries file from below DIR into the current buffer. |