changeset 32748:e2cb0aef151a

(vc-checkout): Added `-p' suffix in call to vc-make-version-backups-p; use vc-make-version-backup to actually make the backup. (vc-version-other-window, vc-version-backup-file): Handle both automatic and manual backups. (vc-revert-file): Use vc-delete-automatic-version-backups to get rid of all of them.
author André Spiegel <spiegel@gnu.org>
date Sun, 22 Oct 2000 15:37:51 +0000
parents 14e8396427f6
children a1310ae57748
files lisp/vc.el
diffstat 1 files changed, 18 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/vc.el	Sun Oct 22 15:31:11 2000 +0000
+++ b/lisp/vc.el	Sun Oct 22 15:37:51 2000 +0000
@@ -5,7 +5,7 @@
 ;; Author:     FSF (see below for full credits)
 ;; Maintainer: Andre Spiegel <spiegel@gnu.org>
 
-;; $Id: vc.el,v 1.279 2000/10/08 19:12:52 monnier Exp $
+;; $Id: vc.el,v 1.280 2000/10/10 01:25:40 ttn Exp $
 
 ;; This file is part of GNU Emacs.
 
@@ -1212,10 +1212,9 @@
 REV defaults to the latest revision."
   (and writable
        (not rev)
-       (vc-call make-version-backups file)
+       (vc-call make-version-backups-p file)
        (vc-up-to-date-p file)
-       (copy-file file (vc-version-backup-file-name file)
-		  'ok-if-already-exists 'keep-date))
+       (vc-make-version-backup file))
   (with-vc-properties
    file
    (condition-case err
@@ -1574,10 +1573,13 @@
   (let* ((version (if (string-equal rev "")
 		      (vc-workfile-version buffer-file-name)
 		    rev))
-	 (filename (concat buffer-file-name ".~" version "~")))
-    (or (file-exists-p filename)
-	(vc-call checkout buffer-file-name nil version filename))
-    (find-file-other-window filename)))
+	 (automatic-backup (vc-version-backup-file-name file version))
+         (manual-backup (vc-version-backup-file-name file version 'manual)))
+    (unless (file-exists-p manual-backup)
+      (if (file-exists-p automatic-backup)
+          (copy-file automatic-backup manual-backup nil 'keep-date)
+        (vc-call checkout buffer-file-name nil version manual-backup)))
+    (find-file-other-window manual-backup)))
 
 ;; Header-insertion code
 
@@ -2212,10 +2214,14 @@
   "If version backups should be used for FILE, and there exists
 such a backup for REV or the current workfile version of file,
 return the name of it; otherwise return nil."
-  (when (vc-call make-version-backups file)
+  (when (vc-call make-version-backups-p file)
     (let ((backup-file (vc-version-backup-file-name file rev)))
-      (and (file-exists-p backup-file)
-	   backup-file))))
+      (if (file-exists-p backup-file)
+          backup-file
+        ;; there is no automatic backup, but maybe the user made one manually
+        (setq backup-file (vc-version-backup-file-name file rev 'manual))
+        (if (file-exists-p backup-file)
+            backup-file)))))
 
 (defun vc-revert-file (file)
   "Revert FILE back to the version it was based on."
@@ -2225,7 +2231,7 @@
      (if (not backup-file)
 	 (vc-call revert file)
        (copy-file backup-file file 'ok-if-already-exists 'keep-date)
-       (delete-file backup-file)))
+       (vc-delete-automatic-version-backups file)))
    `((vc-state . up-to-date)
      (vc-checkout-time . ,(nth 5 (file-attributes file)))))
   (vc-resynch-buffer file t t))