(vc-cvs-revert): Use vc-default-revert.

(vc-cvs-checkout): Remove last arg now unused; simplify.
This commit is contained in:
Stefan Monnier 2007-07-08 19:34:19 +00:00
parent 64639e26dd
commit f4b43eb362
2 changed files with 39 additions and 88 deletions

View file

@ -1,9 +1,14 @@
2007-07-08 Stefan Monnier <monnier@iro.umontreal.ca>
* vc-cvs.el (vc-cvs-revert): Use vc-default-revert.
(vc-cvs-checkout): Remove last arg now unused; simplify.
2007-07-08 Chong Yidong <cyd@stupidchicken.com> 2007-07-08 Chong Yidong <cyd@stupidchicken.com>
* longlines.el (longlines-wrap-region): Avoid marking buffer as * longlines.el (longlines-wrap-region): Avoid marking buffer as
modified. modified.
(longlines-auto-wrap, longlines-window-change-function): Remove (longlines-auto-wrap, longlines-window-change-function):
unnecessary calls to set-buffer-modified-p. Remove unnecessary calls to set-buffer-modified-p.
2007-07-08 Michael Albinus <michael.albinus@gmx.de> 2007-07-08 Michael Albinus <michael.albinus@gmx.de>

View file

@ -368,60 +368,13 @@ its parents."
"-p" "-p"
(vc-switches 'CVS 'checkout))) (vc-switches 'CVS 'checkout)))
(defun vc-cvs-checkout (file &optional editable rev workfile) (defun vc-cvs-checkout (file &optional editable rev)
"Retrieve a revision of FILE into a WORKFILE. "Checkout a revision of FILE into the working area.
EDITABLE non-nil means that the file should be writable. EDITABLE non-nil means that the file should be writable.
REV is the revision to check out into WORKFILE." REV is the revision to check out."
(let ((filename (or workfile file)) (message "Checking out %s..." file)
(file-buffer (get-file-buffer file))
switches)
(message "Checking out %s..." filename)
(save-excursion
;; Change buffers to get local value of vc-checkout-switches. ;; Change buffers to get local value of vc-checkout-switches.
(if file-buffer (set-buffer file-buffer)) (with-current-buffer (or (get-file-buffer file) (current-buffer))
(setq switches (vc-switches 'CVS 'checkout))
;; Save this buffer's default-directory
;; and use save-excursion to make sure it is restored
;; in the same buffer it was saved in.
(let ((default-directory default-directory))
(save-excursion
;; Adjust the default-directory so that the check-out creates
;; the file in the right place.
(setq default-directory (file-name-directory filename))
(if workfile
(let ((failed t)
(backup-name (if (string= file workfile)
(car (find-backup-file-name filename)))))
(when backup-name
(copy-file filename backup-name
'ok-if-already-exists 'keep-date)
(unless (file-writable-p filename)
(set-file-modes filename
(logior (file-modes filename) 128))))
(unwind-protect
(progn
(let ((coding-system-for-read 'no-conversion)
(coding-system-for-write 'no-conversion))
(with-temp-file filename
(apply 'vc-cvs-command
(current-buffer) 0 file
"-Q" ; suppress diagnostic output
"update"
(and (stringp rev)
(not (string= rev ""))
(concat "-r" rev))
"-p"
switches)))
(setq failed nil))
(if failed
(if backup-name
(rename-file backup-name filename
'ok-if-already-exists)
(if (file-exists-p filename)
(delete-file filename)))
(and backup-name
(not vc-make-backup-files)
(delete-file backup-name)))))
(if (and (file-exists-p file) (not rev)) (if (and (file-exists-p file) (not rev))
;; If no revision was specified, just make the file writable ;; If no revision was specified, just make the file writable
;; if necessary (using `cvs-edit' if requested). ;; if necessary (using `cvs-edit' if requested).
@ -429,15 +382,11 @@ REV is the revision to check out into WORKFILE."
(if vc-cvs-use-edit (if vc-cvs-use-edit
(vc-cvs-command nil 0 file "edit") (vc-cvs-command nil 0 file "edit")
(set-file-modes file (logior (file-modes file) 128)) (set-file-modes file (logior (file-modes file) 128))
(if file-buffer (toggle-read-only -1)))) (if (equal file buffer-file-name) (toggle-read-only -1))))
;; Check out a particular version (or recreate the file). ;; Check out a particular version (or recreate the file).
(vc-file-setprop file 'vc-workfile-version nil) (vc-file-setprop file 'vc-workfile-version nil)
(apply 'vc-cvs-command nil 0 file (apply 'vc-cvs-command nil 0 file
(and editable (and editable "-w")
(or (not (file-exists-p file))
(not (eq (vc-cvs-checkout-model file)
'implicit)))
"-w")
"update" "update"
(when rev (when rev
(unless (eq rev t) (unless (eq rev t)
@ -447,20 +396,17 @@ REV is the revision to check out into WORKFILE."
(if (string= rev "") (if (string= rev "")
"-A" "-A"
(concat "-r" rev)))) (concat "-r" rev))))
switches)))) (vc-switches 'CVS 'checkout)))
(vc-mode-line file) (vc-mode-line file))
(message "Checking out %s...done" filename))))) (message "Checking out %s...done" file))
(defun vc-cvs-delete-file (file) (defun vc-cvs-delete-file (file)
(vc-cvs-command nil 0 file "remove" "-f") (vc-cvs-command nil 0 file "remove" "-f")
(vc-cvs-command nil 0 file "commit" "-mRemoved.")) (vc-cvs-command nil 0 file "commit" "-mRemoved."))
(defun vc-cvs-revert (file &optional contents-done) (defun vc-cvs-revert (file &optional contents-done)
"Revert FILE to the version it was based on." "Revert FILE to the version on which it was based."
(unless contents-done (vc-default-revert 'CVS file contents-done)
;; Check out via standard output (caused by the final argument
;; FILE below), so that no sticky tag is set.
(vc-cvs-checkout file nil (vc-workfile-version file) file))
(unless (eq (vc-checkout-model file) 'implicit) (unless (eq (vc-checkout-model file) 'implicit)
(if vc-cvs-use-edit (if vc-cvs-use-edit
(vc-cvs-command nil 0 file "unedit") (vc-cvs-command nil 0 file "unedit")