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 2012/05/02 18:23:10 UTC
svn commit: r1333097 - in /subversion/trunk/subversion/tests/cmdline:
merge_symmetric_tests.py svntest/sandbox.py
Author: julianfoad
Date: Wed May 2 16:23:10 2012
New Revision: 1333097
URL: http://svn.apache.org/viewvc?rev=1333097&view=rev
Log:
Make the symmetric merge tests verify the expected set of logical changes
that each merge merges.
* subversion/tests/cmdline/merge_symmetric_tests.py
(logical_changes_in_branch): New function.
(modify_branch): Always make a prop-mod that's unique to this change.
(symmetric_merge): Verify the set of logical changes that were merged.
(cherry2_fwd): Mark as XFail, as the symmetric merge doesn't work
properly for this case. (Previously, this test was passing due to
insufficient checking of the result.)
* subversion/tests/cmdline/svntest/sandbox.py
(sbox.simple_propget, sbox.simple_proplist): New methods.
Modified:
subversion/trunk/subversion/tests/cmdline/merge_symmetric_tests.py
subversion/trunk/subversion/tests/cmdline/svntest/sandbox.py
Modified: subversion/trunk/subversion/tests/cmdline/merge_symmetric_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/merge_symmetric_tests.py?rev=1333097&r1=1333096&r2=1333097&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/merge_symmetric_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/merge_symmetric_tests.py Wed May 2 16:23:10 2012
@@ -157,6 +157,19 @@ def assert_equal(a, b):
if a != b:
raise Exception("assert_equal failed: a = (%s), b = (%s)" % (a, b))
+def logical_changes_in_branch(sbox, branch):
+ """Return the set of logical changes that are actually in branch BRANCH
+ (at its current working version), by examining the state of the
+ branch files and directories rather than its mergeinfo.
+
+ Each logical change is described by its branch and revision number
+ as a string such as 'A1'."""
+ changes = set()
+ for propname in sbox.simple_proplist(branch + '/D').keys():
+ if propname.startswith('prop-'):
+ changes.add(propname[5:])
+ return changes
+
def get_mergeinfo_change(sbox, target):
"""Return a list of revision numbers representing the mergeinfo change
on TARGET (working version against base). Non-recursive."""
@@ -209,11 +222,14 @@ def make_branches(sbox):
def modify_branch(sbox, branch, number, conflicting=False):
"""Commit a modification to branch BRANCH. The actual modification depends
on NUMBER. If CONFLICTING=True, the change will be of a kind that
- conflicts with any other change that has CONFLICTING=True."""
+ conflicts with any other change that has CONFLICTING=True. We don't
+ modify (properties on) the branch root node itself, to make it easier
+ for the tests to distinguish mergeinfo changes from these mods."""
uniq = branch + str(number) # something like 'A1' or 'B2'
if conflicting:
sbox.simple_propset('conflict', uniq, branch + '/C')
elif number % 2 == 0:
+ sbox.simple_propset('prop-' + uniq, uniq, branch + '/D')
sbox.simple_copy(branch + '/mu', branch + '/mu-' + uniq)
else: # number % 2 == 1
sbox.simple_propset('prop-' + uniq, uniq, branch + '/D')
@@ -268,6 +284,8 @@ def symmetric_merge(sbox, source, target
# First, update the WC target because mixed-rev is not fully supported.
sbox.simple_update(target)
+ before_changes = logical_changes_in_branch(sbox, target)
+
exp_out = expected_symmetric_merge_output(target, expect_3ways)
exit, out, err = svntest.actions.run_and_verify_svn(None, exp_out, [],
'merge', '--symmetric',
@@ -275,9 +293,11 @@ def symmetric_merge(sbox, source, target
*args)
if expect_changes is not None:
- ### actual_changes = get_changes(sbox, target)
- ### assert_equal(actual_changes, expect_changes)
- pass
+ after_changes = logical_changes_in_branch(sbox, target)
+ merged_changes = after_changes - before_changes
+ assert_equal(merged_changes, set(expect_changes))
+ reversed_changes = before_changes - after_changes
+ assert_equal(reversed_changes, set())
if expect_mi is not None:
actual_mi_change = get_mergeinfo_change(sbox, target)
@@ -647,6 +667,7 @@ def merge_to_and_fro_4_2(sbox):
# Cherry2, fwd
@SkipUnless(server_has_mergeinfo)
+@XFail()
def cherry2_fwd(sbox):
"""cherry2_fwd"""
Modified: subversion/trunk/subversion/tests/cmdline/svntest/sandbox.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/sandbox.py?rev=1333097&r1=1333096&r2=1333097&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/sandbox.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/sandbox.py Wed May 2 16:23:10 2012
@@ -276,6 +276,37 @@ class Sandbox:
targets = self.ospaths(targets)
svntest.main.run_svn(False, 'propdel', name, *targets)
+ def simple_propget(self, name, target):
+ """Return the value of the property NAME on TARGET.
+ TARGET is a relpath relative to the WC."""
+ target = self.ospath(target)
+ exit, out, err = svntest.main.run_svn(False, 'propget',
+ '--strict', name, target)
+ return ''.join(out)
+
+ def simple_proplist(self, target):
+ """Return a dictionary mapping property name to property value, of the
+ properties on TARGET.
+ TARGET is a relpath relative to the WC."""
+ target = self.ospath(target)
+ exit, out, err = svntest.main.run_svn(False, 'proplist',
+ '--verbose', '--quiet', target)
+ props = {}
+ for line in out:
+ line = line.rstrip('\r\n')
+ if line[2] != ' ': # property name
+ name = line[2:]
+ val = None
+ elif line.startswith(' '): # property value
+ if val is None:
+ val = line[4:]
+ else:
+ val += '\n' + line[4:]
+ props[name] = val
+ else:
+ raise Exception("Unexpected line '" + line + "' in proplist output" + str(out))
+ return props
+
def simple_copy(self, source, dest):
"""Copy SOURCE to DEST in the WC.
SOURCE and DEST are relpaths relative to the WC."""