]> code.delx.au - gnu-emacs/blobdiff - lisp/vc-mcvs.el
(gnus-original-article-buffer, mail-reply-buffer, rmail-current-message):
[gnu-emacs] / lisp / vc-mcvs.el
index 1f59f5f3280fd3913462931fbc6edf3d31632d50..271cd01cbfbe1da5ba24963673c14c7c3b8dbc46 100644 (file)
@@ -1,6 +1,6 @@
 ;;; vc-mcvs.el --- VC backend for the Meta-CVS version-control system
 
-;; Copyright (C) 1995,98,99,2000,01,02,2003  Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
 
 ;; Author:      FSF (see vc.el for full credits)
 ;; Maintainer:  Stefan Monnier <monnier@gnu.org>
 
 ;; You should have received a copy of the GNU General Public License
 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
 
 ;;; Commentary:
 
 ;; The home page of the Meta-CVS version control system is at
-;; 
+;;
 ;;      http://users.footprints.net/~kaz/mcvs.html
-;; 
+;;
 ;; This is derived from vc-cvs.el as follows:
 ;; - cp vc-cvs.el vc-mcvs.el
 ;; - Replace CVS/ with MCVS/CVS/
@@ -69,7 +69,7 @@
                 (repeat :tag "Argument List"
                         :value ("")
                         string))
-  :version "21.4"
+  :version "22.1"
   :group 'vc)
 
 (defcustom vc-mcvs-register-switches nil
@@ -81,7 +81,7 @@ A string or list of strings passed to the checkin program by
                 (repeat :tag "Argument List"
                         :value ("")
                         string))
-  :version "21.4"
+  :version "22.1"
   :group 'vc)
 
 (defcustom vc-mcvs-diff-switches nil
@@ -91,13 +91,13 @@ A string or list of strings passed to the checkin program by
                 (repeat :tag "Argument List"
                         :value ("")
                         string))
-  :version "21.4"
+  :version "22.1"
   :group 'vc)
 
 (defcustom vc-mcvs-header (or (cdr (assoc 'MCVS vc-header-alist))
                              vc-cvs-header)
   "*Header keywords to be inserted by `vc-insert-headers'."
-  :version "21.4"
+  :version "22.1"
   :type '(repeat string)
   :group 'vc)
 
@@ -106,7 +106,7 @@ A string or list of strings passed to the checkin program by
 This is only meaningful if you don't use the implicit checkout model
 \(i.e. if you have $CVSREAD set)."
   :type 'boolean
-  :version "21.4"
+  :version "22.1"
   :group 'vc)
 
 ;;;
@@ -114,32 +114,15 @@ This is only meaningful if you don't use the implicit checkout model
 ;;;
 
 ;;;###autoload (defun vc-mcvs-registered (file)
-;;;###autoload   (let ((dir file))
-;;;###autoload     (while (and (stringp dir)
-;;;###autoload                 (not (equal
-;;;###autoload                       dir (setq dir (file-name-directory dir))))
-;;;###autoload                 dir)
-;;;###autoload       (setq dir (if (file-directory-p
-;;;###autoload                      (expand-file-name "MCVS/CVS" dir))
-;;;###autoload                     t (directory-file-name dir))))
-;;;###autoload     (if (eq dir t)
-;;;###autoload          (progn
-;;;###autoload           (load "vc-mcvs")
-;;;###autoload           (vc-mcvs-registered file)))))
+;;;###autoload   (if (vc-find-root file "MCVS/CVS")
+;;;###autoload       (progn
+;;;###autoload         (load "vc-mcvs")
+;;;###autoload         (vc-mcvs-registered file))))
 
 (defun vc-mcvs-root (file)
   "Return the root directory of a Meta-CVS project, if any."
   (or (vc-file-getprop file 'mcvs-root)
-      (vc-file-setprop
-       file 'mcvs-root
-       (let ((root nil))
-        (while (not (or root
-                        (equal file (setq file (file-name-directory file)))
-                        (null file)))
-          (if (file-directory-p (expand-file-name "MCVS/CVS" file))
-              (setq root file)
-            (setq file (directory-file-name file))))
-        root))))
+      (vc-file-setprop file 'mcvs-root (vc-find-root file "MCVS/CVS"))))
 
 (defun vc-mcvs-read (file)
   (if (file-readable-p file)
@@ -170,13 +153,6 @@ This is only meaningful if you don't use the implicit checkout model
                         0))
       t)))
 
-(defmacro vc-mcvs-cvs (op file &rest args)
-  (declare (debug t))
-  `(,(intern (concat "vc-cvs-" (symbol-name op)))
-    (expand-file-name (vc-file-getprop ,file 'mcvs-inode)
-                     (vc-file-getprop ,file 'mcvs-root))
-    ,@args))
-
 (defun vc-mcvs-state (file)
   ;; This would assume the Meta-CVS sandbox is synchronized.
   ;; (vc-mcvs-cvs state file))
@@ -215,19 +191,13 @@ This is only meaningful if you don't use the implicit checkout model
            (goto-char (point-max))
            (widen)))))))
 
-(defun vc-mcvs-workfile-version (file) (vc-mcvs-cvs workfile-version file))
+(defun vc-mcvs-workfile-version (file)
+  (vc-cvs-workfile-version
+   (expand-file-name (vc-file-getprop file 'mcvs-inode)
+                    (vc-file-getprop file 'mcvs-root))))
 
 (defalias 'vc-mcvs-checkout-model 'vc-cvs-checkout-model)
 
-(defun vc-mcvs-mode-line-string (file)
-  (let ((s (vc-mcvs-cvs mode-line-string file)))
-    (when s
-      (if (and (not (memq (vc-state file) '(up-to-date needs-patch)))
-              (string-match "\\`CVS-" s))
-         ;; The CVS file is not in sync, so we need to adjust the state.
-         (concat "MCVS:" (substring s 4))
-       (concat "M" s)))))
-
 ;;;
 ;;; State-changing functions
 ;;;
@@ -451,17 +421,17 @@ The changes are between FIRST-VERSION and SECOND-VERSION."
 ;;; History functions
 ;;;
 
-(defun vc-mcvs-print-log (file)
+(defun vc-mcvs-print-log (file &optional buffer)
   "Get change log associated with FILE."
   (let ((default-directory (vc-mcvs-root file)))
     ;; Run the command from the root dir so that `mcvs filt' returns
     ;; valid relative names.
     (vc-mcvs-command
-     nil
+     buffer
      (if (and (vc-stay-local-p file) (fboundp 'start-process)) 'async 0)
      file "log")))
 
-(defun vc-mcvs-diff (file &optional oldvers newvers)
+(defun vc-mcvs-diff (file &optional oldvers newvers buffer)
   "Get a difference report using Meta-CVS between two versions of FILE."
   (if (string= (vc-workfile-version file) "0")
       ;; This file is added but not yet committed; there is no master file.
@@ -470,17 +440,19 @@ The changes are between FIRST-VERSION and SECOND-VERSION."
        ;; We regard this as "changed".
        ;; Diff it against /dev/null.
        ;; Note: this is NOT a "mcvs diff".
-       (apply 'vc-do-command "*vc-diff*"
+       (apply 'vc-do-command (or buffer "*vc-diff*")
               1 "diff" file
               (append (vc-switches nil 'diff) '("/dev/null")))
        ;; Even if it's empty, it's locally modified.
        1)
-    (let* ((async (and (vc-stay-local-p file) (fboundp 'start-process)))
+    (let* ((async (and (not vc-disable-async-diff)
+                       (vc-stay-local-p file)
+                       (fboundp 'start-process)))
           ;; Run the command from the root dir so that `mcvs filt' returns
           ;; valid relative names.
           (default-directory (vc-mcvs-root file))
           (status
-           (apply 'vc-mcvs-command "*vc-diff*"
+           (apply 'vc-mcvs-command (or buffer "*vc-diff*")
                   (if async 'async 1)
                   file "diff"
                   (and oldvers (concat "-r" oldvers))
@@ -507,7 +479,11 @@ Optional arg VERSION is a version to annotate from."
   (vc-mcvs-command
    buffer
    (if (and (vc-stay-local-p file) (fboundp 'start-process)) 'async 0)
-   file "annotate" (if version (concat "-r" version))))
+   file "annotate" (if version (concat "-r" version)))
+  (with-current-buffer buffer
+    (goto-char (point-min))
+    (re-search-forward "^[0-9]")
+    (delete-region (point-min) (1- (point)))))
 
 (defalias 'vc-mcvs-annotate-current-time 'vc-cvs-annotate-current-time)
 (defalias 'vc-mcvs-annotate-time 'vc-cvs-annotate-time)
@@ -589,7 +565,7 @@ and that it passes `vc-mcvs-global-switches' to it before FLAGS."
       ;; We need to filter the output.
       ;; The output of the filter uses filenames relative to the root,
       ;; so we need to change the default-directory.
-      (assert (equal default-directory (vc-mcvs-root file)))
+      ;; (assert (equal default-directory (vc-mcvs-root file)))
       (vc-do-command
        buffer okstatus "sh" nil "-c"
        (concat "mcvs "
@@ -620,4 +596,6 @@ and that it passes `vc-mcvs-global-switches' to it before FLAGS."
 (defalias 'vc-mcvs-valid-version-number-p 'vc-cvs-valid-version-number-p)
 
 (provide 'vc-mcvs)
+
+;; arch-tag: a39c7c1c-5247-429d-88df-dd7187d2e704
 ;;; vc-mcvs.el ends here