Function: vc-checkout

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

Signature

(vc-checkout FILE &optional REV)

Documentation

Retrieve a copy of the revision REV of FILE.

REV defaults to the latest revision.

After check-out, runs the normal hook vc-checkout-hook.

Source Code

;; Defined in /usr/src/emacs/lisp/vc/vc.el.gz
(defun vc-checkout (file &optional rev)
  "Retrieve a copy of the revision REV of FILE.
REV defaults to the latest revision.

After check-out, runs the normal hook `vc-checkout-hook'."
  (and (not rev)
       (vc-call make-version-backups-p file)
       (vc-up-to-date-p file)
       (vc-make-version-backup file))
  (let ((backend (vc-backend file)))
    (with-vc-properties (list file)
      (condition-case err
          (vc-call-backend backend 'checkout file rev)
        (file-error
         ;; Maybe the backend is not installed ;-(
         (when t
           (let ((buf (get-file-buffer file)))
             (when buf (with-current-buffer buf (read-only-mode -1)))))
         (signal (car err) (cdr err))))
      `((vc-state . ,(if (or (eq (vc-checkout-model backend (list file)) 'implicit)
                             nil)
			 'up-to-date
                       'edited))
        (vc-checkout-time . ,(file-attribute-modification-time
			      (file-attributes file))))))
  (vc-resynch-buffer file t t)
  (run-hooks 'vc-checkout-hook))