]> code.delx.au - gnu-emacs/blobdiff - lisp/vc-svn.el
(unload-feature): Handle (t . SYMBOL) entries in load history.
[gnu-emacs] / lisp / vc-svn.el
index c48ce7a5f9918c705956916d0a024ce2c7ed76fc..730806fdcd08c191e852b66f64b877f5fff9dd88 100644 (file)
@@ -1,6 +1,6 @@
 ;;; vc-svn.el --- non-resident support for Subversion version-control
 
-;; Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
 
 ;; Author:      FSF (see vc.el for full credits)
 ;; Maintainer:  Stefan Monnier <monnier@gnu.org>
@@ -95,22 +95,38 @@ This is only meaningful if you don't use the implicit checkout model
   ;; :group 'vc
   )
 
+(defvar vc-svn-admin-directory
+  (cond ((and (eq system-type 'windows-nt)
+             (getenv "SVN_ASP_DOT_NET_HACK"))
+        "_svn")
+       (t ".svn"))
+  "The name of the \".svn\" subdirectory or its equivalent.")
+
 ;;;
 ;;; State-querying functions
 ;;;
 
+;;; vc-svn-admin-directory is generally not defined when the
+;;; autoloaded function is called.
+
 ;;;###autoload (defun vc-svn-registered (f)
-;;;###autoload   (when (file-readable-p (expand-file-name
-;;;###autoload                           ".svn/entries" (file-name-directory f)))
+;;;###autoload   (let ((admin-dir (cond ((and (eq system-type 'windows-nt)
+;;;###autoload                                (getenv "SVN_ASP_DOT_NET_HACK"))
+;;;###autoload                           "_svn")
+;;;###autoload                          (t ".svn"))))
+;;;###autoload     (when (file-readable-p (expand-file-name
+;;;###autoload                             (concat admin-dir "/entries")
+;;;###autoload                             (file-name-directory f)))
 ;;;###autoload       (load "vc-svn")
-;;;###autoload       (vc-svn-registered f)))
+;;;###autoload       (vc-svn-registered f))))
 
 ;;;###autoload
 (add-to-list 'completion-ignored-extensions ".svn/")
 
 (defun vc-svn-registered (file)
   "Check if FILE is SVN registered."
-  (when (file-readable-p (expand-file-name ".svn/entries"
+  (when (file-readable-p (expand-file-name (concat vc-svn-admin-directory
+                                                  "/entries")
                                           (file-name-directory file)))
     (with-temp-buffer
       (cd (file-name-directory file))
@@ -206,7 +222,7 @@ the SVN command (in that order)."
 
 (defun vc-svn-responsible-p (file)
   "Return non-nil if SVN thinks it is responsible for FILE."
-  (file-directory-p (expand-file-name ".svn"
+  (file-directory-p (expand-file-name vc-svn-admin-directory
                                      (if (file-directory-p file)
                                          file
                                        (file-name-directory file)))))
@@ -329,18 +345,23 @@ The changes are between FIRST-VERSION and SECOND-VERSION."
         (if (looking-at "At revision")
             0 ;; there were no news; indicate success
           (if (re-search-forward
-               (concat "^\\([CGDU]  \\)?"
+               ;; Newer SVN clients have 3 columns of chars (one for the
+               ;; file's contents, then second for its properties, and the
+               ;; third for lock-grabbing info), before the 2 spaces.
+               ;; We also used to match the filename in column 0 without any
+               ;; meta-info before it, but I believe this can never happen.
+               (concat "^\\(\\([ACGDU]\\)\\(.[B ]\\)?  \\)"
                        (regexp-quote (file-name-nondirectory file)))
                nil t)
               (cond
                ;; Merge successful, we are in sync with repository now
-               ((string= (match-string 1) "U  ")
+               ((string= (match-string 2) "U")
                 (vc-file-setprop file 'vc-state 'up-to-date)
                 (vc-file-setprop file 'vc-checkout-time
                                  (nth 5 (file-attributes file)))
                 0);; indicate success to the caller
                ;; Merge successful, but our own changes are still in the file
-               ((string= (match-string 1) "G  ")
+               ((string= (match-string 2) "G")
                 (vc-file-setprop file 'vc-state 'edited)
                 0);; indicate success to the caller
                ;; Conflicts detected!
@@ -474,10 +495,12 @@ and that it passes `vc-svn-global-switches' to it before FLAGS."
     (let ((coding-system-for-read
           (or file-name-coding-system
               default-file-name-coding-system)))
-      (vc-insert-file (expand-file-name ".svn/entries" dirname)))
+      (vc-insert-file (expand-file-name (concat vc-svn-admin-directory
+                                               "/entries")
+                                       dirname)))
     (goto-char (point-min))
     (when (re-search-forward
-          ;; Old `svn' used name="svn:dir", newer use just name="".
+          ;; Old `svn' used name="svn:this_dir", newer use just name="".
           (concat "name=\"\\(?:svn:this_dir\\)?\"[\n\t ]*"
                   "\\(?:[-a-z]+=\"[^\"]*\"[\n\t ]*\\)*?"
                   "url=\"\\([^\"]+\\)\"") nil t)
@@ -493,9 +516,13 @@ information about FILENAME and return its status."
   (let (file status)
     (goto-char (point-min))
     (while (re-search-forward
-           "^[ ADMCI?!~][ MC][ L][ +][ S]..\\([ *]\\) +\\([-0-9]+\\) +\\([0-9?]+\\) +\\([^ ]+\\) +" nil t)
-      (setq file (expand-file-name
-                 (buffer-substring (point) (line-end-position))))
+            ;; Ignore the files with status in [IX?].
+           "^[ ACDGMR!~][ MC][ L][ +][ S]..\\([ *]\\) +\\([-0-9]+\\) +\\([0-9?]+\\) +\\([^ ]+\\) +" nil t)
+      ;; If the username contains spaces, the output format is ambiguous,
+      ;; so don't trust the output's filename unless we have to.
+      (setq file (or filename
+                     (expand-file-name
+                      (buffer-substring (point) (line-end-position)))))
       (setq status (char-after (line-beginning-position)))
       (unless (eq status ??)
        ;; `vc-BACKEND-registered' must not set vc-backend,