]> code.delx.au - gnu-emacs/blobdiff - lisp/vc-svn.el
(enum event_kind) [MAC_OS]: Update comment for MAC_APPLE_EVENT.
[gnu-emacs] / lisp / vc-svn.el
index cbb951d60b7b35b14aa7aad7faecb23ad84256f5..6d27c5c6a7ed41105d37dad00baa9f14a7357e6e 100644 (file)
@@ -1,7 +1,6 @@
 ;;; vc-svn.el --- non-resident support for Subversion version-control
 
-;; Copyright (C) 1995, 1998, 1999, 2000, 2001, 2002, 2003, 2004
-;;           Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
 
 ;; Author:      FSF (see vc.el for full credits)
 ;; Maintainer:  Stefan Monnier <monnier@gnu.org>
@@ -20,8 +19,8 @@
 
 ;; You should have received a copy of the GNU General Public License
 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
 
 ;;; Commentary:
 
@@ -51,7 +50,7 @@
                 (repeat :tag "Argument List"
                         :value ("")
                         string))
-  :version "21.4"
+  :version "22.1"
   :group 'vc)
 
 (defcustom vc-svn-register-switches nil
@@ -63,7 +62,7 @@ A string or list of strings passed to the checkin program by
                 (repeat :tag "Argument List"
                         :value ("")
                         string))
-  :version "21.4"
+  :version "22.1"
   :group 'vc)
 
 (defcustom vc-svn-diff-switches
@@ -77,12 +76,12 @@ If you want to force an empty list of arguments, use t."
                 (repeat :tag "Argument List"
                         :value ("")
                         string))
-  :version "21.4"
+  :version "22.1"
   :group 'vc)
 
 (defcustom vc-svn-header (or (cdr (assoc 'SVN vc-header-alist)) '("\$Id\$"))
   "*Header keywords to be inserted by `vc-insert-headers'."
-  :version "21.4"
+  :version "22.1"
   :type '(repeat string)
   :group 'vc)
 
@@ -92,7 +91,7 @@ If you want to force an empty list of arguments, use t."
 This is only meaningful if you don't use the implicit checkout model
 \(i.e. if you have $SVNREAD set)."
   ;; :type 'boolean
-  ;; :version "21.4"
+  ;; :version "22.1"
   ;; :group 'vc
   )
 
@@ -115,12 +114,19 @@ This is only meaningful if you don't use the implicit checkout model
                                           (file-name-directory file)))
     (with-temp-buffer
       (cd (file-name-directory file))
-      (condition-case nil
-         (vc-svn-command t 0 file "status" "-v")
-       ;; We can't find an `svn' executable.  We could also deregister SVN.
-       (file-error nil))
-      (vc-svn-parse-status t)
-      (eq 'SVN (vc-file-getprop file 'vc-backend)))))
+      (let ((status
+             (condition-case nil
+                 ;; Ignore all errors.
+                 (vc-svn-command t t file "status" "-v")
+               ;; Some problem happened.  E.g. We can't find an `svn'
+               ;; executable.  We used to only catch `file-error' but when
+               ;; the process is run on a remote host via Tramp, the error
+               ;; is only reported via the exit status which is turned into
+               ;; an `error' by vc-do-command.
+               (error nil))))
+        (when (eq 0 status)
+          (vc-svn-parse-status t)
+          (eq 'SVN (vc-file-getprop file 'vc-backend)))))))
 
 (defun vc-svn-state (file &optional localp)
   "SVN-specific version of `vc-state'."
@@ -170,6 +176,23 @@ This is only meaningful if you don't use the implicit checkout model
          ((eq svn-state 'needs-patch) "(patch)")
          ((eq svn-state 'needs-merge) "(merge)"))))
 
+(defun vc-svn-previous-version (file rev)
+  (let ((newrev (1- (string-to-number rev))))
+    (when (< 0 newrev)
+      (number-to-string newrev))))
+
+(defun vc-svn-next-version (file rev)
+  (let ((newrev (1+ (string-to-number rev))))
+    ;; The "workfile version" is an uneasy conceptual fit under Subversion;
+    ;; we use it as the upper bound until a better idea comes along.  If the
+    ;; workfile version W coincides with the tree's latest revision R, then
+    ;; this check prevents a "no such revision: R+1" error.  Otherwise, it
+    ;; inhibits showing of W+1 through R, which could be considered anywhere
+    ;; from gracious to impolite.
+    (unless (< (string-to-number (vc-file-getprop file 'vc-workfile-version))
+               newrev)
+      (number-to-string newrev))))
+
 
 ;;;
 ;;; State-changing functions
@@ -347,11 +370,19 @@ The changes are between FIRST-VERSION and SECOND-VERSION."
     (vc-svn-command
      buffer
      (if (and (vc-stay-local-p file) (fboundp 'start-process)) 'async 0)
-     file "log")))
+     file "log"
+     ;; By default Subversion only shows the log upto the working version,
+     ;; whereas we also want the log of the subsequent commits.  At least
+     ;; that's what the vc-cvs.el code does.
+     "-rHEAD:0")))
 
 (defun vc-svn-diff (file &optional oldvers newvers buffer)
   "Get a difference report using SVN between two versions of FILE."
   (unless buffer (setq buffer "*vc-diff*"))
+  (if (and oldvers (equal oldvers (vc-workfile-version file)))
+      ;; Use nil rather than the current revision because svn handles it
+      ;; better (i.e. locally).
+      (setq oldvers nil))
   (if (string= (vc-workfile-version file) "0")
       ;; This file is added but not yet committed; there is no master file.
       (if (or oldvers newvers)
@@ -368,7 +399,8 @@ The changes are between FIRST-VERSION and SECOND-VERSION."
            (if vc-svn-diff-switches
                (vc-switches 'SVN 'diff)
              (list "-x" (mapconcat 'identity (vc-switches nil 'diff) " "))))
-          (async (and (vc-stay-local-p file)
+          (async (and (not vc-disable-async-diff)
+                       (vc-stay-local-p file)
                       (or oldvers newvers) ; Svn diffs those locally.
                       (fboundp 'start-process))))
       (apply 'vc-svn-command buffer