                 (eq (svn-status-line-info->propmark line-info) ? )
                 (eq (svn-status-line-info->propmark line-info) nil)))))
 
+(defun svn-status-line-info->directory-p (line-info)
+  "Return t if LINE-INFO refers to a directory, nil otherwise.
+Symbolic links to directories count as directories (see `file-directory-p')."
+  (file-directory-p (svn-status-line-info->filename line-info)))
+
+(defun svn-status-line-info->full-path (line-info)
+  "Return the full path of the file represented by line-info"
+  (expand-file-name
+   (svn-status-line-info->filename line-info)))
+
+;;Not convinced that this is the fastest way, but...
+(defun svn-status-count-/ (string)
+  "Return number of \"/\"'s in STRING."
+  (let ((n 0)
+        (last 0))
+    (while (setq last (string-match "/" string (1+ last)))
+      (setq n (1+ n)))
+    n))
 
 (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")))))
+  "Format line-info and insert the result in the current buffer."
+  (let ((usermark (if (svn-status-line-info->has-usermark line-info) "*" " "))
+        (external (if (svn-status-line-info->modified-external line-info)
+                      (svn-add-face " (modified external)" 'svn-status-modified-external-face)
+                    ""))
+        ;; To add indentation based on the
+        ;; directory that the file is in, we just insert 2*(number of "/" in
+        ;; filename) spaces, which is rather hacky (but works)!
+        (filename (svn-status-choose-face-to-add
+                   (svn-status-line-info->directory-p line-info)
+                   (concat (make-string
+                            (* 2 (svn-status-count-/
+                                  (svn-status-line-info->filename line-info)))
+                            32)
+                           (if svn-status-hide-unmodified
+                               (svn-status-line-info->filename line-info)
+                             (svn-status-line-info->filename-nondirectory line-info)))
+                   'svn-status-directory-face
+                   'svn-status-filename-face)))
+    (insert (svn-status-maybe-add-face
+             (svn-status-line-info->has-usermark line-info)
+             (concat usermark
+                     (format " %c%c %3s %3s %-9s"
+                             (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))
+                     filename
+                     external
+                     "\n")
+             'svn-status-marked-face))))
 
 (defun svn-status-update-buffer ()
   (interactive)

(when (not svn-status-mode-map)
  (setq svn-status-mode-map (make-sparse-keymap))
  (suppress-keymap svn-status-mode-map)
  (define-key svn-status-mode-map [return] 'svn-status-select-line)
  (define-key svn-status-mode-map [?s] 'svn-status-show-process-buffer)
  (define-key svn-status-mode-map [?f] 'svn-status-find-file)
  (define-key svn-status-mode-map [?o] 'svn-status-find-file-other-window)

                         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))
