         (goto-char (point-min))
         (while (re-search-forward "\r$" (point-max) t)
           (replace-match "" nil nil))))))
+
+(defun svn-fixup-tramp-exit ()
+  "Helper function to handle tramp connections stopping with an exit output."
+  (goto-char (point-max))
+  (when (eq (svn-point-at-bol) (svn-point-at-eol))
+    (forward-line -1))
+  (beginning-of-line)
+  (when (looking-at "exit")
+    (delete-region (point) (svn-point-at-eol))))
+
+(defun svn-fixup-tramp-output-maybe ()
+  "Fixup leftover output when running via tramp"
+  (when (file-remote-p default-directory)
+    (svn-fixup-tramp-exit)))
 
 (condition-case nil
     ;;(easy-menu-add-item nil '("tools") ["SVN Status" svn-status t] "PCL-CVS")

          (replace-match "/")))))

(defun svn-process-sentinel (process event)
  ;;(princ (format "Process: %s had the event `%s'" process event)))
  ;;(save-excursion
  (let ((act-buf (current-buffer)))
    (when svn-pre-run-mode-line-process
      (with-current-buffer svn-status-pre-run-svn-buffer

  "Finish editing the log message and run svn commit."
  (interactive)
  (svn-status-save-some-buffers)
  (let ((svn-logedit-file-name))
    (save-excursion
      (set-buffer (get-buffer svn-log-edit-buffer-name))
      (when svn-log-edit-insert-files-to-commit
        (svn-log-edit-remove-comment-lines))
      (when (fboundp 'set-buffer-file-coding-system)
        (set-buffer-file-coding-system svn-status-svn-file-coding-system nil))
      (when (or svn-log-edit-update-log-entry svn-status-files-to-commit)
        (setq svn-log-edit-file-name (concat svn-status-temp-dir "svn-log-edit.txt" svn-temp-suffix))
        (setq svn-status-temp-file-to-remove (svn-expand-filename-for-remote-access svn-log-edit-file-name))
        (write-region (point-min) (point-max) svn-status-temp-file-to-remove nil 1))
      (bury-buffer))
    (if svn-log-edit-update-log-entry
        (when (y-or-n-p "Update the log entry? ")
          ;;   svn propset svn:log --revprop -r11672 -F file
          (svn-run nil t 'propset "propset" "svn:log" "--revprop"
                   (concat "-r" svn-log-edit-update-log-entry)
                   "-F" svn-log-edit-file-name)
          (save-excursion
            (set-buffer svn-process-buffer-name)
            (message "%s" (buffer-substring (point-min) (- (point-max) 1)))))
      (when svn-status-files-to-commit ; there are files to commit
        (setq svn-status-operated-on-dot
              (and (= 1 (length svn-status-files-to-commit))
                   (string= "." (svn-status-line-info->filename (car svn-status-files-to-commit)))))
        (svn-status-create-arg-file svn-status-temp-arg-file "" svn-status-files-to-commit "")
        (svn-run t t 'commit "commit"
                 (unless svn-status-recursive-commit "--non-recursive")
                 "--targets" svn-status-temp-arg-file
                 "-F" svn-log-edit-file-name
                 (when (eq svn-status-svn-file-coding-system 'utf-8)
                   '("--encoding" "UTF-8"))
                 svn-status-default-commit-arguments))
      (set-window-configuration svn-status-pre-commit-window-configuration)
      (message "svn-log editing done"))))

(defun svn-log-edit-svn-diff (arg)
  "Show the diff we are about to commit.
