Commits

Anonymous committed 84e9b11

Make the cvs command customizable, doc updates <8yz3jf0j.fsf@dresdner-bank.com>

Comments (0)

Files changed (2)

+2002-12-09  Ville Skyttä  <scop@xemacs.org>
+
+	* vc.el: Documentation updates, convert comments to
+	docstrings and grab some from GNU Emacs.
+
+2002-12-09  Christian Schmitt  <Christian.Schmitt@dresdner-bank.com>
+
+	* vc.el: Make the CVS executable customizable.
+
 2002-11-29  Ben Wing  <ben@xemacs.org>
 
 	* .cvsignore: Remove files now handled automatically by CVS.
 		 string)
   :group 'vc)
 
+(defcustom vc-cvs-program "cvs"
+  "*Executable to run for CVS commands."
+  :type 'file
+  :group 'vc)
+
 ;; Variables the user doesn't need to know about.
 (defvar vc-log-entry-mode nil)
 (defvar vc-log-operation nil)
 	(setq vc-rcs-release 'unknown)))
    ((eq backend 'CVS)
     (or vc-cvs-release
-	(and (zerop (vc-do-command nil 1 "cvs" nil nil "-v"))
+	(and (zerop (vc-do-command nil 1 vc-cvs-program nil nil "-v"))
 	     (save-excursion
 	       (set-buffer (get-buffer "*vc*"))
 	       (setq vc-cvs-release
 ;;; functions that operate on RCS revision numbers
 
 (defun vc-trunk-p (rev)
-  ;; return t if REV is a revision on the trunk
+  "Return t if REV is a revision on the trunk."
   (not (eq nil (string-match "\\`[0-9]+\\.[0-9]+\\'" rev))))
 
 (defun vc-branch-part (rev)
-  ;; return the branch part of a revision number REV
+  "Return the branch part of a revision number REV."
   (substring rev 0 (string-match "\\.[0-9]+\\'" rev)))
 
 (defun vc-minor-part (rev)
-  ;; return the minor version number of a revision number REV
+  "Return the minor version number of a revision number REV."
   (string-match "[0-9]+\\'" rev)
   (substring rev (match-beginning 0) (match-end 0)))
 
 (defun vc-previous-version (rev)
-  ;; guess the previous version number
+  "Guess the version number immediately preceding REV."
   (let ((branch (vc-branch-part rev))
         (minor-num (string-to-number (vc-minor-part rev))))
     (if (> minor-num 1)
      t))
 
 (defun vc-ensure-vc-buffer ()
-  ;; Make sure that the current buffer visits a version-controlled file.
+  "Make sure that the current buffer visits a version-controlled file."
   (if vc-dired-mode
       (set-buffer (find-file-noselect (dired-get-filename)))
     (while vc-parent-buffer
     status)
   )
 
-;;; Save a bit of the text around POSN in the current buffer, to help
-;;; us find the corresponding position again later.  This works even
-;;; if all markers are destroyed or corrupted.
 ;;; A lot of this was shamelessly lifted from Sebastian Kremer's rcs.el mode.
 (defun vc-position-context (posn)
+  "Save a bit of the text around POSN in the current buffer.
+Used to help us find the corresponding position again later
+if markers are destroyed or corrupted."
   (list posn
 	(buffer-size)
 	(buffer-substring posn
 			  (min (point-max) (+ posn 100)))))
 
-;;; Return the position of CONTEXT in the current buffer, or nil if we
-;;; couldn't find it.
 (defun vc-find-position-by-context (context)
+  "Return the position of CONTEXT in the current buffer, or nil if we
+couldn't find it."
   (let ((context-string (nth 2 context)))
     (if (equal "" context-string)
 	(point-max)
 	      (- (point) (length context-string))))))))
 
 (defun vc-buffer-context ()
-  ;; Return a list '(point-context mark-context reparse); from which
-  ;; vc-restore-buffer-context can later restore the context.
+  "Return a list (POINT-CONTEXT MARK-CONTEXT REPARSE).
+Used by `vc-restore-buffer-context' to later restore the context."
   (let ((point-context (vc-position-context (point)))
 	;; Use mark-marker to avoid confusion in transient-mark-mode.
 	(mark-context  (if (eq (marker-buffer (mark-marker #+xemacs t))
     (list point-context mark-context reparse)))
 
 (defun vc-restore-buffer-context (context)
-  ;; Restore point/mark, and reparse any affected compilation buffers.
-  ;; CONTEXT is that which vc-buffer-context returns.
+  "Restore point/mark, and reparse any affected compilation buffers.
+CONTEXT is that which `vc-buffer-context' returns."
   (let ((point-context (nth 0 context))
 	(mark-context (nth 1 context))
 	(reparse (nth 2 context)))
 
 
 (defun vc-buffer-sync (&optional not-urgent)
-  ;; Make sure the current buffer and its working file are in sync
-  ;; NOT-URGENT means it is ok to continue if the user says not to save.
+  "Make sure the current buffer and its working file are in sync.
+NOT-URGENT means it is ok to continue if the user says not to save."
   (if (buffer-modified-p)
       (if (or vc-suppress-confirm
 	      (y-or-n-p (format "Buffer %s modified; save it? " (buffer-name))))
 
 
 (defun vc-workfile-unchanged-p (file &optional want-differences-if-changed)
-  ;; Has the given workfile changed since last checkout?
+  "Return non-nil if FILE has not changed since the last checkout."
   (let ((checkout-time (vc-file-getprop file 'vc-checkout-time))
 	(lastmod (nth 5 (file-attributes file))))
     (or (equal checkout-time lastmod)
 	       unchanged)))))
 
 (defun vc-next-action-on-file (file verbose &optional comment)
-  ;;; If comment is specified, it will be used as an admin or checkin comment.
+  "Do The Right Thing for a given FILE under version control.
+If COMMENT is specified, it will be used as an admin or checkin comment.
+If VERBOSE is non-nil, query the user rather than using default parameters."
   (let ((vc-file (vc-name file))
 	(vc-type (vc-backend file))
 	owner version buffer)
 
 ;;;###autoload
 (defun vc-next-action (verbose)
-  "Do the next logical checkin or checkout operation on the current file.
+  "Do the next logical version control operation on the current file.
+
    If you call this from within a VC dired buffer with no files marked,
 it will operate on the file in the current line.
+
    If you call this from within a VC dired buffer, and one or more
 files are marked, it will accept a log message and then operate on
 each one.  The log message will be used as a comment for any register
    comment))
 
 (defun vc-resynch-window (file &optional keep noquery)
-  ;; If the given file is in the current buffer,
-  ;; either revert on it so we see expanded keywords,
-  ;; or unvisit it (depending on vc-keep-workfiles)
-  ;; NOQUERY if non-nil inhibits confirmation for reverting.
-  ;; NOQUERY should be t *only* if it is known the only difference
-  ;; between the buffer and the file is due to RCS rather than user editing!
+  "If FILE is in the current buffer, either revert or unvisit it.
+The choice between revert (to see expanded keywords) and unvisit depends on
+`vc-keep-workfiles'.  NOQUERY if non-nil inhibits confirmation for
+reverting.  NOQUERY should be t *only* if it is known that the only
+difference between the buffer and the file is due to version control
+rather than user editing!"
   (and (string= buffer-file-name file)
        (if keep
 	   (progn
 	 (kill-buffer (current-buffer)))))
 
 (defun vc-resynch-buffer (file &optional keep noquery)
-  ;; if FILE is currently visited, resynch its buffer
+  "If FILE is currently visited, resynch its buffer."
   (let ((buffer (get-file-buffer file)))
     (if buffer
 	(with-current-buffer buffer
 	  (vc-resynch-window file keep noquery)))))
 
 (defun vc-start-entry (file rev comment msg action &optional after-hook)
-  ;; Accept a comment for an operation on FILE revision REV.  If COMMENT
-  ;; is nil, pop up a VC-log buffer, emit MSG, and set the
-  ;; action on close to ACTION; otherwise, do action immediately.
-  ;; Remember the file's buffer in vc-parent-buffer (current one if no file).
-  ;; AFTER-HOOK specifies the local value for vc-log-operation-hook.
+  "Accept a comment for an operation on FILE revision REV.
+If COMMENT is nil, pop up a VC-log buffer, emit MSG, and set the
+action on close to ACTION; otherwise, do action immediately.
+Remember the file's buffer in `vc-parent-buffer' (current one if no file).
+AFTER-HOOK specifies the local value for `vc-log-after-operation-hook'."
   (let ((parent (if file (find-file-noselect file) (current-buffer))))
     (if vc-before-checkin-hook
         (if file
 ;; XEmacs: Function referred to in vc-hooks.el.
 ;;;###autoload
 (defun vc-checkout (file &optional writable rev)
-  "Retrieve a copy of the latest version of the given file."
+  "Retrieve a copy of the revision REV of FILE.
+If WRITABLE is non-nil, make sure the retrieved file is writable.
+REV defaults to the latest revision."
   ;; If ftp is on this system and the name matches the ange-ftp format
   ;; for a remote file, the user is trying something that won't work.
   (if (and (string-match "^/[^/:]+:" file) (vc-find-binary "ftp"))
   (vc-resynch-buffer file t t))
 
 (defun vc-steal-lock (file rev &optional owner)
-  "Steal the lock on the current workfile."
+  "Steal the lock on FILE."
   (let (file-description)
     (if (not owner)
 	(setq owner (vc-locking-user file)))
 ;;; Here is a checkin hook that may prove useful to sites using the
 ;;; ChangeLog facility supported by Emacs.
 (defun vc-comment-to-change-log (&optional whoami file-name)
-  "Enter last VC comment into change log file for current buffer's file.
-Optional arg (interactive prefix) non-nil means prompt for user name and site.
-Second arg is file name of change log.  \
-If nil, uses `change-log-default-name'."
+  "Enter last VC comment into the change log file for the current file.
+WHOAMI (interactive prefix) non-nil means prompt for user name and site.
+FILE-NAME is the name of the change log; if nil, use
+`change-log-default-name'."
   (interactive (if current-prefix-arg
 		   (list current-prefix-arg
 			 (prompt-for-change-log-name))))
 
 ;;;###autoload
 (defun vc-insert-headers ()
-  "Insert headers in a file for use with your version-control system.
+  "Insert headers into a file for use with a version control system.
 Headers desired are inserted at the start of the buffer, and are pulled from
 the variable `vc-header-alist'."
   (interactive)
 ;;;###autoload
 (defun vc-cancel-version (norevert)
   "Get rid of most recently checked in version of this file.
-A prefix argument means do not revert the buffer afterwards."
+A prefix argument NOREVERT means do not revert the buffer afterwards."
   (interactive "P")
   (if vc-dired-mode
       (find-file-other-window (dired-get-filename)))
 
 ;;;###autoload
 (defun vc-update-change-log (&rest args)
-  "Find change log file and add entries from recent RCS/CVS logs.
+  "Find change log file and add entries from recent version control logs.
 Normally, find log entries for all registered files in the default
 directory using `rcs2log', which finds CVS logs preferentially.
 The mark is left at the end of the text prepended to the change log.
 
-With prefix arg of C-u, only find log entries for the current buffer's file.
+With prefix arg of \\[universal-argument], only find log entries for the current buffer's file.
 
 With any numeric prefix arg, find log entries for all currently visited
 files that are under version control.  This puts all the entries in the
 log for the default directory, which may not be appropriate.
 
-From a program, any arguments are assumed to be filenames and are
+From a program, any ARGS are assumed to be filenames and are
 passed to the `rcs2log' script after massaging to be relative to the
 default directory."
   (interactive
   ;;   (cons "VC-Annotate" vc-annotate-mode-menu)))
 
 (defun vc-annotate-mode ()
-  "Major mode for buffers displaying output from the CVS `annotate' command.
+  "Major mode for output buffers of the `vc-annotate' command.
 
 You can use the mode-specific menu to alter the time-span of the used
 colors.  See variable `vc-annotate-menu-elements' for customizing the
 	(temp-buffer-show-function 'vc-annotate-display)
 	(vc-annotate-ratio ratio))
     (with-output-to-temp-buffer temp-buffer-name
-      (call-process "cvs" nil (get-buffer temp-buffer-name) nil
+      (call-process vc-cvs-program nil (get-buffer temp-buffer-name) nil
 		    "annotate" (file-name-nondirectory (buffer-file-name)))))
   (message "Annotating... done"))
 
                                  (and comment (concat "-t-" comment))
                                  switches))
 	  ((eq backend 'CVS)
-	   (apply 'vc-do-command nil 0 "cvs" file 'WORKFILE ;; CVS
+	   (apply 'vc-do-command nil 0 vc-cvs-program file 'WORKFILE ;; CVS
                                  "add"
                                  (and comment (string-match "[^\t\n ]" comment)
                                       (concat "-m" comment))
 		;; XEmacs change: use (with-temp-file) istead of sh kludgery 
 		(with-temp-file filename
 		  (apply 'vc-do-command
-			 (current-buffer) 0 "cvs" file 'WORKFILE
+			 (current-buffer) 0 vc-cvs-program file 'WORKFILE
 			 "update"
 			 (concat "-r" rev)
 			 "-p"
 	      ;; default for verbose checkout: clear the sticky tag
 	      ;; so that the actual update will get the head of the trunk
 	      (and rev (string= rev "")
-		   (vc-do-command nil 0 "cvs" file 'WORKFILE "update" "-A"))
+		   (vc-do-command nil 0 vc-cvs-program file 'WORKFILE "update" "-A"))
 	      ;; If a revision was specified, check that out.
 	      (if rev
-		  (apply 'vc-do-command nil 0 "cvs" file 'WORKFILE 
+		  (apply 'vc-do-command nil 0 vc-cvs-program file 'WORKFILE 
 			 (and writable (eq (vc-checkout-model file) 'manual) "-w")
 			 "update"
 			 (and rev (not (string= rev ""))
 		;; If no revision was specified, call "cvs edit" to make
                 ;; the file writeable.
 		(and writable (eq (vc-checkout-model file) 'manual)
-                     (vc-do-command nil 0 "cvs" file 'WORKFILE "edit")))
+                     (vc-do-command nil 0 vc-cvs-program file 'WORKFILE "edit")))
               (if rev (vc-file-setprop file 'vc-workfile-version nil))))
 	  (cond 
 	   ((not workfile)
 	  (condition-case nil
 	      (progn
 		(if (and rev (vc-trunk-p rev))
-		    (apply 'vc-do-command nil 0 "cvs" file 'WORKFILE 
+		    (apply 'vc-do-command nil 0 vc-cvs-program file 'WORKFILE 
 			   "ci" "-m" "intermediate"
 			   switches))
-		(apply 'vc-do-command nil 0 "cvs" file 'WORKFILE 
+		(apply 'vc-do-command nil 0 vc-cvs-program file 'WORKFILE 
 		       "ci" (if rev (concat "-r" rev))
 		       (concat "-m" comment)
 		       switches))
 	    (vc-file-setprop file 'vc-workfile-version nil))
 	  ;; if this was an explicit check-in, remove the sticky tag
 	  (if rev
-	      (vc-do-command nil 0 "cvs" file 'WORKFILE "update" "-A"))
+	      (vc-do-command nil 0 vc-cvs-program file 'WORKFILE "update" "-A"))
           ;; Forget the checkout model, because we might have assumed
           ;; a wrong one when we found the file.  After commit, we can
           ;; tell it from the permissions of the file 
    ;; CVS
    (progn
      (delete-file file)
-     (vc-do-command nil 0 "cvs" file 'WORKFILE "update")))
+     (vc-do-command nil 0 vc-cvs-program file 'WORKFILE "update")))
   (vc-file-setprop file 'vc-locking-user 'none)
   (vc-file-setprop file 'vc-checkout-time (nth 5 (file-attributes file)))
   (message "Reverting %s...done" file)
    file
    (vc-do-command nil 0 "prs" file 'MASTER)
    (vc-do-command nil 0 "rlog" file 'MASTER)
-   (vc-do-command nil 0 "cvs" file 'WORKFILE "log")))
+   (vc-do-command nil 0 vc-cvs-program file 'WORKFILE "log")))
 
 (defun vc-backend-assign-name (file name)
   ;; Assign to a FILE's latest version a given NAME.
   (vc-backend-dispatch file
    (vc-add-triple name file (vc-latest-version file))              ;; SCCS
    (vc-do-command nil 0 "rcs" file 'MASTER (concat "-n" name ":")) ;; RCS
-   (vc-do-command nil 0 "cvs" file 'WORKFILE "tag" name)	   ;; CVS
+   (vc-do-command nil 0 vc-cvs-program file 'WORKFILE "tag" name)	   ;; CVS
    )
   )
 
 			       (list vc-diff-switches)) '("/dev/null")))))
 	;; cmp is not yet implemented -- we always do a full diff.
 	(apply 'vc-do-command
-	       "*vc-diff*" 1 "cvs" file 'WORKFILE "diff"
+	       "*vc-diff*" 1 vc-cvs-program file 'WORKFILE "diff"
 	       (and oldvers (concat "-r" oldvers))
 	       (and newvers (concat "-r" newvers))
 	       (if (listp vc-diff-switches)
 	 (vc-file-setprop file 'vc-workfile-version nil)
 	 (vc-file-setprop file 'vc-locking-user nil)
          (vc-file-setprop file 'vc-checkout-time nil)
-	 (vc-do-command nil 0 "cvs" file 'WORKFILE "update")
+	 (vc-do-command nil 0 vc-cvs-program file 'WORKFILE "update")
          ;; Analyze the merge result reported by CVS, and set
          ;; file properties accordingly.
 	 (set-buffer (get-buffer "*vc*"))
 \\[vc-comment-search-reverse]	search backward for regexp in the comment ring
 \\[vc-comment-search-forward]	search backward for regexp in the comment ring
 
-Entry to the change-log submode calls the value of text-mode-hook, then
-the value of vc-log-mode-hook.
+Entry to the change-log submode calls the value of `text-mode-hook', then
+the value of `vc-log-mode-hook'.
 
 Global user options:
-	vc-initial-comment	If non-nil, require user to enter a change
+	`vc-initial-comment'	If non-nil, require user to enter a change
 				comment upon first checkin of the file.
 
-	vc-keep-workfiles	Non-nil value prevents workfiles from being
+	`vc-keep-workfiles'	Non-nil value prevents workfiles from being
 				deleted when changes are checked in
 
-        vc-suppress-confirm     Suppresses some confirmation prompts,
+        `vc-suppress-confirm'	Suppresses some confirmation prompts,
 				notably for reversions.
 
-	vc-header-alist		Which keywords to insert when adding headers
+	`vc-header-alist'	Which keywords to insert when adding headers
 				with \\[vc-insert-headers].  Defaults to
 				'(\"\%\W\%\") under SCCS, '(\"\$Id\$\") under 
 				RCS and CVS.
 
-	vc-static-header-alist	By default, version headers inserted in C files
+	`vc-static-header-alist' By default, version headers inserted in C files
 				get stuffed in a static string area so that
 				ident(RCS/CVS) or what(SCCS) can see them in
 				the compiled object code.  You can override
 				this by setting this variable to nil, or change
 				the header template by changing it.
 
-	vc-command-messages	if non-nil, display run messages from the
+	`vc-command-messages'	If non-nil, display run messages from the
 				actual version-control utilities (this is
 				intended primarily for people hacking vc
 				itself).