summaryrefslogtreecommitdiff
path: root/lisp/vc.el
diff options
context:
space:
mode:
authorAndré Spiegel <spiegel@gnu.org>2002-02-28 13:01:48 +0000
committerAndré Spiegel <spiegel@gnu.org>2002-02-28 13:01:48 +0000
commit7aa3f20432515691a475cba72ec669b49cde3fa1 (patch)
treea613623dfe732aef098fb778a12a93d500cbfd1a /lisp/vc.el
parented19781a9efc4b1556ec4bd2a57bf9c667ba5130 (diff)
downloademacs-7aa3f20432515691a475cba72ec669b49cde3fa1.tar.gz
(vc-update): New function.
Diffstat (limited to 'lisp/vc.el')
-rw-r--r--lisp/vc.el30
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 @@
;; Maintainer: Andre Spiegel <spiegel@gnu.org>
;; Keywords: tools
-;; $Id: vc.el,v 1.327 2002/02/25 22:00:51 spiegel Exp $
+;; $Id: vc.el,v 1.328 2002/02/28 09:59:08 spiegel Exp $
;; This file is part of GNU Emacs.
@@ -2571,6 +2571,34 @@ changes found in the master file; use \\[universal-argument] \\[vc-next-action]
(vc-revert-file file)
(message "Reverting %s...done" file)))
+;;;###autoload
+(defun vc-update ()
+ "Update the current buffer's file to the latest version on its branch.
+If the file contains no changes, and is not locked, then this simply replaces
+the working file with the latest version on its branch. If the file contains
+changes, and the backend supports merging news, then any recent changes from
+the current branch are merged into the working file."
+ (interactive)
+ (vc-ensure-vc-buffer)
+ (vc-buffer-sync nil)
+ (let ((file buffer-file-name))
+ (if (vc-up-to-date-p file)
+ (vc-checkout file nil "")
+ (if (eq (vc-checkout-model file) 'locking)
+ (if (eq (vc-state file) 'edited)
+ (error
+ (substitute-command-keys
+ "File is locked--type \\[vc-revert-buffer] to discard changes"))
+ (error
+ (substitute-command-keys
+ "Unexpected file state (%s)--type \\[vc-next-action] to correct")
+ (vc-state file)))
+ (if (not (vc-find-backend-function (vc-backend file) 'merge-news))
+ (error "Sorry, merging news is not implemented for %s"
+ (vc-backend file))
+ (vc-call merge-news file)
+ (vc-resynch-window file t t))))))
+
(defun vc-version-backup-file (file &optional rev)
"Return name of backup file for revision REV of FILE.
If version backups should be used for FILE, and there exists