              (dot-svn-dir (concat base-dir (svn-wc-adm-dir-name)))
              (in-tree (and repository-root (file-exists-p dot-svn-dir)))
              (dir-below (expand-file-name base-dir)))
+        ;; (message "repository-root: %s start-dir: %s" repository-root start-dir)
         (if (and (<= (car svn-client-version) 1) (< (cadr svn-client-version) 3))
             (setq base-dir (svn-status-base-dir-for-ancient-svn-client start-dir)) ;; svn version < 1.3
           (while (when (and dir-below (file-exists-p dot-svn-dir))


(defun svn-status-repo-for-path (directory)
  "Find the repository root for DIRECTORY."
  (let ((default-directory directory))
    ;;(svn-run nil t 'parse-info "info" (expand-file-name ".")) ;; expand-file-name does not work in symlinked directories...
    (svn-run nil t 'parse-info "info" ".")
    (with-current-buffer svn-process-buffer-name
      (goto-char (point-min))
      (let ((case-fold-search t))
        (when (search-forward "repository root: " nil t)
          (buffer-substring-no-properties (point) (svn-point-at-eol)))))))

(defun svn-status-base-dir (&optional start-directory)
  "Find the svn root directory for the current working copy.

                   (setq dir-below
                         (and (string-match "\\(.*/\\)[^/]+/" dir-below)
                              (match-string 1 dir-below)))
                   ;; (message "base-dir: %s, dir-below: %s, dot-svn-dir: %s in-tree: %s" base-dir dir-below dot-svn-dir in-tree)
                   (when dir-below
                     (if (string= (svn-status-repo-for-path dir-below) repository-root)
                         (setq dot-svn-dir (concat dir-below (svn-wc-adm-dir-name)))
