changeset 43450:2b50b9c69fde

Patch by Jonathan Kamens <jik@kamens.brookline.ma.us>. (vc-default-init-version): Update documentation to indicate that the backend can override the default init version. (vc-register): Use the backend init-version function, if it exists, to determine the initial version of a file. (vc-diff-switches-list): Don't symbol-quote backend, since it's already a symbol. Don't fail if vc-BACKEND-diff-switches isn't bound.
author André Spiegel <spiegel@gnu.org>
date Thu, 21 Feb 2002 21:00:35 +0000
parents a6beccc5505e
children cea4b3c48c94
files lisp/vc.el
diffstat 1 files changed, 20 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/vc.el	Thu Feb 21 20:56:58 2002 +0000
+++ b/lisp/vc.el	Thu Feb 21 21:00:35 2002 +0000
@@ -6,7 +6,7 @@
 ;; Maintainer: Andre Spiegel <spiegel@gnu.org>
 ;; Keywords: tools
 
-;; $Id: vc.el,v 1.324 2001/12/20 18:47:19 pj Exp $
+;; $Id: vc.el,v 1.325 2002/01/05 17:15:20 spiegel Exp $
 
 ;; This file is part of GNU Emacs.
 
@@ -171,6 +171,12 @@
 ;;   The implementation should pass the value of vc-register-switches
 ;;   to the backend command.
 ;;
+;; - init-version (file)
+;;
+;;   The initial version to use when registering FILE if one is not
+;;   specified by the user.  If not provided, the variable
+;;   vc-default-init-version is used instead.
+;;
 ;; - responsible-p (file)
 ;;
 ;;   Return non-nil if this backend considers itself "responsible" for
@@ -429,7 +435,8 @@
 
 (defcustom vc-default-init-version "1.1"
   "*A string used as the default version number when a new file is registered.
-This can be overridden by giving a prefix argument to \\[vc-register]."
+This can be overridden by giving a prefix argument to \\[vc-register].  This
+can also be overridden by a particular VC backend."
   :type 'string
   :group 'vc
   :version "20.3")
@@ -1342,8 +1349,10 @@
                   (if set-version
                       (read-string (format "Initial version level for %s: "
 					   (buffer-name)))
-                    ;; TODO: Use backend-specific init version.
-                    vc-default-init-version)
+		    (let ((backend (vc-responsible-backend buffer-file-name)))
+		      (if (vc-find-backend-function backend 'init-version)
+			  (vc-call-backend backend 'init-version)
+			vc-default-init-version)))
                   (or comment (not vc-initial-comment))
 		  nil
                   "Enter initial comment."
@@ -1867,9 +1876,13 @@
   `(append
     (if (listp diff-switches) diff-switches (list diff-switches))
     (if (listp vc-diff-switches) vc-diff-switches (list vc-diff-switches))
-    (let ((backend-switches
-           (eval (intern (concat "vc-" (symbol-name ',backend)
-                                 "-diff-switches")))))
+    (let* ((backend-switches-symbol
+	    (intern (concat "vc-" (symbol-name ,backend)
+			    "-diff-switches")))
+	   (backend-switches
+	    (if (boundp backend-switches-symbol)
+		(eval backend-switches-symbol)
+	      nil)))
       (if (listp backend-switches) backend-switches (list backend-switches)))))
 
 (defun vc-default-diff-tree (backend dir rel1 rel2)