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

[PATCH] Make display_lines() spawn diff

From: Ramkumar Ramachandra <artagnon_at_gmail.com>
Date: Sat, 24 Jul 2010 18:46:11 +0530

Hi,

This patch is not intended for inclusion, but I hope it conveys the
idea- I want display_lines() to display a diff instead of the full
actual and expected outputs.

Thanks.

Index: subversion/tests/cmdline/svntest/verify.py
===================================================================
--- subversion/tests/cmdline/svntest/verify.py (revision 978817)
+++ subversion/tests/cmdline/svntest/verify.py (working copy)
@@ -24,7 +24,7 @@
 # under the License.
 ######################################################################
 
-import re, sys
+import re, sys, tempfile
 
 import svntest
 
@@ -275,22 +275,16 @@ 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)
+ actual_file = tempfile.NamedTemporaryFile(delete=False)
+ expected_file = tempfile.NamedTemporaryFile(delete=False)
+ actual_file.write("".join(actual))
+ expected_file.write("".join(expected))
+ actual_file.close()
+ expected_file.close()
+ exit_code, stdout_output, stderr_output = \
+ svntest.main.run_command("diff", 1, 0, '-a', '-u', \
+ actual_file.name, expected_file.name)
+ print "".join(stdout_output)
 
 def compare_and_display_lines(message, label, expected, actual,
                               raisable=None):
Received on 2010-07-24 15:18:42 CEST

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