;; 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.284 2000/10/26 20:53:11 monnier Exp $
;; This file is part of GNU Emacs.
;; Paul Eggert <eggert@twinsun.com>
;; Sebastian Kremer <sk@thp.uni-koeln.de>
;; Martin Lorentzson <martinl@gnu.org>
-;; Dave Love <d.love@gnu.org>
+;; Dave Love <fx@gnu.org>
;; Stefan Monnier <monnier@cs.yale.edu>
;; Andre Spiegel <spiegel@gnu.org>
;; Richard Stallman <rms@gnu.org>
(setq vc-log-after-operation-hook after-hook))
(setq vc-log-operation action)
(setq vc-log-version rev)
- (erase-buffer)
- (if (eq comment t)
- (vc-finish-logentry t)
- (if comment
- (insert comment))
- (if (and comment (not initial-contents))
- (vc-finish-logentry nil)
- (message "%s Type C-c C-c when done" msg)))))
+ (when comment
+ (erase-buffer)
+ (when (stringp comment) (insert comment)))
+ (if (or (not comment) initial-contents)
+ (message "%s Type C-c C-c when done" msg)
+ (vc-finish-logentry (eq comment t)))))
(defun vc-checkout (file &optional writable rev)
"Retrieve a copy of the revision REV of FILE.
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
If `F.~REV~' already exists, it is used instead of being re-created."
(interactive "sVersion to visit (default is workfile version): ")
(vc-ensure-vc-buffer)
- (let* ((version (if (string-equal rev "")
- (vc-workfile-version buffer-file-name)
+ (let* ((file buffer-file-name)
+ (version (if (string-equal rev "")
+ (vc-workfile-version file)
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)
+ (rename-file automatic-backup manual-backup nil)
+ (vc-call checkout file nil version manual-backup)))
+ (find-file-other-window manual-backup)))
;; Header-insertion code
"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."
(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))