You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2013/02/05 20:29:24 UTC
svn commit: r1442705 - in /subversion/trunk/subversion/tests/cmdline:
merge_tests.py svntest/main.py
Author: julianfoad
Date: Tue Feb 5 19:29:24 2013
New Revision: 1442705
URL: http://svn.apache.org/viewvc?rev=1442705&view=rev
Log:
Improve some expected-output code in the test suite.
* subversion/tests/cmdline/merge_tests.py
(expected_merge_output): Simplify. Add a 'skipped_paths' parameter to
complete the set of conflict summary reports that it can handle. Extract
the summary-of-conflicts code as a new function in main.py.
* subversion/tests/cmdline/svntest/main.py
(summary_of_conflicts): New function.
Modified:
subversion/trunk/subversion/tests/cmdline/merge_tests.py
subversion/trunk/subversion/tests/cmdline/svntest/main.py
Modified: subversion/trunk/subversion/tests/cmdline/merge_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/merge_tests.py?rev=1442705&r1=1442704&r2=1442705&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/merge_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/merge_tests.py Tue Feb 5 19:29:24 2013
@@ -50,9 +50,10 @@ from svntest.actions import fill_file_wi
from svntest.actions import make_conflict_marker_text
from svntest.actions import inject_conflict_into_expected_state
-def expected_merge_output(rev_ranges, additional_lines=None, foreign=False,
+def expected_merge_output(rev_ranges, additional_lines=[], foreign=False,
elides=False, two_url=False, target=None,
- text_conflicts=0, prop_conflicts=0, tree_conflicts=0):
+ text_conflicts=0, prop_conflicts=0, tree_conflicts=0,
+ skipped_paths=0):
"""Generate an (inefficient) regex representing the expected merge
output and mergeinfo notifications from REV_RANGES and ADDITIONAL_LINES.
@@ -64,7 +65,8 @@ def expected_merge_output(rev_ranges, ad
ADDITIONAL_LINES is a list of strings to match the other lines of output;
these are basically regular expressions except that backslashes will be
- escaped herein.
+ escaped herein. If ADDITIONAL_LINES is a single string, it is interpreted
+ the same as a list containing that string.
If ELIDES is true, add to the regex an expression representing elision
notification. If TWO_URL is true, tweak the regex to expect the
@@ -73,8 +75,8 @@ def expected_merge_output(rev_ranges, ad
TARGET is the local path to the target, as it should appear in
notifications; if None, it is not checked.
- TEXT_CONFLICTS, PROP_CONFLICTS and TREE_CONFLICTS specify the number of
- each kind of conflict to expect.
+ TEXT_CONFLICTS, PROP_CONFLICTS, TREE_CONFLICTS and SKIPPED_PATHS specify
+ the number of each kind of conflict to expect.
"""
if rev_ranges is None:
@@ -97,31 +99,21 @@ def expected_merge_output(rev_ranges, ad
if (two_url):
lines += ["--- Recording mergeinfo for merge between repository URLs .*\n"]
- if isinstance(additional_lines, list):
- # Address "The Backslash Plague"
- #
- # If ADDITIONAL_LINES are present there are possibly paths in it with
- # multiple components and on Windows these components are separated with
- # '\'. These need to be escaped properly in the regexp for the match to
- # work correctly. See http://aspn.activestate.com/ASPN/docs/ActivePython
- # /2.2/howto/regex/regex.html#SECTION000420000000000000000.
- if sys.platform == 'win32':
- for i in range(0, len(additional_lines)):
- additional_lines[i] = additional_lines[i].replace("\\", "\\\\")
- lines.extend(additional_lines)
- else:
- if sys.platform == 'win32' and additional_lines != None:
- additional_lines = additional_lines.replace("\\", "\\\\")
- lines.append(str(additional_lines))
-
- if text_conflicts or prop_conflicts or tree_conflicts:
- lines.append("Summary of conflicts:\n")
- if text_conflicts:
- lines.append(" Text conflicts: %d\n" % text_conflicts)
- if prop_conflicts:
- lines.append(" Property conflicts: %d\n" % prop_conflicts)
- if tree_conflicts:
- lines.append(" Tree conflicts: %d\n" % tree_conflicts)
+ # Address "The Backslash Plague"
+ #
+ # If ADDITIONAL_LINES are present there are possibly paths in it with
+ # multiple components and on Windows these components are separated with
+ # '\'. These need to be escaped properly in the regexp for the match to
+ # work correctly. See http://aspn.activestate.com/ASPN/docs/ActivePython
+ # /2.2/howto/regex/regex.html#SECTION000420000000000000000.
+ if isinstance(additional_lines, str):
+ additional_lines = [additional_lines]
+ if sys.platform == 'win32':
+ additional_lines = [line.replace("\\", "\\\\") for line in additional_lines]
+ lines += additional_lines
+
+ lines += svntest.main.summary_of_conflicts(text_conflicts, prop_conflicts,
+ tree_conflicts, skipped_paths)
return "|".join(lines)
Modified: subversion/trunk/subversion/tests/cmdline/svntest/main.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/main.py?rev=1442705&r1=1442704&r2=1442705&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/main.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/main.py Tue Feb 5 19:29:24 2013
@@ -1186,6 +1186,26 @@ def merge_notify_line(revstart=None, rev
return "--- Merging %sr%ld through r%ld into '%s':\n" \
% (from_foreign_phrase, revstart, revend, target_re)
+def summary_of_conflicts(text_conflicts=0, prop_conflicts=0,
+ tree_conflicts=0, skipped_paths=0):
+ """Return a list of lines corresponding to the summary of conflicts and
+ skipped paths that is printed by merge and update and switch. If all
+ parameters are zero, return an empty list.
+ """
+ lines = []
+ if text_conflicts or prop_conflicts or tree_conflicts:
+ lines.append("Summary of conflicts:\n")
+ if text_conflicts:
+ lines.append(" Text conflicts: %d\n" % text_conflicts)
+ if prop_conflicts:
+ lines.append(" Property conflicts: %d\n" % prop_conflicts)
+ if tree_conflicts:
+ lines.append(" Tree conflicts: %d\n" % tree_conflicts)
+ if skipped_paths:
+ lines.append(" Skipped paths: %d\n" % skipped_paths)
+
+ return lines
+
def make_log_msg():
"Conjure up a log message based on the calling test."