 
 ;;; Commentary
 
-;; psvn.el is tested with GNU Emacs 21.1.1 on windows, debian linux
-;; with svn 0.14.3
+;; psvn.el is tested with GNU Emacs 21.3 on windows, debian linux
+;; with svn 0.23
 
 ;; psvn.el is an interface for the revision control tool subversion
 ;; (see http://subversion.tigris.org)

  (interactive)
  (kill-all-local-variables)
  (use-local-map svn-log-edit-mode-map)
  (setq major-mode 'svn-log-edit-mode)
  (setq mode-name "svn-log-edit"))


      ;;(message (format "SVN Error: :%s:" event))
      (svn-status-show-process-buffer-internal t))))

(defun svn-parse-rev-num (str)
  (if (and str (stringp str)
           (save-match-data (string-match "^[0-9]+" str)))
      (string-to-number str)
    -1))


(defun svn-parse-status-result ()
  (setq svn-status-head-revision nil)
  (save-excursion
    (let ((old-marked-files (svn-status-marked-file-names))
          (line-string)
          (user-mark)
          ;;(file-svn-info)
          (svn-marks)
          (svn-file-mark)
          (svn-property-mark)
          (svn-update-mark)
          (local-rev)
          (last-change-rev)
          ;;(modified-external)
          (author)
          (path))
      (set-buffer "*svn-process*")
      (setq svn-status-info nil)
      (goto-char (point-min))
      (while (> (- (point-at-eol) (point-at-bol)) 0)
        ;;(setq modified-external nil)
        ;;(setq line-string (buffer-substring-no-properties
        ;;                   (point-at-bol)
        ;;                   (point-at-eol)))
        ;;(if (string-match "Head revision:[ ]+\\([0-9]+\\)" line-string)
        ;;    (setq svn-status-head-revision (match-string 1 line-string))
        ;;  (setq file-svn-info (append (list (substring line-string 0 4))
        ;;                              (if svn-xemacsp
        ;;                                  (cdr (split-string (substring line-string 5)))
        ;;                                (split-string (substring line-string 5)))))
        ;;  (when (string= (nth 1 file-svn-info) "*")
        ;;    (setq modified-external t)
        ;;    ; remove the (nth 1) entry
        ;;    (setq file-svn-info (append
        ;;                         (list (car file-svn-info))
        ;;                         ; nth 1 removed
        ;;                         (cddr file-svn-info))))
        ;;  (setq svn-file-mark (string-to-char (car file-svn-info)))
        ;;  (setq svn-property-mark (string-to-char (substring (car file-svn-info) 1)))
        ;;  (when (eq svn-property-mark 0) (setq svn-property-mark nil))
        ;;  ;is this necessary?
        (if (looking-at "Head revision:[ ]+\\([0-9]+\\)")
            (setq svn-status-head-revision (match-string 1))
          (setq svn-marks (buffer-substring (point) (+ (point) 8))
                svn-file-mark (elt svn-marks 0) ; 1st column
                svn-property-mark (elt svn-marks 1)) ; 2nd column

          (when (eq svn-property-mark ?\ ) (setq svn-property-mark nil))
          ;;(cond ((eq svn-file-mark ??)
          ;;       (setq path (nth 1 file-svn-info)
          ;;             local-rev -1
          ;;             last-change-rev -1
          ;;             author "?"))
          ;;      (t
          ;;       (setq path (nth 4 file-svn-info)
          ;;             local-rev (string-to-number (nth 1 file-svn-info))
          ;;             last-change-rev (string-to-number (nth 2 file-svn-info))
          ;;             author (nth 3 file-svn-info))))
          (when (eq svn-update-mark ?\ ) (setq svn-update-mark nil))
          (forward-char 8)
          (skip-chars-forward " ")
          (cond
           ((looking-at "\\([-?]\\|[0-9]+\\) +\\([-?]\\|[0-9]+\\) +\\([^ ]+\\) *\\(.+\\)")
            (setq local-rev (svn-parse-rev-num (match-string 1))
                  last-change-rev (svn-parse-rev-num (match-string 2))
                  author (match-string 3)
                  path (match-string 4)))
           ((looking-at "\\(.*\\)")
            (setq path (match-string 1)
                  local-rev -1
                  last-change-rev -1
                  author "?"))
           (t
            (error "Unknown status line format."))))
          (unless path (setq path "."))
          (setq user-mark (not (not (member path old-marked-files))))
          ;;(setq svn-status-info (append svn-status-info
          ;;                              (list
          ;;                               (list user-mark
          ;;                                     svn-file-mark
          ;;                                     svn-property-mark
          ;;                                     path
          ;;                                     local-rev
          ;;                                     last-change-rev
          ;;                                     author
          ;;                                     modified-external)))))
                                               ;;file-svn-info
          (setq svn-status-info (cons (list user-mark
                                            svn-file-mark
                                            svn-property-mark
                                            path
                                            local-rev
                                            last-change-rev
                                            author
                                            svn-update-mark)
                                      svn-status-info))

          ;;(next-line 1)))))
          (forward-line 1))
      (setq svn-status-info (nreverse svn-status-info)))))

(defun svn-status-remove-control-M ()
  "Remove ^M at end of line in the whole buffer."
