aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndré Spiegel2000-11-16 15:29:40 +0000
committerAndré Spiegel2000-11-16 15:29:40 +0000
commita8b6979f53afebdbe8b8362f4a0793faaa0e525d (patch)
tree65b7531643b3e6a7be5b3d21eea8c6348f7eaa92
parentc96da2b0a58829e4a157eed5744b61491c4599c4 (diff)
downloademacs-a8b6979f53afebdbe8b8362f4a0793faaa0e525d.tar.gz
emacs-a8b6979f53afebdbe8b8362f4a0793faaa0e525d.zip
(vc-cvs-revert): Use `cvs unedit' only if `vc-cvs-use-edit' is on.
(vc-cvs-checkout): When this is used for reverting the workfile, make a backup of the original contents and revert to that in case of error.
-rw-r--r--lisp/vc-cvs.el25
1 files changed, 21 insertions, 4 deletions
diff --git a/lisp/vc-cvs.el b/lisp/vc-cvs.el
index 6b2ac473806..25b85c88a34 100644
--- a/lisp/vc-cvs.el
+++ b/lisp/vc-cvs.el
@@ -5,7 +5,7 @@
5;; Author: FSF (see vc.el for full credits) 5;; Author: FSF (see vc.el for full credits)
6;; Maintainer: Andre Spiegel <spiegel@gnu.org> 6;; Maintainer: Andre Spiegel <spiegel@gnu.org>
7 7
8;; $Id: vc-cvs.el,v 1.8 2000/10/27 15:06:27 spiegel Exp $ 8;; $Id: vc-cvs.el,v 1.9 2000/11/16 13:38:03 spiegel Exp $
9 9
10;; This file is part of GNU Emacs. 10;; This file is part of GNU Emacs.
11 11
@@ -472,7 +472,8 @@ Inappropriate for CVS"
472 (vc-cvs-checkout file nil (vc-workfile-version file) file) 472 (vc-cvs-checkout file nil (vc-workfile-version file) file)
473 ;; If "cvs edit" was used to make the file writable, 473 ;; If "cvs edit" was used to make the file writable,
474 ;; call "cvs unedit" now to undo that. 474 ;; call "cvs unedit" now to undo that.
475 (if (not (eq (vc-cvs-checkout-model file) 'implicit)) 475 (if (and (not (eq (vc-cvs-checkout-model file) 'implicit))
476 vc-cvs-use-edit)
476 (vc-do-command nil 0 "cvs" file "unedit"))) 477 (vc-do-command nil 0 "cvs" file "unedit")))
477 478
478(defun vc-cvs-diff (file &optional oldvers newvers) 479(defun vc-cvs-diff (file &optional oldvers newvers)
@@ -607,7 +608,15 @@ REV is the revision to check out into WORKFILE."
607 ;; the file in the right place. 608 ;; the file in the right place.
608 (setq default-directory (file-name-directory filename)) 609 (setq default-directory (file-name-directory filename))
609 (if workfile 610 (if workfile
610 (let ((failed t)) 611 (let ((failed t)
612 (backup-name (if (string= filename workfile)
613 (car (find-backup-file-name filename)))))
614 (when backup-name
615 (copy-file filename backup-name
616 'ok-if-already-exists 'keep-date)
617 (unless (file-writable-p filename)
618 (set-file-modes filename
619 (logior (file-modes filename) 128))))
611 (unwind-protect 620 (unwind-protect
612 (progn 621 (progn
613 (let ((coding-system-for-read 'no-conversion) 622 (let ((coding-system-for-read 'no-conversion)
@@ -622,7 +631,15 @@ REV is the revision to check out into WORKFILE."
622 "-p" 631 "-p"
623 switches))) 632 switches)))
624 (setq failed nil)) 633 (setq failed nil))
625 (and failed (file-exists-p filename) (delete-file filename)))) 634 (if failed
635 (if backup-name
636 (rename-file backup-name filename
637 'ok-if-already-exists)
638 (if (file-exists-p filename)
639 (delete-file filename)))
640 (and backup-name
641 (not vc-make-backup-files)
642 (delete-file backup-name)))))
626 (if (and (file-exists-p file) (not rev)) 643 (if (and (file-exists-p file) (not rev))
627 ;; If no revision was specified, just make the file writable 644 ;; If no revision was specified, just make the file writable
628 ;; if necessary (using `cvs-edit' if requested). 645 ;; if necessary (using `cvs-edit' if requested).