]> code.delx.au - gnu-emacs/blobdiff - lisp/vc-svn.el
(rmail-current-message, rmail-inbox-list): Add defvars.
[gnu-emacs] / lisp / vc-svn.el
index fafb5eff7cdffccae0bdbb761d7d9fec5f304d06..de34fa847e250479fe9b8a35548996062211e883 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 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
   )
 
@@ -352,6 +351,10 @@ The changes are between FIRST-VERSION and SECOND-VERSION."
 (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 +371,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
@@ -447,10 +451,14 @@ and that it passes `vc-svn-global-switches' to it before FLAGS."
       (vc-insert-file (expand-file-name ".svn/entries" dirname)))
     (goto-char (point-min))
     (when (re-search-forward
-          (concat "name=\"svn:this_dir\"[\n\t ]*"
-                  "\\([-a-z]+=\"[^\"]*\"[\n\t ]*\\)*?"
+          ;; Old `svn' used name="svn:dir", newer use just name="".
+          (concat "name=\"\\(?:svn:this_dir\\)?\"[\n\t ]*"
+                  "\\(?:[-a-z]+=\"[^\"]*\"[\n\t ]*\\)*?"
                   "url=\"\\([^\"]+\\)\"") nil t)
-      (match-string 2))))
+      ;; This is not a hostname but a URL.  This may actually be considered
+      ;; as a feature since it allows vc-svn-stay-local to specify different
+      ;; behavior for different modules on the same server.
+      (match-string 1))))
 
 (defun vc-svn-parse-status (localp)
   "Parse output of \"svn status\" command in the current buffer.
@@ -505,6 +513,30 @@ essential information."
   (and (string-match "^[0-9]" tag)
        (not (string-match "[^0-9]" tag))))
 
+;; Support for `svn annotate'
+
+(defun vc-svn-annotate-command (file buf &optional rev)
+  (vc-svn-command buf 0 file "annotate" (if rev (concat "-r" rev))))
+
+(defun vc-svn-annotate-time-of-rev (rev)
+  ;; Arbitrarily assume 10 commmits per day.
+  (/ (string-to-number rev) 10.0))
+
+(defun vc-svn-annotate-current-time ()
+  (vc-svn-annotate-time-of-rev vc-annotate-parent-rev))
+
+(defconst vc-svn-annotate-re "[ \t]*\\([0-9]+\\)[ \t]+[^\t ]+ ")
+
+(defun vc-svn-annotate-time ()
+  (when (looking-at vc-svn-annotate-re)
+    (goto-char (match-end 0))
+    (vc-svn-annotate-time-of-rev (match-string 1))))
+
+(defun vc-svn-annotate-extract-revision-at-line ()
+  (save-excursion
+    (beginning-of-line)
+    (if (looking-at vc-svn-annotate-re) (match-string 1))))
+
 (provide 'vc-svn)
 
 ;; arch-tag: 02f10c68-2b4d-453a-90fc-1eee6cfb268d