                          str))
   str)
 
+(defun svn-status-maybe-add-face (condition text face)
+  "If CONDITION then add FACE to TEXT.
+Else return TEXT unchanged."
+  (if condition
+      (svn-add-face text face)
+    text))
+
+(defun svn-status-choose-face-to-add (condition text face1 face2)
+  "If CONDITION then add FACE1 to TEXT, else add FACE2 to TEXT."
+  (if condition
+      (svn-add-face text face1)
+    (svn-add-face text face2)))
+
 ; compatibility
 ; emacs 20
 (unless (fboundp 'point-at-eol) (defalias 'point-at-eol 'line-end-position))

                (eq (svn-status-line-info->propmark line-info) ? )
                (eq (svn-status-line-info->propmark line-info) nil)))))


(defun svn-insert-line-in-status-buffer (line-info)
  (let ((s "*"))
    (let ((usermark (if (svn-status-line-info->has-usermark line-info)
                        (svn-add-face "*" 'svn-status-marked-face)
                      " "))
          (external (if (svn-status-line-info->modified-external line-info)
                        (svn-add-face " (modified external)" 'svn-status-modified-external-face)
                      "")))
      (insert (concat usermark
                      (format " %c%c %3s %3s %-9s %s"
                              (svn-status-line-info->filemark line-info)
                              (or (svn-status-line-info->propmark line-info) ? )
                              (or (svn-status-line-info->localrev line-info) "")
                              (or (svn-status-line-info->lastchangerev line-info) "")
                              (svn-status-line-info->author line-info)
                              (svn-status-line-info->filename line-info))
                      external
                      "\n")))))

(defun svn-status-update-buffer ()
  (interactive)

  (find-file-other-window (svn-status-line-info->filename
                           (svn-status-get-line-information))))

(defun svn-status-find-file-or-examine-directory ()
  "If point is on a directory, run `svn-status' on that directory.
Otherwise run `find-file'."
  (interactive)
  (let ((line-info (svn-status-get-line-information)))
    (if (svn-status-line-info->directory-p line-info)
        (svn-status (svn-status-line-info->full-path line-info))
      (find-file (svn-status-line-info->filename line-info)))))

(defun svn-status-examine-parent ()
  "Run `svn-status' on the parent of the current directory."
  (interactive)
  (svn-status (expand-file-name "../")))

(defun svn-status-line-info->has-usermark (line-info) (nth 0 line-info))
(defun svn-status-line-info->filemark (line-info) (nth 1 line-info))
(defun svn-status-line-info->propmark (line-info) (nth 2 line-info))
