Function: vc-revert-files

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

Signature

(vc-revert-files BACKEND FILES)

Documentation

Revert each of FILES to the repository working version it was based on.

For entries in FILES that are directories, revert all files inside them.

Source Code

;; Defined in /usr/src/emacs/lisp/vc/vc.el.gz
(defun vc-revert-files (backend files)
  "Revert each of FILES to the repository working version it was based on.
For entries in FILES that are directories, revert all files inside them."
  (when files
    (message "Reverting %s..." (vc-delistify files))
    (if (not (vc-find-backend-function backend 'revert-files))
        (mapc #'vc-revert-file files)
      (with-vc-properties
        files
        (vc-call-backend backend 'revert-files files)
        ;; Use `vc-file-getprop' directly here because we may be
        ;; handling very many files and do not want to hit the disk.
        `(,@(pcase (vc-file-getprop file 'vc-state)
              ('added '((vc-backend . nil) (vc-state . unregistered)))
              ;; If we have no known state for the file somehow, leave
              ;; it that way.
              ('nil nil)
              ;; If we do have a known state other than `added', then
              ;; after this operation the file will be `up-to-date'.
              (_ '((vc-state . up-to-date))))
          (vc-checkout-time
           . ,(file-attribute-modification-time (file-attributes file)))))
      (dolist (file files)
        (vc-resynch-buffer file t t)))
    (message "Reverting %s...done" (vc-delistify files))))