mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-30 04:10:54 -08:00
(vc-default-revert): New fun.
This commit is contained in:
parent
de38789604
commit
d49e540c48
1 changed files with 27 additions and 0 deletions
27
lisp/vc.el
27
lisp/vc.el
|
|
@ -2529,6 +2529,33 @@ return its name; otherwise return nil."
|
|||
(if (file-exists-p backup-file)
|
||||
backup-file)))))
|
||||
|
||||
(defun vc-default-revert (backend file contents-done)
|
||||
(unless contents-done
|
||||
(let ((rev (vc-workfile-version file))
|
||||
(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))))
|
||||
(when backup-name
|
||||
(copy-file file backup-name 'ok-if-already-exists 'keep-date)
|
||||
(unless (file-writable-p file)
|
||||
(set-file-modes file (logior (file-modes file) 128))))
|
||||
(unwind-protect
|
||||
(let ((coding-system-for-read 'no-conversion)
|
||||
(coding-system-for-write 'no-conversion))
|
||||
(with-temp-file file
|
||||
(let ((outbuf (current-buffer)))
|
||||
;; Change buffer to get local value of vc-checkout-switches.
|
||||
(with-current-buffer file-buffer
|
||||
(let ((default-directory (file-name-directory file)))
|
||||
(vc-call find-version file rev outbuf)))))
|
||||
(setq failed nil))
|
||||
(when backup-name
|
||||
(if failed
|
||||
(rename-file backup-name file 'ok-if-already-exists)
|
||||
(and (not vc-make-backup-files) (delete-file backup-name))))))
|
||||
(message "Checking out %s...done" file))))
|
||||
|
||||
(defun vc-revert-file (file)
|
||||
"Revert FILE back to the version it was based on."
|
||||
(with-vc-properties
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue