Hi,

Instead of spawning diff, I used difflib in Python. Here's the
result. I need a +1 to commit this since it's outside my area.

Thanks.

-- Ram

[[[
* subversion/tests/cmdline/svntest/verify.py (display_lines): Use
  Python difflib to output a context diff instead of printing actual
  and expected in full.
]]]

Index: subversion/tests/cmdline/svntest/verify.py
===================================================================
--- subversion/tests/cmdline/svntest/verify.py  (revision 978817)
+++ subversion/tests/cmdline/svntest/verify.py  (working copy)
@@ -25,6 +25,7 @@
 ######################################################################
 
 import re, sys
+from difflib import context_diff
 
 import svntest
 
@@ -276,21 +277,16 @@ def display_lines(message, label, expected, actual
   if message is not None:
     print(message)
   if expected is not None:
-    output = 'EXPECTED %s' % label
+    output = 'DIFF %s' % label
     if expected_is_regexp:
       output += ' (regexp)'
     if expected_is_unordered:
       output += ' (unordered)'
     output += ':'
     print(output)
-    for x in expected:
-      sys.stdout.write(x)
-    if expected_is_regexp:
-      sys.stdout.write('\n')
-  if actual is not None:
-    print('ACTUAL %s:' % label)
-    for x in actual:
-      sys.stdout.write(x)
+  for x in context_diff(actual, expected, \
+                          fromfile="ACTUAL", tofile="EXPECTED"):
+    sys.stdout.write(x)
 
 def compare_and_display_lines(message, label, expected, actual,
                               raisable=None):

Reply via email to