]> code.delx.au - gnu-emacs/blobdiff - lisp/vc-svn.el
Add 2006 to copyright years.
[gnu-emacs] / lisp / vc-svn.el
index 553024f636d21babc55e7c084ee7bba42875c1a7..82942f78358edf72c3025e3ef334203e9b8c5f71 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, 2005
-;;           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
@@ -372,7 +395,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