diff lisp/vc-rcs.el @ 31404:f2ab9420390f

2000-09-05 Stefan Monnier <monnier@cs.yale.edu> * vc.el: (toplevel): Don't require `dired' at run-time. (vc-dired-resynch-file): Remove autoload cookie. 2000-09-05 Andre Spiegel <spiegel@gnu.org> * vc.el: Made several backend functions optional. (vc-default-responsible-p): New function. (vc-merge): Use RET for first version to trigger merge-news, not prefix arg. (vc-annotate): Handle backends that do not support annotation. (vc-default-merge-news): Removed. The existence of a merge-news implementation is now checked on caller sites. * vc-hooks.el (vc-default-mode-line-string): Removed CVS special case. * vc-cvs.el (vc-cvs-mode-line-string): New function, handles the special case that has been removed from the default in vc-hooks.el. 2000-09-05 Stefan Monnier <monnier@cs.yale.edu> * vc.el (vc-log-edit): Properly handle the case where FILE is nil. 2000-09-05 Andre Spiegel <spiegel@gnu.org> * vc-hooks.el: Require vc during compilation. (vc-file-setprop): Use `vc-touched-properties' if bound by the new macro `with-vc-properties' in vc.el. (vc-file-getprop): Doc fix. (vc-after-save): Call `vc-dired-resynch-file' only if vc is loaded. * vc.el: Require dired-aux during compilation. (vc-name-assoc-file): Moved to vc-sccs.el. (with-vc-properties): New macro. (vc-checkin, vc-checkout, vc-revert, vc-cancel-version, vc-finish-steal): Use it. (vc-cancel-version): Moved RCS-specific code to vc-rcs.el. The call to the backend-specific function is now supposed to do the checkout, too. (vc-log-edit): Handle FILE being nil and added a FIXME for log-edit. * vc-cvs.el (vc-cvs-checkin, vc-cvs-checkout): Don't bother to set file properties; that gets done in the generic code now. * vc-rcs.el (vc-rcs-uncheck): Renamed to `vc-rcs-cancel-version'. Changed parameter list, added code from vc.el that does the checkout, possibly with a double-take. * vc-sccs.el (vc-sccs-name-assoc-file): Moved here from vc.el. (vc-sccs-add-triple, vc-sccs-rename-file, vc-sccs-lookup-triple): Use the above under the new name. (vc-sccs-uncheck): Renamed to `vc-sccs-cancel-version'. Changed parameter list, added checkout command. (vc-sccs-checkin, vc-sccs-checkout): Don't bother to set file properties; that gets done in the generic code now. 2000-09-05 Stefan Monnier <monnier@cs.yale.edu> * vc.el: Docstring fixes (courtesy of checkdoc). 2000-09-05 Stefan Monnier <monnier@cs.yale.edu> * vc.el (vc-checkout-writable-buffer-hook) (vc-checkout-writable-buffer): Remove. (vc-start-entry): Always call vc-log-edit, never vc-log-mode. (vc-log-mode): Make it into a clean derived major mode. (vc-log-edit): Mark buffer unmodified (as vc-log-mode did) and use vc-log-mode if log-edit is not available. (vc-dired-mode-map): Don't set-keymap-parent yet. (vc-dired-mode): Do set-keymap-parent here. (vc-dired-buffers-for-dir): Nop if dired is not loaded.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Tue, 05 Sep 2000 20:08:22 +0000
parents 860d7ac182e3
children 18bf0c070870
line wrap: on
line diff
--- a/lisp/vc-rcs.el	Tue Sep 05 18:18:32 2000 +0000
+++ b/lisp/vc-rcs.el	Tue Sep 05 20:08:22 2000 +0000
@@ -5,7 +5,7 @@
 ;; Author:     FSF (see vc.el for full credits)
 ;; Maintainer: Andre Spiegel <spiegel@gnu.org>
 
-;; $Id: vc-rcs.el,v 1.36 2000/08/12 18:51:30 spiegel Exp $
+;; $Id: vc-rcs.el,v 1.1 2000/09/04 19:47:43 gerd Exp $
 
 ;; This file is part of GNU Emacs.
 
@@ -476,9 +476,35 @@
   (vc-do-command nil 0 "rcs" (vc-name file) "-M"
 		 (concat "-u" rev) (concat "-l" rev)))
 
-(defun vc-rcs-uncheck (file target)
-  "Undo the checkin of FILE's revision TARGET."
-  (vc-do-command nil 0 "rcs" (vc-name file) (concat "-o" target)))
+(defun vc-rcs-cancel-version (file writable)
+  "Undo the most recent checkin of FILE.
+WRITABLE non-nil means previous version should be locked."
+  (let* ((target (vc-workfile-version file))
+	 (previous (if (vc-trunk-p target) "" (vc-branch-part target)))
+	 (config (current-window-configuration))
+	 (done nil))
+    (vc-do-command nil 0 "rcs" (vc-name file) (concat "-o" target))
+    ;; Check out the most recent remaining version.  If it fails, because
+    ;; the whole branch got deleted, do a double-take and check out the
+    ;; version where the branch started.
+    (while (not done)
+      (condition-case err
+	  (progn
+	    (vc-do-command nil 0 "co" (vc-name file) "-f"
+			   (concat (if writable "-l" "-u") previous))
+	    (setq done t))
+	(error (set-buffer "*vc*")
+	       (goto-char (point-min))
+	       (if (search-forward "no side branches present for" nil t)
+		   (progn (setq previous (vc-branch-part previous))
+			  (vc-do-command nil 0 "rcs" (vc-name file)
+					 (concat "-b" previous))
+			  ;; vc-do-command popped up a window with
+			  ;; the error message.  Get rid of it, by
+			  ;; restoring the old window configuration.
+			  (set-window-configuration config))
+		 ;; No, it was some other error: re-signal it.
+		 (signal (car err) (cdr err))))))))
 
 (defun vc-rcs-revert (file)
   "Revert FILE to the version it was based on."
@@ -526,9 +552,6 @@
 
 (defun vc-rcs-checkin (file rev comment)
   "RCS-specific version of `vc-backend-checkin'."
-  ;; Adaptation for RCS branch support: if this is an explicit checkin,
-  ;; or if the checkin creates a new branch, set the master file branch
-  ;; accordingly.
   (let ((switches (if (stringp vc-checkin-switches)
 		      (list vc-checkin-switches)
 		    vc-checkin-switches)))