# HG changeset patch # User Stefan Monnier # Date 1183923259 0 # Node ID 12e5ff38b0247bdc9829e15b6d68c8133e0f4902 # Parent ee27e7153c38ea6d41b291f8168a13b95025b18c (vc-cvs-revert): Use vc-default-revert. (vc-cvs-checkout): Remove last arg now unused; simplify. diff -r ee27e7153c38 -r 12e5ff38b024 lisp/ChangeLog --- a/lisp/ChangeLog Sun Jul 08 18:10:09 2007 +0000 +++ b/lisp/ChangeLog Sun Jul 08 19:34:19 2007 +0000 @@ -1,9 +1,14 @@ +2007-07-08 Stefan Monnier + + * vc-cvs.el (vc-cvs-revert): Use vc-default-revert. + (vc-cvs-checkout): Remove last arg now unused; simplify. + 2007-07-08 Chong Yidong * longlines.el (longlines-wrap-region): Avoid marking buffer as modified. - (longlines-auto-wrap, longlines-window-change-function): Remove - unnecessary calls to set-buffer-modified-p. + (longlines-auto-wrap, longlines-window-change-function): + Remove unnecessary calls to set-buffer-modified-p. 2007-07-08 Michael Albinus diff -r ee27e7153c38 -r 12e5ff38b024 lisp/vc-cvs.el --- a/lisp/vc-cvs.el Sun Jul 08 18:10:09 2007 +0000 +++ b/lisp/vc-cvs.el Sun Jul 08 19:34:19 2007 +0000 @@ -368,99 +368,45 @@ "-p" (vc-switches 'CVS 'checkout))) -(defun vc-cvs-checkout (file &optional editable rev workfile) - "Retrieve a revision of FILE into a WORKFILE. +(defun vc-cvs-checkout (file &optional editable rev) + "Checkout a revision of FILE into the working area. EDITABLE non-nil means that the file should be writable. -REV is the revision to check out into WORKFILE." - (let ((filename (or workfile 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. - (if file-buffer (set-buffer file-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 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))))) +REV is the revision to check out." + (message "Checking out %s..." file) + ;; Change buffers to get local value of vc-checkout-switches. + (with-current-buffer (or (get-file-buffer file) (current-buffer)) + (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 (equal file buffer-file-name) (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 "-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)))) + (vc-switches 'CVS 'checkout))) + (vc-mode-line file)) + (message "Checking out %s...done" file)) (defun vc-cvs-delete-file (file) (vc-cvs-command nil 0 file "remove" "-f") (vc-cvs-command nil 0 file "commit" "-mRemoved.")) (defun vc-cvs-revert (file &optional contents-done) - "Revert FILE to the version it was based on." - (unless 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)) + "Revert FILE to the version on which it was based." + (vc-default-revert 'CVS file contents-done) (unless (eq (vc-checkout-model file) 'implicit) (if vc-cvs-use-edit (vc-cvs-command nil 0 file "unedit")