diff lisp/vc.el @ 83414:14a4eb789b45

Merged from miles@gnu.org--gnu-2005 (patch 169-173, 671-676) Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-671 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-672 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-673 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-674 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-675 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-676 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-169 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-170 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-171 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-172 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-173 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-454
author Karoly Lorentey <lorentey@elte.hu>
date Mon, 19 Dec 2005 19:57:22 +0000
parents 693e794b57bf f8a3e13c32d7
children d0eee3282e6b
line wrap: on
line diff
--- a/lisp/vc.el	Mon Dec 19 16:13:20 2005 +0000
+++ b/lisp/vc.el	Mon Dec 19 19:57:22 2005 +0000
@@ -762,7 +762,7 @@
 (defun vc-default-previous-version (backend file rev)
   "Return the version number immediately preceding REV for FILE,
 or nil if there is no previous version.  This default
-implementation works for <major>.<minor>-style version numbers as
+implementation works for MAJOR.MINOR-style version numbers as
 used by RCS and CVS."
   (let ((branch (vc-branch-part rev))
         (minor-num (string-to-number (vc-minor-part rev))))
@@ -781,7 +781,7 @@
 (defun vc-default-next-version (backend file rev)
   "Return the version number immediately following REV for FILE,
 or nil if there is no next version.  This default implementation
-works for <major>.<minor>-style version numbers as used by RCS
+works for MAJOR.MINOR-style version numbers as used by RCS
 and CVS."
   (when (not (string= rev (vc-workfile-version file)))
     (let ((branch (vc-branch-part rev))
@@ -930,8 +930,9 @@
 current buffer if BUFFER is t.  If the destination buffer is not
 already current, set it up properly and erase it.  The command is
 considered successful if its exit status does not exceed OKSTATUS (if
-OKSTATUS is nil, that means to ignore errors, if it is 'async, that
-means not to wait for termination of the subprocess).  FILE is the
+OKSTATUS is nil, that means to ignore error status, if it is `async', that
+means not to wait for termination of the subprocess; if it is t it means to
+ignore all execution errors).  FILE is the
 name of the working file (may also be nil, to execute commands that
 don't expect a file name).  If an optional list of FLAGS is present,
 that is inserted into the command line before the filename."
@@ -976,7 +977,9 @@
 	       `(unless (active-minibuffer-window)
                   (message "Running %s in the background... done" ',command))))
 	  (setq status (apply 'process-file command nil t nil squeezed))
-	  (when (or (not (integerp status)) (and okstatus (< okstatus status)))
+	  (when (and (not (eq t okstatus))
+                     (or (not (integerp status))
+                         (and okstatus (< okstatus status))))
 	    (pop-to-buffer (current-buffer))
 	    (goto-char (point-min))
 	    (shrink-window-if-larger-than-buffer)
@@ -2526,6 +2529,33 @@
         (if (file-exists-p backup-file)
             backup-file)))))
 
+(defun vc-default-revert (backend file contents-done)
+  (unless contents-done
+    (let ((rev (vc-workfile-version file))
+          (file-buffer (or (get-file-buffer file) (current-buffer))))
+      (message "Checking out %s..." file)
+      (let ((failed t)
+            (backup-name (car (find-backup-file-name file))))
+        (when backup-name
+          (copy-file file backup-name 'ok-if-already-exists 'keep-date)
+          (unless (file-writable-p file)
+            (set-file-modes file (logior (file-modes file) 128))))
+        (unwind-protect
+            (let ((coding-system-for-read 'no-conversion)
+                  (coding-system-for-write 'no-conversion))
+              (with-temp-file file
+                (let ((outbuf (current-buffer)))
+                  ;; Change buffer to get local value of vc-checkout-switches.
+                  (with-current-buffer file-buffer
+                    (let ((default-directory (file-name-directory file)))
+                      (vc-call find-version file rev outbuf)))))
+              (setq failed nil))
+          (when backup-name
+            (if failed
+                (rename-file backup-name file 'ok-if-already-exists)
+              (and (not vc-make-backup-files) (delete-file backup-name))))))
+      (message "Checking out %s...done" file))))
+
 (defun vc-revert-file (file)
   "Revert FILE back to the version it was based on."
   (with-vc-properties