From: Olivier Certner Date: Thu, 6 Apr 2023 09:25:33 +0000 (+0200) Subject: VC: Allow `vc-default-revert' (and CVS) to revert a missing file X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=9a2c723f1bc592fdd28763c8ec67129c5c5d91f1;p=emacs.git VC: Allow `vc-default-revert' (and CVS) to revert a missing file * lisp/vc/vc.el (vc-default-revert): Fix reverting a missing file case by not trying to create a backup through `copy-file'. Notably impacts CVS, where `vc-cvs-revert' calls `vc-default-revert'. --- diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 32b0d5d7556..91d3f6f70d3 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -3604,7 +3604,8 @@ to provide the `find-revision' operation instead." (file-buffer (or (get-file-buffer file) (current-buffer)))) (message "Checking out %s..." file) (let ((failed t) - (backup-name (car (find-backup-file-name file)))) + (backup-name (when (file-exists-p file) + (car (find-backup-file-name file))))) (when backup-name (copy-file file backup-name 'ok-if-already-exists 'keep-date) (unless (file-writable-p file)