(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,99 +368,45 @@ 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)) ;; Change buffers to get local value of vc-checkout-switches.
switches) (with-current-buffer (or (get-file-buffer file) (current-buffer))
(message "Checking out %s..." filename) (if (and (file-exists-p file) (not rev))
(save-excursion ;; If no revision was specified, just make the file writable
;; Change buffers to get local value of vc-checkout-switches. ;; if necessary (using `cvs-edit' if requested).
(if file-buffer (set-buffer file-buffer)) (and editable (not (eq (vc-cvs-checkout-model file) 'implicit))
(setq switches (vc-switches 'CVS 'checkout)) (if vc-cvs-use-edit
;; Save this buffer's default-directory (vc-cvs-command nil 0 file "edit")
;; and use save-excursion to make sure it is restored (set-file-modes file (logior (file-modes file) 128))
;; in the same buffer it was saved in. (if (equal file buffer-file-name) (toggle-read-only -1))))
(let ((default-directory default-directory)) ;; Check out a particular version (or recreate the file).
(save-excursion (vc-file-setprop file 'vc-workfile-version nil)
;; Adjust the default-directory so that the check-out creates (apply 'vc-cvs-command nil 0 file
;; the file in the right place. (and editable "-w")
(setq default-directory (file-name-directory filename)) "update"
(if workfile (when rev
(let ((failed t) (unless (eq rev t)
(backup-name (if (string= file workfile) ;; default for verbose checkout: clear the
(car (find-backup-file-name filename))))) ;; sticky tag so that the actual update will
(when backup-name ;; get the head of the trunk
(copy-file filename backup-name (if (string= rev "")
'ok-if-already-exists 'keep-date) "-A"
(unless (file-writable-p filename) (concat "-r" rev))))
(set-file-modes filename (vc-switches 'CVS 'checkout)))
(logior (file-modes filename) 128)))) (vc-mode-line file))
(unwind-protect (message "Checking out %s...done" file))
(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 no revision was specified, just make the file writable
;; if necessary (using `cvs-edit' if requested).
(and editable (not (eq (vc-cvs-checkout-model file) 'implicit))
(if vc-cvs-use-edit
(vc-cvs-command nil 0 file "edit")
(set-file-modes file (logior (file-modes file) 128))
(if file-buffer (toggle-read-only -1))))
;; Check out a particular version (or recreate the file).
(vc-file-setprop file 'vc-workfile-version nil)
(apply 'vc-cvs-command nil 0 file
(and editable
(or (not (file-exists-p file))
(not (eq (vc-cvs-checkout-model file)
'implicit)))
"-w")
"update"
(when rev
(unless (eq rev t)
;; default for verbose checkout: clear the
;; sticky tag so that the actual update will
;; get the head of the trunk
(if (string= rev "")
"-A"
(concat "-r" rev))))
switches))))
(vc-mode-line file)
(message "Checking out %s...done" filename)))))
(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")