changeset 42021:ddb97861a688

(vc-checkout-model, vc-state, vc-workfile-version): Return nil if FILE is not registered. (vc-check-master-templates, vc-default-make-version-backups-p): Doc fix.
author André Spiegel <spiegel@gnu.org>
date Fri, 14 Dec 2001 07:58:33 +0000
parents 6e891121e1cc
children 71f83b0dbf7f
files lisp/vc-hooks.el
diffstat 1 files changed, 21 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/vc-hooks.el	Fri Dec 14 07:54:28 2001 +0000
+++ b/lisp/vc-hooks.el	Fri Dec 14 07:58:33 2001 +0000
@@ -5,7 +5,7 @@
 ;; Author:     FSF (see vc.el for full credits)
 ;; Maintainer: Andre Spiegel <spiegel@gnu.org>
 
-;; $Id: vc-hooks.el,v 1.135 2001/11/09 14:58:21 spiegel Exp $
+;; $Id: vc-hooks.el,v 1.136 2001/12/11 07:35:18 pj Exp $
 
 ;; This file is part of GNU Emacs.
 
@@ -304,21 +304,23 @@
 (defun vc-checkout-model (file)
   "Indicate how FILE is checked out.
 
-Possible values:
+If FILE is not registered, this function always returns nil.
+For registered files, the possible values are:
 
-  'implicit   File is always writeable, and checked out `implicitly'
+  'implicit   FILE is always writeable, and checked out `implicitly'
               when the user saves the first changes to the file.
 
-  'locking    File is read-only if up-to-date; user must type
+  'locking    FILE is read-only if up-to-date; user must type
               \\[vc-toggle-read-only] before editing.  Strict locking
               is assumed.
 
-  'announce   File is read-only if up-to-date; user must type
+  'announce   FILE is read-only if up-to-date; user must type
               \\[vc-toggle-read-only] before editing.  But other users
               may be editing at the same time."
   (or (vc-file-getprop file 'vc-checkout-model)
-      (vc-file-setprop file 'vc-checkout-model
-                       (vc-call checkout-model file))))
+      (if (vc-backend file)
+          (vc-file-setprop file 'vc-checkout-model
+                           (vc-call checkout-model file)))))
 
 (defun vc-user-login-name (&optional uid)
   "Return the name under which the user is logged in, as a string.
@@ -332,7 +334,8 @@
 (defun vc-state (file)
   "Return the version control state of FILE.
 
-The value returned is one of:
+If FILE is not registered, this function always returns nil.
+For registered files, the value returned is one of:
 
   'up-to-date        The working file is unmodified with respect to the
                      latest version on the current branch, and not locked.
@@ -360,8 +363,9 @@
                      should be resolved by the user (vc-next-action will
                      prompt the user to do it)."
   (or (vc-file-getprop file 'vc-state)
-      (vc-file-setprop file 'vc-state
-		       (vc-call state-heuristic file))))
+      (if (vc-backend file)
+          (vc-file-setprop file 'vc-state
+                           (vc-call state-heuristic file)))))
 
 (defsubst vc-up-to-date-p (file)
   "Convenience function that checks whether `vc-state' of FILE is `up-to-date'."
@@ -374,10 +378,12 @@
    (vc-call-backend backend 'state file))
 
 (defun vc-workfile-version (file)
-  "Return version level of the current workfile FILE."
+  "Return the version level of the current workfile FILE.
+If FILE is not registered, this function always returns nil."
   (or (vc-file-getprop file 'vc-workfile-version)
-      (vc-file-setprop file 'vc-workfile-version
-                       (vc-call workfile-version file))))
+      (if (vc-backend file)
+          (vc-file-setprop file 'vc-workfile-version
+                           (vc-call workfile-version file)))))
 
 ;;; actual version-control code starts here
 
@@ -412,8 +418,7 @@
       (if (consp result) (car result) result)))))
 
 (defun vc-check-master-templates (file templates)
-  "Return non-nil if there is a master corresponding to FILE,
-according to any of the elements in TEMPLATES.
+  "Return non-nil if there is a master corresponding to FILE.
 
 TEMPLATES is a list of strings or functions.  If an element is a
 string, it must be a control string as required by `format', with two
@@ -463,7 +468,7 @@
 (define-key global-map "\C-x\C-q" 'vc-toggle-read-only)
 
 (defun vc-default-make-version-backups-p (backend file)
-  "Return non-nil if unmodified repository versions should be backed up locally.
+  "Return non-nil if unmodified versions should be backed up locally.
 The default is to switch off this feature."
   nil)