X-Git-Url: https://git.hcoop.net/bpt/emacs.git/blobdiff_plain/18e1f24981ba72ede1fb434568e18ed0e46debbd..4b03e20a6f086c901d7e183a905ee9097a6de0b6:/lisp/vc-cvs.el diff --git a/lisp/vc-cvs.el b/lisp/vc-cvs.el index f5c86d4ead..975a24dcd4 100644 --- a/lisp/vc-cvs.el +++ b/lisp/vc-cvs.el @@ -1,7 +1,7 @@ ;;; vc-cvs.el --- non-resident support for CVS version-control ;; Copyright (C) 1995, 1998, 1999, 2000, 2001, 2002, 2003, -;; 2004, 2005, 2006, 2007 Free Software Foundation, Inc. +;; 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. ;; Author: FSF (see vc.el for full credits) ;; Maintainer: Andre Spiegel @@ -285,9 +285,8 @@ committed and support display of sticky tags." (cond ((eq cvs-state 'edited) (if (equal (vc-working-revision file) "0") "(added)" "(modified)")) - ((eq cvs-state 'needs-patch) "(patch)") - ((eq cvs-state 'needs-merge) "(merge)")))) - + (t + (vc-default-dired-state-info 'CVS file))))) ;;; ;;; State-changing functions @@ -299,15 +298,18 @@ COMMENT can be used to provide an initial description of FILES. `vc-register-switches' and `vc-cvs-register-switches' are passed to the CVS command (in that order)." - (when (and (not (vc-cvs-responsible-p file)) - (vc-cvs-could-register file)) - ;; Register the directory if needed. - (vc-cvs-register (directory-file-name (file-name-directory file)))) - (apply 'vc-cvs-command nil 0 files - "add" - (and comment (string-match "[^\t\n ]" comment) - (concat "-m" comment)) - (vc-switches 'CVS 'register))) + ;; Register the directories if needed. + (let (dirs) + (dolist (file files) + (and (not (vc-cvs-responsible-p file)) + (vc-cvs-could-register file) + (push (directory-file-name (file-name-directory file)) dirs))) + (if dirs (vc-cvs-register dirs))) + (apply 'vc-cvs-command nil 0 files + "add" + (and comment (string-match "[^\t\n ]" comment) + (concat "-m" comment)) + (vc-switches 'CVS 'register))) (defun vc-cvs-responsible-p (file) "Return non-nil if CVS thinks it is responsible for FILE." @@ -454,7 +456,7 @@ The changes are between FIRST-REVISION and SECOND-REVISION." (message "Merging changes into %s..." file) ;; (vc-file-setprop file 'vc-working-revision nil) (vc-file-setprop file 'vc-checkout-time 0) - (vc-cvs-command nil 0 file "update") + (vc-cvs-command nil nil file "update") ;; Analyze the merge result reported by CVS, and set ;; file properties accordingly. (with-current-buffer (get-buffer "*vc*") @@ -649,11 +651,14 @@ systime, or nil if there is none." bol (1+ bol) 'vc-cvs-annotate-time (setq cache (cons ;; Position at end makes for nicer overlay result. - (match-end 0) + ;; Don't put actual buffer pos here, but only relative + ;; distance, so we don't ever move backward in the + ;; goto-char below, even if the text is moved. + (- (match-end 0) (match-beginning 0)) (vc-annotate-convert-time (encode-time 0 0 0 day month year)))))))) (when cache - (goto-char (car cache)) ; fontify from here to eol + (goto-char (+ bol (car cache))) ; Fontify from here to eol. (cdr cache)))) ; days (float) (defun vc-cvs-annotate-extract-revision-at-line () @@ -731,6 +736,9 @@ If UPDATE is non-nil, then update (resynch) any affected buffers." ;;; Internal functions ;;; +(defun vc-cvs-root (dir) + (vc-find-root dir "CVS" t)) + (defun vc-cvs-command (buffer okstatus files &rest flags) "A wrapper around `vc-do-command' for use in vc-cvs.el. The difference to vc-do-command is that this function always invokes `cvs', @@ -819,9 +827,14 @@ For an empty string, nil is returned (invalid CVS root)." (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." +essential information. Note that this can never set the 'ignored +state." (let (file status) (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)) (if (re-search-forward "^File: " nil t) (cond ((looking-at "no file") nil) @@ -943,6 +956,7 @@ is non-nil." (cond ;; entry for a "locally added" file (not yet committed) ((looking-at "/[^/]+/0/") + (vc-file-setprop file 'vc-backend 'CVS) (vc-file-setprop file 'vc-checkout-time 0) (vc-file-setprop file 'vc-working-revision "0") (if set-state (vc-file-setprop file 'vc-state 'edited))) @@ -958,6 +972,7 @@ is non-nil." ;; sticky tag "\\(.\\|\\)" ;Sticky tag type (date or tag name, could be empty) "\\(.*\\)")) ;Sticky tag + (vc-file-setprop file 'vc-backend 'CVS) (vc-file-setprop file 'vc-working-revision (match-string 1)) (vc-file-setprop file 'vc-cvs-sticky-tag (vc-cvs-parse-sticky-tag (match-string 4)