You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2012/05/15 15:25:58 UTC
svn commit: r1338690 - in /subversion/branches/1.7.x-issue4153: ./
subversion/tests/cmdline/log_tests.py
Author: stsp
Date: Tue May 15 13:25:58 2012
New Revision: 1338690
URL: http://svn.apache.org/viewvc?rev=1338690&view=rev
Log:
On the 1.7.x-issue4153 branch, merge r1230798 from trunk (clean merge).
This brings in required changes for the log_diff_moved() test to run.
Modified:
subversion/branches/1.7.x-issue4153/ (props changed)
subversion/branches/1.7.x-issue4153/subversion/tests/cmdline/log_tests.py
Propchange: subversion/branches/1.7.x-issue4153/
------------------------------------------------------------------------------
Merged /subversion/trunk:r1230798
Modified: subversion/branches/1.7.x-issue4153/subversion/tests/cmdline/log_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/tests/cmdline/log_tests.py?rev=1338690&r1=1338689&r2=1338690&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/tests/cmdline/log_tests.py (original)
+++ subversion/branches/1.7.x-issue4153/subversion/tests/cmdline/log_tests.py Tue May 15 13:25:58 2012
@@ -697,6 +697,42 @@ def check_log_chain(chain, revlist, path
missing_revs, chain)
+def parse_diff(output):
+ """Return a set containing the various diff bits, broken up by file."""
+
+ diff_set = []
+ current_diff = []
+ for line in output:
+ if line.startswith('Index: ') and current_diff:
+ diff_set.append(current_diff)
+ current_diff = []
+ current_diff.append(line)
+ diff_set.append(current_diff)
+
+ return diff_set
+
+
+def setify(diff_list):
+ """Take a list of lists and make it a set of tuples."""
+ s = set()
+ for diff in diff_list:
+ s.add(tuple(diff))
+ return s
+
+
+def compare_diff_output(expected_diffs, output):
+ """Compare the diffs in EXPECTED_DIFFS (which is a Python set) with the
+ text in OUTPUT, remembering that there is no canonical ordering for diffs."""
+
+ diffs = parse_diff(output)
+ diffs = setify(diffs)
+ expected_diffs = setify(expected_diffs)
+
+ if diffs.issubset(expected_diffs) and diffs.issuperset(expected_diffs):
+ return
+
+ raise svntest.Failure("Diffs not equal")
+
######################################################################
# Tests
@@ -2081,25 +2117,25 @@ def log_diff(sbox):
'-r10:8', 'A2')
os.chdir(was_cwd)
- r9diff = make_no_diff_deleted_header('A2/B/E/alpha', 8, 9) \
- + make_diff_header('A2/B/E/beta', 'revision 8', 'revision 9') \
- + [ "@@ -1 +1,2 @@\n",
- " This is the file 'beta'.\n",
- "+9\n",
- "\ No newline at end of file\n",
- ]
- r8diff = make_diff_header('A2/D/G/rho', 'revision 0', 'revision 8') \
- + [ "@@ -0,0 +1 @@\n",
- "+88\n",
- "\ No newline at end of file\n",
- ]
+ r9diff = [ make_no_diff_deleted_header('A2/B/E/alpha', 8, 9),
+ make_diff_header('A2/B/E/beta', 'revision 8', 'revision 9')
+ + [ "@@ -1 +1,2 @@\n",
+ " This is the file 'beta'.\n",
+ "+9\n",
+ "\ No newline at end of file\n",
+ ]
+ ]
+ r8diff = [ make_diff_header('A2/D/G/rho', 'revision 0', 'revision 8')
+ + [ "@@ -0,0 +1 @@\n",
+ "+88\n",
+ "\ No newline at end of file\n",
+ ]
+ ]
log_chain = parse_log_output(output, with_diffs=True)
if len(log_chain) != 3:
raise SVNLogParseError("%d logs found, 3 expected" % len(log_chain))
- svntest.verify.compare_and_display_lines(None, "diff for r9",
- r9diff, log_chain[1]['diff_lines'])
- svntest.verify.compare_and_display_lines(None, "diff for r8",
- r8diff, log_chain[2]['diff_lines'])
+ compare_diff_output(r9diff, log_chain[1]['diff_lines'])
+ compare_diff_output(r8diff, log_chain[2]['diff_lines'])
@Issue(4153)