Function: vc-svn-parse-status
vc-svn-parse-status is a byte-compiled function defined in
vc-svn.el.gz.
Signature
(vc-svn-parse-status &optional FILENAME)
Documentation
Parse output of "svn status" command in the current buffer.
Set file properties accordingly. If FILENAME is non-nil, return its status.
Source Code
;; Defined in /usr/src/emacs/lisp/vc/vc-svn.el.gz
(defun vc-svn-parse-status (&optional filename)
"Parse output of \"svn status\" command in the current buffer.
Set file properties accordingly. If FILENAME is non-nil, return its status."
(let (multifile file status propstat)
(goto-char (point-min))
(while (re-search-forward
"^\\(?:\\?\\|[ ACDGIMR!~][ MC][ L][ +][ SX]..\\([ *]\\) +\\([-0-9]+\\) +\\([0-9?]+\\) +\\([^ ]+\\)\\) +" nil t)
;; If the username contains spaces, the output format is ambiguous,
;; so don't trust the output's filename unless we have to.
(setq file (or (unless multifile filename)
(expand-file-name
(buffer-substring (point) (line-end-position))))
;; If we are parsing the result of running status on a directory,
;; there could be multiple files in the output.
;; We assume that filename, if supplied, applies to the first
;; listed file (ie, the directory). Bug#15322.
multifile t
status (char-after (line-beginning-position))
;; Status of the item's properties ([ MC]).
propstat (char-after (1+ (line-beginning-position))))
(if (eq status ??)
(vc-file-setprop file 'vc-state 'unregistered)
;; Use the last-modified revision, so that searching in vc-print-log
;; output works.
(vc-file-setprop file 'vc-working-revision (match-string 3))
;; Remember Svn's own status.
(vc-file-setprop file 'vc-svn-status status)
(vc-file-setprop
file 'vc-state
(cond
((and (eq status ?\ ) (eq propstat ?\ ))
(if (eq (char-after (match-beginning 1)) ?*)
'needs-update
(vc-file-setprop file 'vc-checkout-time
(file-attribute-modification-time
(file-attributes file)))
'up-to-date))
((eq status ?A)
;; If the file was actually copied, (match-string 2) is "-".
(vc-file-setprop file 'vc-working-revision "0")
(vc-file-setprop file 'vc-checkout-time 0)
'added)
;; Conflict in contents or properties.
((or (eq status ?C) (eq propstat ?C))
(vc-file-setprop file 'vc-state 'conflict))
;; Modified contents or properties.
((or (eq status ?M) (eq propstat ?M))
(if (eq (char-after (match-beginning 1)) ?*)
'needs-merge
'edited))
((eq status ?I)
(vc-file-setprop file 'vc-state 'ignored))
((memq status '(?D ?R))
(vc-file-setprop file 'vc-state 'removed))
(t 'edited)))))
(when filename (vc-file-getprop filename 'vc-state))))