]> code.delx.au - gnu-emacs/blobdiff - lisp/vc-rcs.el
(sgml-font-lock-keywords-2): Add flag to merge with existing fontification.
[gnu-emacs] / lisp / vc-rcs.el
index 9a4c4e89dd7afe3c4d445676290d911fac10dc28..23686006ac5b3b93f9f4695dd5d4eb4413548448 100644 (file)
@@ -5,7 +5,7 @@
 ;; Author:     FSF (see vc.el for full credits)
 ;; Maintainer: Andre Spiegel <spiegel@gnu.org>
 
-;; $Id: vc-rcs.el,v 1.28 2002/10/08 15:33:18 monnier Exp $
+;; $Id: vc-rcs.el,v 1.34 2003/01/03 15:27:35 spiegel Exp $
 
 ;; This file is part of GNU Emacs.
 
@@ -99,8 +99,13 @@ For a description of possible values, see `vc-check-master-templates'."
 ;;; State-querying functions
 ;;;
 
-;;;###autoload
-(progn (defun vc-rcs-registered (f) (vc-default-registered 'RCS f)))
+;;; The autoload cookie below places vc-rcs-registered directly into
+;;; loaddefs.el, so that vc-rcs.el does not need to be loaded for
+;;; every file that is visited.  The definition is repeated below
+;;; so that Help and etags can find it.
+
+;;;###autoload (defun vc-rcs-registered (f) (vc-default-registered 'RCS f))
+(defun vc-rcs-registered (f) (vc-default-registered 'RCS f))
 
 (defun vc-rcs-state (file)
   "Implementation of `vc-state' for RCS."
@@ -320,6 +325,8 @@ whether to remove it."
                         default-branch)
           (setq rev default-branch)
           (setq switches (cons "-f" switches)))
+      (if (and (not rev) old-version)
+          (setq rev (vc-branch-part old-version)))
       (apply 'vc-do-command nil 0 "ci" (vc-name file)
             ;; if available, use the secure check-in option
             (and (vc-rcs-release-p "5.6.4") "-j")
@@ -395,12 +402,24 @@ whether to remove it."
                   ;; the writable workfile.
                   (if (eq (vc-checkout-model file) 'implicit) "-f")
                   (if editable "-l")
-                  (if rev (concat "-r" rev)
-                    ;; if no explicit revision was specified,
-                    ;; check out that of the working file
-                    (let ((workrev (vc-workfile-version file)))
-                      (if workrev (concat "-r" workrev)
-                        nil)))
+                   (if (stringp rev)
+                       ;; a literal revision was specified
+                       (concat "-r" rev)
+                     (let ((workrev (vc-workfile-version file)))
+                       (if workrev
+                           (concat "-r" 
+                                   (if (not rev)
+                                       ;; no revision specified:
+                                       ;; use current workfile version
+                                       workrev
+                                     ;; REV is t ...
+                                     (if (not (vc-trunk-p workrev))
+                                         ;; ... go to head of current branch
+                                         (vc-branch-part workrev)
+                                       ;; ... go to head of trunk
+                                       (vc-rcs-set-default-branch file
+                                                                  nil)
+                                       ""))))))
                   switches)
            ;; determine the new workfile version
            (with-current-buffer "*vc*"
@@ -420,7 +439,8 @@ whether to remove it."
 (defun vc-rcs-revert (file &optional contents-done)
   "Revert FILE to the version it was based on."
   (vc-do-command nil 0 "co" (vc-name file) "-f"
-                (concat "-u" (vc-workfile-version file))))
+                 (concat (if (eq (vc-state file) 'edited) "-u" "-r") 
+                         (vc-workfile-version file))))
 
 (defun vc-rcs-cancel-version (file editable)
   "Undo the most recent checkin of FILE.