 (defvar svn-ediff-result)
 (defvar svn-status-last-diff-options nil)
 (defvar svn-admin-last-repository-dir nil "The last repository url for various operations.")
+(defvar svn-last-cmd-ring (make-ring 30) "Ring that holds the last executed svn commands (for debugging purposes)")
+(defvar svn-status-cached-version-string nil)
 
 (defvar svn-status-partner-buffer nil "The partner buffer for this svn related buffer")
 (make-variable-buffer-local 'svn-status-partner-buffer)

            (setq svn-status-mode-line-process-status (format " running %s" cmdtype))
            (svn-status-update-mode-line)
            (sit-for 0.1)
            (if run-asynchron
                (progn
                  ;;(message "running asynchron: %s %S" svn-exe arglist)

  (elp-instrument-package "svn-")
  (message "Run the desired svn command (e.g. M-x svn-status), then use M-x elp-results."))

(defun svn-status-last-commands (&optional string-prefix)
  "Return a string with the last executed svn commands"
  (interactive)
  (unless string-prefix
    (setq string-prefix ""))
  (with-output-to-string
    (dolist (e (ring-elements svn-last-cmd-ring))
      (princ (format "%s%s: svn %s <%s>\n" string-prefix (nth 0 e) (mapconcat 'concat (nth 1 e) " ") (nth 2 e))))))

(defun svn-insert-indented-lines (text)
  "Helper function to insert TEXT, indented by two characters."
  (dolist (line (split-string text "\n"))
    (insert (format "  %s\n" line))))

(defun svn-prepare-bug-report ()
  "Create the buffer *psvn-bug-report*. This buffer can be useful to debug problems with psvn.el"
  (interactive)
  (let ((last-output-buffer-name svn-status-last-output-buffer-name)
        (last-svn-cmd-output (with-current-buffer svn-status-last-output-buffer-name
                               (buffer-substring-no-properties (point-min) (point-max)))))
    (switch-to-buffer "*psvn-bug-report*")
    (delete-region (point-min) (point-max))
    (insert "This buffer holds some debug informations for psvn.el\n")
    (insert "Please send it to the author to allow easier debugging\n\n")
    (insert "Revisions:\n")
    (svn-insert-indented-lines (svn-status-version))
    (insert "\nLast svn commands:\n")
    (svn-insert-indented-lines (svn-status-last-commands))
    (insert (format "\nContent of the <%s> buffer:\n" last-output-buffer-name))
    (svn-insert-indented-lines last-svn-cmd-output)
    (goto-char (point-min))))

(provide 'psvn)

