[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 9a2c723f1bc 3/3: VC: Allow `vc-default-revert' (and CVS) to rever
From: |
Dmitry Gutov |
Subject: |
master 9a2c723f1bc 3/3: VC: Allow `vc-default-revert' (and CVS) to revert a missing file |
Date: |
Tue, 18 Apr 2023 20:47:37 -0400 (EDT) |
branch: master
commit 9a2c723f1bc592fdd28763c8ec67129c5c5d91f1
Author: Olivier Certner <olce.emacs@certner.fr>
Commit: Dmitry Gutov <dmitry@gutov.dev>
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'.
---
lisp/vc/vc.el | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
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)