Function: vc-rcs-checkout
vc-rcs-checkout is a byte-compiled function defined in vc-rcs.el.gz.
Signature
(vc-rcs-checkout FILE &optional REV)
Documentation
Retrieve a copy of a saved version of FILE.
If FILE is a directory, attempt the checkout for all registered files beneath it.
Source Code
;; Defined in /usr/src/emacs/lisp/vc/vc-rcs.el.gz
(defun vc-rcs-checkout (file &optional rev)
"Retrieve a copy of a saved version of FILE.
If FILE is a directory, attempt the checkout for all registered
files beneath it."
(if (file-directory-p file)
(mapc #'vc-rcs-checkout (vc-expand-dirs (list file) 'RCS))
(let ((file-buffer (get-file-buffer file))
switches)
(message "Checking out %s..." file)
(save-excursion
;; Change buffers to get local value of vc-checkout-switches.
(if file-buffer (set-buffer file-buffer))
(setq switches (vc-switches 'RCS 'checkout))
;; Save this buffer's default-directory
;; and use save-excursion to make sure it is restored
;; in the same buffer it was saved in.
(let ((default-directory default-directory))
(save-excursion
;; Adjust the default-directory so that the check-out creates
;; the file in the right place.
(setq default-directory (file-name-directory file))
(let (new-version)
;; if we should go to the head of the trunk,
;; clear the default branch first
(and rev (string= rev "")
(vc-rcs-set-default-branch file nil))
;; now do the checkout
(apply #'vc-do-command
"*vc*" 0 "co" (vc-master-name file)
;; If locking is not strict, force to overwrite
;; the writable workfile.
(if (eq (vc-rcs-checkout-model (list file)) 'implicit) "-f")
"-l"
(if (stringp rev)
;; a literal revision was specified
(concat "-r" rev)
(let ((workrev (vc-working-revision file)))
(if workrev
(concat "-r"
(if (not rev)
;; no revision specified:
;; use current workfile version
workrev
;; REV is t ...
(if (not (vc-rcs-trunk-p workrev))
;; ... go to head of current branch
(vc-rcs-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*"
(setq new-version
(vc-parse-buffer "^revision \\([0-9.]+\\).*\n" 1)))
(vc-file-setprop file 'vc-working-revision new-version)
;; if necessary, adjust the default branch
(and rev (not (string= rev ""))
(vc-rcs-set-default-branch
file
(if (vc-rcs-latest-on-branch-p file new-version)
(if (vc-rcs-trunk-p new-version) nil
(vc-rcs-branch-part new-version))
new-version)))))
(message "Checking out %s...done" file))))))