diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 3852a64550..8efd9fd560 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -2788,14 +2788,21 @@ vc-version-backup-file backup-file))))) (defun vc-revert-file (file) - "Revert FILE back to the repository working revision it was based on." + "Revert FILE back to the repository working revision it was based on. +FILE can be a plain file or a directory, and in the latter case +all files inside that directory will be reverted." (with-vc-properties (list file) - (let ((backup-file (vc-version-backup-file file))) + (let* ((dir (file-directory-p file)) + (backup-file (unless dir (vc-version-backup-file file)))) (when backup-file (copy-file backup-file file 'ok-if-already-exists) (vc-delete-automatic-version-backups file)) - (vc-call revert file backup-file)) + (vc-call-backend + (if dir + (vc-backend file) + (vc-responsible-backend file)) + 'revert file backup-file)) `((vc-state . up-to-date) (vc-checkout-time . ,(file-attribute-modification-time (file-attributes file)))))