Function: vc-cvs-parse-status

vc-cvs-parse-status is a byte-compiled function defined in vc-cvs.el.gz.

Signature

(vc-cvs-parse-status &optional FULL)

Documentation

Parse output of "cvs status" command in the current buffer.

Set file properties accordingly. Unless FULL is t, parse only essential information. Note that this can never set the ignored state.

Source Code

;; Defined in /usr/src/emacs/lisp/vc/vc-cvs.el.gz
;; XXX: This does not work correctly for subdirectories.  "cvs status"
;; information is context sensitive, it contains lines like:
;; cvs status: Examining DIRNAME
;; and the file entries after that don't show the full path.
;; Because of this VC directory listings only show changed files
;; at the top level for CVS.
(defun vc-cvs-parse-status (&optional full)
  "Parse output of \"cvs status\" command in the current buffer.
Set file properties accordingly.  Unless FULL is t, parse only
essential information.  Note that this can never set the `ignored'
state."
  (let (file status missing)
    (goto-char (point-min))
    (while (looking-at "\\? \\(.*\\)")
      (setq file (expand-file-name (match-string 1)))
      (vc-file-setprop file 'vc-state 'unregistered)
      (forward-line 1))
    (when (re-search-forward "^File: " nil t)
      (when (setq missing (looking-at "no file "))
	(goto-char (match-end 0)))
      (cond
       ((re-search-forward "\\=\\([^ \t]+\\)" nil t)
	(setq file (expand-file-name (match-string 1)))
	(setq status(if (re-search-forward "\\=[ \t]+Status: \\(.*\\)" nil t)
                        (match-string 1) "Unknown"))
	(when (and full
		   (re-search-forward
		    "\\(RCS Version\\|RCS Revision\\|Repository revision\\):\
[\t ]+\\([0-9.]+\\)"
		    nil t))
	    (vc-file-setprop file 'vc-latest-revision (match-string 2)))
	(vc-file-setprop
	 file 'vc-state
	 (cond
	  ((string-match "Up-to-date" status)
	   (vc-file-setprop file 'vc-checkout-time
			    (file-attribute-modification-time
			     (file-attributes file)))
	   'up-to-date)
	  ((string-match "Locally Modified" status)             'edited)
	  ((string-match "Needs Merge" status)                  'needs-merge)
	  ((string-match "Needs \\(Checkout\\|Patch\\)" status)
	   (if missing 'missing 'needs-update))
	  ((string-match "Locally Added" status)                'added)
	  ((string-match "Locally Removed" status)              'removed)
	  ((string-match "File had conflicts " status)          'conflict)
          ((string-match "Unknown" status)			'unregistered)
	  (t 'edited))))))))