diff options
| author | André Spiegel | 2002-02-28 13:01:48 +0000 |
|---|---|---|
| committer | André Spiegel | 2002-02-28 13:01:48 +0000 |
| commit | 9f30fc99a4c0f92fdbefdcbc46184971cce73613 (patch) | |
| tree | 9d9528b14643aaaa2a992c3eb20c7bc974470bc0 | |
| parent | d607ebcc094fc322c9462d0d52e99a5f7efb9f9e (diff) | |
| download | emacs-9f30fc99a4c0f92fdbefdcbc46184971cce73613.tar.gz emacs-9f30fc99a4c0f92fdbefdcbc46184971cce73613.zip | |
(vc-update): New function.
| -rw-r--r-- | lisp/vc.el | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/lisp/vc.el b/lisp/vc.el index f538a6050d6..4cbcf178532 100644 --- a/lisp/vc.el +++ b/lisp/vc.el | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | ;; Maintainer: Andre Spiegel <spiegel@gnu.org> | 6 | ;; Maintainer: Andre Spiegel <spiegel@gnu.org> |
| 7 | ;; Keywords: tools | 7 | ;; Keywords: tools |
| 8 | 8 | ||
| 9 | ;; $Id: vc.el,v 1.327 2002/02/25 22:00:51 spiegel Exp $ | 9 | ;; $Id: vc.el,v 1.328 2002/02/28 09:59:08 spiegel Exp $ |
| 10 | 10 | ||
| 11 | ;; This file is part of GNU Emacs. | 11 | ;; This file is part of GNU Emacs. |
| 12 | 12 | ||
| @@ -2571,6 +2571,34 @@ changes found in the master file; use \\[universal-argument] \\[vc-next-action] | |||
| 2571 | (vc-revert-file file) | 2571 | (vc-revert-file file) |
| 2572 | (message "Reverting %s...done" file))) | 2572 | (message "Reverting %s...done" file))) |
| 2573 | 2573 | ||
| 2574 | ;;;###autoload | ||
| 2575 | (defun vc-update () | ||
| 2576 | "Update the current buffer's file to the latest version on its branch. | ||
| 2577 | If the file contains no changes, and is not locked, then this simply replaces | ||
| 2578 | the working file with the latest version on its branch. If the file contains | ||
| 2579 | changes, and the backend supports merging news, then any recent changes from | ||
| 2580 | the current branch are merged into the working file." | ||
| 2581 | (interactive) | ||
| 2582 | (vc-ensure-vc-buffer) | ||
| 2583 | (vc-buffer-sync nil) | ||
| 2584 | (let ((file buffer-file-name)) | ||
| 2585 | (if (vc-up-to-date-p file) | ||
| 2586 | (vc-checkout file nil "") | ||
| 2587 | (if (eq (vc-checkout-model file) 'locking) | ||
| 2588 | (if (eq (vc-state file) 'edited) | ||
| 2589 | (error | ||
| 2590 | (substitute-command-keys | ||
| 2591 | "File is locked--type \\[vc-revert-buffer] to discard changes")) | ||
| 2592 | (error | ||
| 2593 | (substitute-command-keys | ||
| 2594 | "Unexpected file state (%s)--type \\[vc-next-action] to correct") | ||
| 2595 | (vc-state file))) | ||
| 2596 | (if (not (vc-find-backend-function (vc-backend file) 'merge-news)) | ||
| 2597 | (error "Sorry, merging news is not implemented for %s" | ||
| 2598 | (vc-backend file)) | ||
| 2599 | (vc-call merge-news file) | ||
| 2600 | (vc-resynch-window file t t)))))) | ||
| 2601 | |||
| 2574 | (defun vc-version-backup-file (file &optional rev) | 2602 | (defun vc-version-backup-file (file &optional rev) |
| 2575 | "Return name of backup file for revision REV of FILE. | 2603 | "Return name of backup file for revision REV of FILE. |
| 2576 | If version backups should be used for FILE, and there exists | 2604 | If version backups should be used for FILE, and there exists |