[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] Make display_lines() spawn diff

From: Ramkumar Ramachandra <artagnon_at_gmail.com>
Date: Sat, 24 Jul 2010 20:39:26 +0530

Hi Stefan,

Stefan Sperling writes:
> ... this won't work on windows.
>
> We'll need a utility function in our test suite that prints diffs.

Right. How about this?

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
 
@@ -275,22 +276,8 @@ def display_lines(message, label, expected, actual
   Both EXPECTED and ACTUAL may be strings or lists of strings."""
   if message is not None:
     print(message)
- if expected is not None:
- output = 'EXPECTED %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 line in context_diff(actual, expected, fromfile="actual", tofile="expected"):
+ print line,
 
 def compare_and_display_lines(message, label, expected, actual,
                               raisable=None):
Received on 2010-07-24 17:11:49 CEST

This is an archived mail posted to the Subversion Dev mailing list.