comparison lisp/vc-cvs.el @ 91302:56a72e2bd635

Merge from emacs--devo--0 Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-306
author Miles Bader <miles@gnu.org>
date Sat, 29 Dec 2007 02:39:17 +0000
parents 2fcaae6177a5 71fc7b1db920
children c938ab6810a4
comparison
equal deleted inserted replaced
91301:7774e5860c70 91302:56a72e2bd635
210 (if (equal checkout-time lastmod) 210 (if (equal checkout-time lastmod)
211 'up-to-date 211 'up-to-date
212 'edited))) 212 'edited)))
213 213
214 (defun vc-cvs-dir-state (dir) 214 (defun vc-cvs-dir-state (dir)
215 "Find the CVS state of all files in DIR." 215 "Find the CVS state of all files in DIR and subdirectories."
216 ;; if DIR is not under CVS control, don't do anything. 216 ;; if DIR is not under CVS control, don't do anything.
217 (when (file-readable-p (expand-file-name "CVS/Entries" dir)) 217 (when (file-readable-p (expand-file-name "CVS/Entries" dir))
218 (if (vc-stay-local-p dir) 218 (if (vc-stay-local-p dir)
219 (vc-cvs-dir-state-heuristic dir) 219 (vc-cvs-dir-state-heuristic dir)
220 (let ((default-directory dir)) 220 (let ((default-directory dir))
221 ;; Don't specify DIR in this command, the default-directory is 221 ;; Don't specify DIR in this command, the default-directory is
222 ;; enough. Otherwise it might fail with remote repositories. 222 ;; enough. Otherwise it might fail with remote repositories.
223 (with-temp-buffer 223 (with-temp-buffer
224 (vc-cvs-command t 0 nil "status" "-l") 224 (buffer-disable-undo) ;; Because these buffers can get huge
225 (vc-cvs-command t 0 nil "status")
225 (goto-char (point-min)) 226 (goto-char (point-min))
226 (while (re-search-forward "^=+\n\\([^=\n].*\n\\|\n\\)+" nil t) 227 (while (re-search-forward "^=+\n\\([^=\n].*\n\\|\n\\)+" nil t)
227 (narrow-to-region (match-beginning 0) (match-end 0)) 228 (narrow-to-region (match-beginning 0) (match-end 0))
228 (vc-cvs-parse-status) 229 (vc-cvs-parse-status)
229 (goto-char (point-max)) 230 (goto-char (point-max))
282 "CVS-specific version of `vc-dired-state-info'." 283 "CVS-specific version of `vc-dired-state-info'."
283 (let ((cvs-state (vc-state file))) 284 (let ((cvs-state (vc-state file)))
284 (cond ((eq cvs-state 'edited) 285 (cond ((eq cvs-state 'edited)
285 (if (equal (vc-working-revision file) "0") 286 (if (equal (vc-working-revision file) "0")
286 "(added)" "(modified)")) 287 "(added)" "(modified)"))
287 ((eq cvs-state 'needs-patch) "(patch)") 288 (t
288 ((eq cvs-state 'needs-merge) "(merge)")))) 289 (vc-default-dired-state-info 'CVS file)))))
289
290 290
291 ;;; 291 ;;;
292 ;;; State-changing functions 292 ;;; State-changing functions
293 ;;; 293 ;;;
294 294
492 ) 492 )
493 (pop-to-buffer "*vc*") 493 (pop-to-buffer "*vc*")
494 (error "Couldn't analyze cvs update result"))) 494 (error "Couldn't analyze cvs update result")))
495 (message "Merging changes into %s...done" file)))) 495 (message "Merging changes into %s...done" file))))
496 496
497 (defun vc-cvs-modify-change-comment (files rev comment)
498 "Modify the change comments for FILES on a specified REV.
499 Will fail unless you have administrative privileges on the repo."
500 (vc-cvs-command nil 0 files "rcs" (concat "-m" comment ":" rev)))
497 501
498 ;;; 502 ;;;
499 ;;; History functions 503 ;;; History functions
500 ;;; 504 ;;;
501 505
502 (defun vc-cvs-print-log (files &optional buffer) 506 (defun vc-cvs-print-log (files &optional buffer)
503 "Get change log associated with FILE." 507 "Get change logs associated with FILES."
508 ;; It's just the catenation of the individual logs.
504 (vc-cvs-command 509 (vc-cvs-command
505 buffer 510 buffer
506 (if (vc-stay-local-p files) 'async 0) 511 (if (vc-stay-local-p files) 'async 0)
507 files "log")) 512 files "log"))
508 513
811 (list method user host root))))) 816 (list method user host root)))))
812 817
813 (defun vc-cvs-parse-status (&optional full) 818 (defun vc-cvs-parse-status (&optional full)
814 "Parse output of \"cvs status\" command in the current buffer. 819 "Parse output of \"cvs status\" command in the current buffer.
815 Set file properties accordingly. Unless FULL is t, parse only 820 Set file properties accordingly. Unless FULL is t, parse only
816 essential information." 821 essential information. Note that this can never set the 'ignored
822 state."
817 (let (file status) 823 (let (file status)
818 (goto-char (point-min)) 824 (goto-char (point-min))
825 (while (looking-at "? \\(.*\\)")
826 (setq file (expand-file-name (match-string 1)))
827 (vc-file-setprop file 'vc-state 'unregistered)
828 (forward-line 1))
819 (if (re-search-forward "^File: " nil t) 829 (if (re-search-forward "^File: " nil t)
820 (cond 830 (cond
821 ((looking-at "no file") nil) 831 ((looking-at "no file") nil)
822 ((re-search-forward "\\=\\([^ \t]+\\)" nil t) 832 ((re-search-forward "\\=\\([^ \t]+\\)" nil t)
823 (setq file (expand-file-name (match-string 1))) 833 (setq file (expand-file-name (match-string 1)))