diff options
| author | Stefan Monnier | 2007-07-08 19:34:19 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2007-07-08 19:34:19 +0000 |
| commit | f4b43eb3626b51a7e995a9bbea6ee2c9e6a22fea (patch) | |
| tree | 0bfe935e671f07a30a8434578ee642732f7984f7 | |
| parent | 64639e26dd5e6483d7097aad5a3457d89bfb05b0 (diff) | |
| download | emacs-f4b43eb3626b51a7e995a9bbea6ee2c9e6a22fea.tar.gz emacs-f4b43eb3626b51a7e995a9bbea6ee2c9e6a22fea.zip | |
(vc-cvs-revert): Use vc-default-revert.
(vc-cvs-checkout): Remove last arg now unused; simplify.
| -rw-r--r-- | lisp/ChangeLog | 9 | ||||
| -rw-r--r-- | lisp/vc-cvs.el | 118 |
2 files changed, 39 insertions, 88 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index be8cbe16a92..bde593b59d9 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,9 +1,14 @@ | |||
| 1 | 2007-07-08 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * vc-cvs.el (vc-cvs-revert): Use vc-default-revert. | ||
| 4 | (vc-cvs-checkout): Remove last arg now unused; simplify. | ||
| 5 | |||
| 1 | 2007-07-08 Chong Yidong <cyd@stupidchicken.com> | 6 | 2007-07-08 Chong Yidong <cyd@stupidchicken.com> |
| 2 | 7 | ||
| 3 | * longlines.el (longlines-wrap-region): Avoid marking buffer as | 8 | * longlines.el (longlines-wrap-region): Avoid marking buffer as |
| 4 | modified. | 9 | modified. |
| 5 | (longlines-auto-wrap, longlines-window-change-function): Remove | 10 | (longlines-auto-wrap, longlines-window-change-function): |
| 6 | unnecessary calls to set-buffer-modified-p. | 11 | Remove unnecessary calls to set-buffer-modified-p. |
| 7 | 12 | ||
| 8 | 2007-07-08 Michael Albinus <michael.albinus@gmx.de> | 13 | 2007-07-08 Michael Albinus <michael.albinus@gmx.de> |
| 9 | 14 | ||
diff --git a/lisp/vc-cvs.el b/lisp/vc-cvs.el index 583e02efd5d..3b35efe47c3 100644 --- a/lisp/vc-cvs.el +++ b/lisp/vc-cvs.el | |||
| @@ -368,99 +368,45 @@ its parents." | |||
| 368 | "-p" | 368 | "-p" |
| 369 | (vc-switches 'CVS 'checkout))) | 369 | (vc-switches 'CVS 'checkout))) |
| 370 | 370 | ||
| 371 | (defun vc-cvs-checkout (file &optional editable rev workfile) | 371 | (defun vc-cvs-checkout (file &optional editable rev) |
| 372 | "Retrieve a revision of FILE into a WORKFILE. | 372 | "Checkout a revision of FILE into the working area. |
| 373 | EDITABLE non-nil means that the file should be writable. | 373 | EDITABLE non-nil means that the file should be writable. |
| 374 | REV is the revision to check out into WORKFILE." | 374 | REV is the revision to check out." |
| 375 | (let ((filename (or workfile file)) | 375 | (message "Checking out %s..." file) |
| 376 | (file-buffer (get-file-buffer file)) | 376 | ;; Change buffers to get local value of vc-checkout-switches. |
| 377 | switches) | 377 | (with-current-buffer (or (get-file-buffer file) (current-buffer)) |
| 378 | (message "Checking out %s..." filename) | 378 | (if (and (file-exists-p file) (not rev)) |
| 379 | (save-excursion | 379 | ;; If no revision was specified, just make the file writable |
| 380 | ;; Change buffers to get local value of vc-checkout-switches. | 380 | ;; if necessary (using `cvs-edit' if requested). |
| 381 | (if file-buffer (set-buffer file-buffer)) | 381 | (and editable (not (eq (vc-cvs-checkout-model file) 'implicit)) |
| 382 | (setq switches (vc-switches 'CVS 'checkout)) | 382 | (if vc-cvs-use-edit |
| 383 | ;; Save this buffer's default-directory | 383 | (vc-cvs-command nil 0 file "edit") |
| 384 | ;; and use save-excursion to make sure it is restored | 384 | (set-file-modes file (logior (file-modes file) 128)) |
| 385 | ;; in the same buffer it was saved in. | 385 | (if (equal file buffer-file-name) (toggle-read-only -1)))) |
| 386 | (let ((default-directory default-directory)) | 386 | ;; Check out a particular version (or recreate the file). |
| 387 | (save-excursion | 387 | (vc-file-setprop file 'vc-workfile-version nil) |
| 388 | ;; Adjust the default-directory so that the check-out creates | 388 | (apply 'vc-cvs-command nil 0 file |
| 389 | ;; the file in the right place. | 389 | (and editable "-w") |
| 390 | (setq default-directory (file-name-directory filename)) | 390 | "update" |
| 391 | (if workfile | 391 | (when rev |
| 392 | (let ((failed t) | 392 | (unless (eq rev t) |
| 393 | (backup-name (if (string= file workfile) | 393 | ;; default for verbose checkout: clear the |
| 394 | (car (find-backup-file-name filename))))) | 394 | ;; sticky tag so that the actual update will |
| 395 | (when backup-name | 395 | ;; get the head of the trunk |
| 396 | (copy-file filename backup-name | 396 | (if (string= rev "") |
| 397 | 'ok-if-already-exists 'keep-date) | 397 | "-A" |
| 398 | (unless (file-writable-p filename) | 398 | (concat "-r" rev)))) |
| 399 | (set-file-modes filename | 399 | (vc-switches 'CVS 'checkout))) |
| 400 | (logior (file-modes filename) 128)))) | 400 | (vc-mode-line file)) |
| 401 | (unwind-protect | 401 | (message "Checking out %s...done" file)) |
| 402 | (progn | ||
| 403 | (let ((coding-system-for-read 'no-conversion) | ||
| 404 | (coding-system-for-write 'no-conversion)) | ||
| 405 | (with-temp-file filename | ||
| 406 | (apply 'vc-cvs-command | ||
| 407 | (current-buffer) 0 file | ||
| 408 | "-Q" ; suppress diagnostic output | ||
| 409 | "update" | ||
| 410 | (and (stringp rev) | ||
| 411 | (not (string= rev "")) | ||
| 412 | (concat "-r" rev)) | ||
| 413 | "-p" | ||
| 414 | switches))) | ||
| 415 | (setq failed nil)) | ||
| 416 | (if failed | ||
| 417 | (if backup-name | ||
| 418 | (rename-file backup-name filename | ||
| 419 | 'ok-if-already-exists) | ||
| 420 | (if (file-exists-p filename) | ||
| 421 | (delete-file filename))) | ||
| 422 | (and backup-name | ||
| 423 | (not vc-make-backup-files) | ||
| 424 | (delete-file backup-name))))) | ||
| 425 | (if (and (file-exists-p file) (not rev)) | ||
| 426 | ;; If no revision was specified, just make the file writable | ||
| 427 | ;; if necessary (using `cvs-edit' if requested). | ||
| 428 | (and editable (not (eq (vc-cvs-checkout-model file) 'implicit)) | ||
| 429 | (if vc-cvs-use-edit | ||
| 430 | (vc-cvs-command nil 0 file "edit") | ||
| 431 | (set-file-modes file (logior (file-modes file) 128)) | ||
| 432 | (if file-buffer (toggle-read-only -1)))) | ||
| 433 | ;; Check out a particular version (or recreate the file). | ||
| 434 | (vc-file-setprop file 'vc-workfile-version nil) | ||
| 435 | (apply 'vc-cvs-command nil 0 file | ||
| 436 | (and editable | ||
| 437 | (or (not (file-exists-p file)) | ||
| 438 | (not (eq (vc-cvs-checkout-model file) | ||
| 439 | 'implicit))) | ||
| 440 | "-w") | ||
| 441 | "update" | ||
| 442 | (when rev | ||
| 443 | (unless (eq rev t) | ||
| 444 | ;; default for verbose checkout: clear the | ||
| 445 | ;; sticky tag so that the actual update will | ||
| 446 | ;; get the head of the trunk | ||
| 447 | (if (string= rev "") | ||
| 448 | "-A" | ||
| 449 | (concat "-r" rev)))) | ||
| 450 | switches)))) | ||
| 451 | (vc-mode-line file) | ||
| 452 | (message "Checking out %s...done" filename))))) | ||
| 453 | 402 | ||
| 454 | (defun vc-cvs-delete-file (file) | 403 | (defun vc-cvs-delete-file (file) |
| 455 | (vc-cvs-command nil 0 file "remove" "-f") | 404 | (vc-cvs-command nil 0 file "remove" "-f") |
| 456 | (vc-cvs-command nil 0 file "commit" "-mRemoved.")) | 405 | (vc-cvs-command nil 0 file "commit" "-mRemoved.")) |
| 457 | 406 | ||
| 458 | (defun vc-cvs-revert (file &optional contents-done) | 407 | (defun vc-cvs-revert (file &optional contents-done) |
| 459 | "Revert FILE to the version it was based on." | 408 | "Revert FILE to the version on which it was based." |
| 460 | (unless contents-done | 409 | (vc-default-revert 'CVS file contents-done) |
| 461 | ;; Check out via standard output (caused by the final argument | ||
| 462 | ;; FILE below), so that no sticky tag is set. | ||
| 463 | (vc-cvs-checkout file nil (vc-workfile-version file) file)) | ||
| 464 | (unless (eq (vc-checkout-model file) 'implicit) | 410 | (unless (eq (vc-checkout-model file) 'implicit) |
| 465 | (if vc-cvs-use-edit | 411 | (if vc-cvs-use-edit |
| 466 | (vc-cvs-command nil 0 file "unedit") | 412 | (vc-cvs-command nil 0 file "unedit") |