Mercurial > emacs
comparison lisp/vc.el @ 39000:60cf6aee9fd1
(vc-revert-file): Call the backend even if the FILE's
contents can be reverted locally; pass new arg CONTENTS-DONE
down to the backend.
author | André Spiegel <spiegel@gnu.org> |
---|---|
date | Tue, 28 Aug 2001 17:02:59 +0000 |
parents | 2dddcf515155 |
children | abd085bfec0c |
comparison
equal
deleted
inserted
replaced
38999:902cb976fed2 | 39000:60cf6aee9fd1 |
---|---|
3 ;; Copyright (C) 1992,93,94,95,96,97,98,2000,2001 Free Software Foundation, Inc. | 3 ;; Copyright (C) 1992,93,94,95,96,97,98,2000,2001 Free Software Foundation, Inc. |
4 | 4 |
5 ;; Author: FSF (see below for full credits) | 5 ;; Author: FSF (see below for full credits) |
6 ;; Maintainer: Andre Spiegel <spiegel@gnu.org> | 6 ;; Maintainer: Andre Spiegel <spiegel@gnu.org> |
7 | 7 |
8 ;; $Id: vc.el,v 1.304 2001/07/30 18:25:58 spiegel Exp $ | 8 ;; $Id: vc.el,v 1.305 2001/08/07 14:48:30 gerd Exp $ |
9 | 9 |
10 ;; This file is part of GNU Emacs. | 10 ;; This file is part of GNU Emacs. |
11 | 11 |
12 ;; GNU Emacs is free software; you can redistribute it and/or modify | 12 ;; GNU Emacs is free software; you can redistribute it and/or modify |
13 ;; it under the terms of the GNU General Public License as published by | 13 ;; it under the terms of the GNU General Public License as published by |
207 ;; is the revision to check out (default is current workfile version); | 207 ;; is the revision to check out (default is current workfile version); |
208 ;; if REV is the empty string, that means to check out the head of the | 208 ;; if REV is the empty string, that means to check out the head of the |
209 ;; trunk. If optional arg DESTFILE is given, it is an alternate | 209 ;; trunk. If optional arg DESTFILE is given, it is an alternate |
210 ;; filename to write the contents to. | 210 ;; filename to write the contents to. |
211 ;; | 211 ;; |
212 ;; * revert (file) | 212 ;; * revert (file &optional contents-done) |
213 ;; | 213 ;; |
214 ;; Revert FILE back to the current workfile version. | 214 ;; Revert FILE back to the current workfile version. If optional |
215 ;; arg CONTENTS-DONE is non-nil, then the contents of FILE have | |
216 ;; already been reverted from a version backup, and this function | |
217 ;; only needs to update the status of FILE within the backend. | |
215 ;; | 218 ;; |
216 ;; - cancel-version (file editable) | 219 ;; - cancel-version (file editable) |
217 ;; | 220 ;; |
218 ;; Cancel the current workfile version of FILE, i.e. remove it from the | 221 ;; Cancel the current workfile version of FILE, i.e. remove it from the |
219 ;; master. EDITABLE non-nil means that FILE should be writable | 222 ;; master. EDITABLE non-nil means that FILE should be writable |
2463 (defun vc-revert-file (file) | 2466 (defun vc-revert-file (file) |
2464 "Revert FILE back to the version it was based on." | 2467 "Revert FILE back to the version it was based on." |
2465 (with-vc-properties | 2468 (with-vc-properties |
2466 file | 2469 file |
2467 (let ((backup-file (vc-version-backup-file file))) | 2470 (let ((backup-file (vc-version-backup-file file))) |
2468 (if (not backup-file) | 2471 (when backup-file |
2469 (vc-call revert file) | |
2470 (copy-file backup-file file 'ok-if-already-exists 'keep-date) | 2472 (copy-file backup-file file 'ok-if-already-exists 'keep-date) |
2471 (vc-delete-automatic-version-backups file))) | 2473 (vc-delete-automatic-version-backups file)) |
2474 (vc-call revert file backup-file)) | |
2472 `((vc-state . up-to-date) | 2475 `((vc-state . up-to-date) |
2473 (vc-checkout-time . ,(nth 5 (file-attributes file))))) | 2476 (vc-checkout-time . ,(nth 5 (file-attributes file))))) |
2474 (vc-resynch-buffer file t t)) | 2477 (vc-resynch-buffer file t t)) |
2475 | 2478 |
2476 ;;;###autoload | 2479 ;;;###autoload |