Index: subversion/tests/cmdline/svntest/tree.py
===================================================================
--- subversion/tests/cmdline/svntest/tree.py	(revision 32508)
+++ subversion/tests/cmdline/svntest/tree.py	(working copy)
@@ -207,6 +207,44 @@
     else:
       print >> stream, "    Children:  None (node is probably a file)"
 
+  def print_script(self, stream = sys.stdout, strip = 0):
+    "Python-script-print the meta data for this node."
+    
+    path = self.path
+    if len(path) > len(root_node_name) and path.startswith(root_node_name):
+      path = path[(len(root_node_name)+1):]
+    if len(path) > strip:
+      path = path[strip:]
+
+    line = "%-20s: Item(" % ("'%s'" % path)
+    comma = False
+
+    mime_type = self.props.get("svn:mime-type")
+    if not mime_type or mime_type.startswith("text/"):
+      if self.children is None and not self.contents is None:
+        line += "contents=\"\"\"%s\"\"\"" % self.contents
+        comma = True
+
+    for name in self.atts:
+      if comma:
+        line += ", "
+      line += "%s='%s'" % (name, self.atts[name])
+      comma = True
+
+    # Then, there are the props. I never needed to validate them in
+    # any of my tests. I havent checked how they would be scripted. Maybe
+    # like self.atts above?
+    #
+    # for name in self.props:
+    #   if comma:
+    #     line += ", "
+    #   line += "%s='%s'" % (name, self.props[name])
+    #   comma = True
+
+    line += "),"
+    print >> stream, line
+
+
   def __str__(self):
     import StringIO
     s = StringIO.StringIO()
@@ -579,7 +617,27 @@
     else:
       dump_tree(c,indent + "  |-- ")
 
+def dump_tree_script(n, strip=0):
+  "Print out a python script representation of the tree's structure."
 
+  if n.children is None:
+    tmp_children = []
+  else:
+    tmp_children = n.children
+
+  if n.name != root_node_name:
+    if strip < len(n.path):
+      n.print_script(strip = strip)
+
+  for i in range(len(tmp_children)):
+    c = tmp_children[i]
+    if i == len(tmp_children
+                )-1:
+      dump_tree_script(c, strip=strip)
+    else:
+      dump_tree_script(c, strip=strip)
+
+
 ###################################################################
 ###################################################################
 # PARSERS that return trees made of SVNTreeNodes....
Index: subversion/tests/cmdline/svntest/actions.py
===================================================================
--- subversion/tests/cmdline/svntest/actions.py	(revision 32508)
+++ subversion/tests/cmdline/svntest/actions.py	(working copy)
@@ -608,14 +608,26 @@
 
   # Verify actual output against expected output.
   if output_tree:
-    tree.compare_trees ("output", actual_output, output_tree)
+    try:
+      tree.compare_trees ("output", actual_output, output_tree)
+    except:
+      print "ACTUAL OUTPUT TREE:\nsvntest.wc.State('%s', {" % wc_dir_name
+      tree.dump_tree_script(actual_output, len(wc_dir_name) + len(os.sep))
+      print "})"
+      raise
 
   # Create a tree by scanning the working copy, and verify it
   if disk_tree:
     actual_disk = tree.build_tree_from_wc (wc_dir_name, check_props)
-    tree.compare_trees ("disk", actual_disk, disk_tree,
-                        singleton_handler_a, a_baton,
-                        singleton_handler_b, b_baton)
+    try:
+      tree.compare_trees ("disk", actual_disk, disk_tree,
+                          singleton_handler_a, a_baton,
+                          singleton_handler_b, b_baton)
+    except:
+      print "ACTUAL DISK TREE:\nsvntest.wc.State('', {"
+      tree.dump_tree_script(actual_disk)
+      print "})"
+      raise
 
   # Verify via 'status' command too, if possible.
   if status_tree:
@@ -841,8 +853,14 @@
     raise Failure
 
   myskiptree = tree.build_tree_from_skipped(out)
-  tree.compare_trees("skip", myskiptree, skip_tree,
-                     extra_skip, None, missing_skip, None)
+  try:
+    tree.compare_trees("skip", myskiptree, skip_tree,
+                       extra_skip, None, missing_skip, None)
+  except:
+    print "ACTUAL SKIP TREE:\nsvntest.wc.State('%s', {" % dir
+    tree.dump_tree_script(myskiptree, len(dir) + len(os.sep))
+    print "})"
+    raise
 
   actual = tree.build_tree_from_checkout(out, 0)
   verify_update (actual, dir,
@@ -1059,6 +1077,9 @@
                         singleton_handler_b, b_baton)
   except tree.SVNTreeError:
     verify.display_trees(None, 'STATUS OUTPUT TREE', output_tree, actual)
+    print "ACTUAL STATUS TREE:\nsvntest.wc.State('%s', {" % wc_dir_name
+    tree.dump_tree_script(actual, len(wc_dir_name) + len(os.sep))
+    print "})"
     raise
 
 

