aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2005-12-14 16:57:35 +0000
committerStefan Monnier2005-12-14 16:57:35 +0000
commitd49e540c484c3f87be3d414abde99dd50ce37f45 (patch)
tree0aa78358cfdee4cd0895cafbefa480b4532bcfdf
parentde38789604a7f3f68a096d499e622db517e285a5 (diff)
downloademacs-d49e540c484c3f87be3d414abde99dd50ce37f45.tar.gz
emacs-d49e540c484c3f87be3d414abde99dd50ce37f45.zip
(vc-default-revert): New fun.
-rw-r--r--lisp/vc.el27
1 files changed, 27 insertions, 0 deletions
diff --git a/lisp/vc.el b/lisp/vc.el
index 4087c67a4f0..9429ab4c646 100644
--- a/lisp/vc.el
+++ b/lisp/vc.el
@@ -2529,6 +2529,33 @@ return its name; otherwise return nil."
2529 (if (file-exists-p backup-file) 2529 (if (file-exists-p backup-file)
2530 backup-file))))) 2530 backup-file)))))
2531 2531
2532(defun vc-default-revert (backend file contents-done)
2533 (unless contents-done
2534 (let ((rev (vc-workfile-version file))
2535 (file-buffer (or (get-file-buffer file) (current-buffer))))
2536 (message "Checking out %s..." file)
2537 (let ((failed t)
2538 (backup-name (car (find-backup-file-name file))))
2539 (when backup-name
2540 (copy-file file backup-name 'ok-if-already-exists 'keep-date)
2541 (unless (file-writable-p file)
2542 (set-file-modes file (logior (file-modes file) 128))))
2543 (unwind-protect
2544 (let ((coding-system-for-read 'no-conversion)
2545 (coding-system-for-write 'no-conversion))
2546 (with-temp-file file
2547 (let ((outbuf (current-buffer)))
2548 ;; Change buffer to get local value of vc-checkout-switches.
2549 (with-current-buffer file-buffer
2550 (let ((default-directory (file-name-directory file)))
2551 (vc-call find-version file rev outbuf)))))
2552 (setq failed nil))
2553 (when backup-name
2554 (if failed
2555 (rename-file backup-name file 'ok-if-already-exists)
2556 (and (not vc-make-backup-files) (delete-file backup-name))))))
2557 (message "Checking out %s...done" file))))
2558
2532(defun vc-revert-file (file) 2559(defun vc-revert-file (file)
2533 "Revert FILE back to the version it was based on." 2560 "Revert FILE back to the version it was based on."
2534 (with-vc-properties 2561 (with-vc-properties