Function: vc-rcs-checkin

vc-rcs-checkin is a byte-compiled function defined in vc-rcs.el.gz.

Signature

(vc-rcs-checkin FILES COMMENT &optional REV)

Documentation

RCS-specific version of vc-backend-checkin.

Source Code

;; Defined in /usr/src/emacs/lisp/vc/vc-rcs.el.gz
(defun vc-rcs-checkin (files comment &optional rev)
  "RCS-specific version of `vc-backend-checkin'."
  (let ((switches (vc-switches 'RCS 'checkin)))
    ;; Now operate on the files
    (dolist (file (vc-expand-dirs files 'RCS))
      (let ((old-version (vc-working-revision file)) new-version
	    (default-branch (vc-file-getprop file 'vc-rcs-default-branch)))
	;; Force branch creation if an appropriate
	;; default branch has been set.
	(and (not rev)
             default-branch
	     (string-match (concat "^" (regexp-quote old-version) "\\.")
			   default-branch)
	     (setq rev default-branch)
	     (setq switches (cons "-f" switches)))
	(if (and (not rev) old-version)
	    (setq rev (vc-rcs-branch-part old-version)))
	(apply #'vc-do-command "*vc*" 0 "ci" (vc-master-name file)
	       ;; if available, use the secure check-in option
	       (and (vc-rcs-release-p "5.6.4") "-j")
	       (concat "-u" rev)
	       (concat "-m" comment)
	       switches)
	(vc-file-setprop file 'vc-working-revision nil)

	;; determine the new workfile version
	(set-buffer "*vc*")
	(goto-char (point-min))
	(when (or (re-search-forward
		   "new revision: \\([0-9.]+\\);" nil t)
		  (re-search-forward
		   "reverting to previous revision \\([0-9.]+\\)" nil t))
	  (setq new-version (match-string 1))
	  (vc-file-setprop file 'vc-working-revision new-version))

	;; if we got to a different branch, adjust the default
	;; branch accordingly
	(cond
	 ((and old-version new-version
	       (not (string= (vc-rcs-branch-part old-version)
			     (vc-rcs-branch-part new-version))))
	  (vc-rcs-set-default-branch file
				     (if (vc-rcs-trunk-p new-version) nil
				       (vc-rcs-branch-part new-version)))
	  ;; If this is an old (pre-1992!) RCS release, we might have
	  ;; to remove a remaining lock.
	  (if (not (vc-rcs-release-p "5.6.2"))
	      ;; exit status of 1 is also accepted.
	      ;; It means that the lock was removed before.
	      (vc-do-command "*vc*" 1 "rcs" (vc-master-name file)
			     (concat "-u" old-version)))))))))