comparison lisp/vc-cvs.el @ 93124:97c5b398eee4

* vc-hooks.el (vc-default-mode-line-string): Add case for added files. * vc.el (vc-default-dired-state-info): Use just "modified". * vc-cvs.el (vc-cvs-state-heuristic): Turn rev 0 into `added'. (vc-cvs-mode-line-string): Make use of the better default. (vc-cvs-parse-entry): Use the new `added'. (vc-cvs-dired-state-info): Remove. * vc-svn.el (vc-svn-dired-state-info): Remove. * vc-hg.el (vc-hg-dired-state-info): Remove. * vc-git.el (vc-git-dired-state-info): Remove.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Fri, 21 Mar 2008 17:53:04 +0000
parents 01d3fd1a2cfe
children 5ec26b66bbe8
comparison
equal deleted inserted replaced
93123:38f18130d057 93124:97c5b398eee4
205 "CVS-specific state heuristic." 205 "CVS-specific state heuristic."
206 ;; If the file has not changed since checkout, consider it `up-to-date'. 206 ;; If the file has not changed since checkout, consider it `up-to-date'.
207 ;; Otherwise consider it `edited'. 207 ;; Otherwise consider it `edited'.
208 (let ((checkout-time (vc-file-getprop file 'vc-checkout-time)) 208 (let ((checkout-time (vc-file-getprop file 'vc-checkout-time))
209 (lastmod (nth 5 (file-attributes file)))) 209 (lastmod (nth 5 (file-attributes file))))
210 (if (equal checkout-time lastmod) 210 (cond
211 'up-to-date 211 ((equal checkout-time lastmod) 'up-to-date)
212 'edited))) 212 ((string= (vc-working-revision file) "0") 'added)
213 (t 'edited))))
213 214
214 (defun vc-cvs-dir-state (dir) 215 (defun vc-cvs-dir-state (dir)
215 "Find the CVS state of all files in DIR and subdirectories." 216 "Find the CVS state of all files in DIR and subdirectories."
216 ;; if DIR is not under CVS control, don't do anything. 217 ;; if DIR is not under CVS control, don't do anything.
217 (when (file-readable-p (expand-file-name "CVS/Entries" dir)) 218 (when (file-readable-p (expand-file-name "CVS/Entries" dir))
259 Compared to the default implementation, this function does two things: 260 Compared to the default implementation, this function does two things:
260 Handle the special case of a CVS file that is added but not yet 261 Handle the special case of a CVS file that is added but not yet
261 committed and support display of sticky tags." 262 committed and support display of sticky tags."
262 (let* ((sticky-tag (vc-file-getprop file 'vc-cvs-sticky-tag)) 263 (let* ((sticky-tag (vc-file-getprop file 'vc-cvs-sticky-tag))
263 help-echo 264 help-echo
264 (string 265 (string
265 (if (string= (vc-working-revision file) "0") 266 (let ((def-ml (vc-default-mode-line-string 'CVS file)))
266 ;; A file that is added but not yet committed. 267 (setq help-echo
267 (progn 268 (get-text-property 0 'help-echo def-ml))
268 (setq help-echo "Added file (needs commit) under CVS") 269 def-ml)))
269 "CVS @@")
270 (let ((def-ml (vc-default-mode-line-string 'CVS file)))
271 (setq help-echo
272 (get-text-property 0 'help-echo def-ml))
273 def-ml))))
274 (propertize 270 (propertize
275 (if (zerop (length sticky-tag)) 271 (if (zerop (length sticky-tag))
276 string 272 string
277 (setq help-echo (format "%s on the '%s' branch" 273 (setq help-echo (format "%s on the '%s' branch"
278 help-echo sticky-tag)) 274 help-echo sticky-tag))
279 (concat string "[" sticky-tag "]")) 275 (concat string "[" sticky-tag "]"))
280 'help-echo help-echo))) 276 'help-echo help-echo)))
281 277
282 (defun vc-cvs-dired-state-info (file)
283 "CVS-specific version of `vc-dired-state-info'."
284 (let ((cvs-state (vc-state file)))
285 (cond ((eq cvs-state 'edited)
286 (if (equal (vc-working-revision file) "0")
287 "(added)" "(modified)"))
288 (t
289 (vc-default-dired-state-info 'CVS file)))))
290 278
291 ;;; 279 ;;;
292 ;;; State-changing functions 280 ;;; State-changing functions
293 ;;; 281 ;;;
294 282
958 ;; entry for a "locally added" file (not yet committed) 946 ;; entry for a "locally added" file (not yet committed)
959 ((looking-at "/[^/]+/0/") 947 ((looking-at "/[^/]+/0/")
960 (vc-file-setprop file 'vc-backend 'CVS) 948 (vc-file-setprop file 'vc-backend 'CVS)
961 (vc-file-setprop file 'vc-checkout-time 0) 949 (vc-file-setprop file 'vc-checkout-time 0)
962 (vc-file-setprop file 'vc-working-revision "0") 950 (vc-file-setprop file 'vc-working-revision "0")
963 (if set-state (vc-file-setprop file 'vc-state 'edited))) 951 (if set-state (vc-file-setprop file 'vc-state 'added)))
964 ;; normal entry 952 ;; normal entry
965 ((looking-at 953 ((looking-at
966 (concat "/[^/]+" 954 (concat "/[^/]+"
967 ;; revision 955 ;; revision
968 "/\\([^/]*\\)" 956 "/\\([^/]*\\)"