diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-08-05 16:22:51 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-08-05 16:22:51 +0000 |
commit | cf46733632c7279a9fd0fe6ce26f9185a4ae82a9 (patch) | |
tree | da27775a2161723ef342e91af41a8b51fedef405 /subversion/tests/cmdline/resolve_tests.py | |
parent | bb0ef45f7c46b0ae221b26265ef98a768c33f820 (diff) | |
download | subversion-tarball-master.tar.gz |
subversion-1.9.7HEADsubversion-1.9.7master
Diffstat (limited to 'subversion/tests/cmdline/resolve_tests.py')
-rwxr-xr-x | subversion/tests/cmdline/resolve_tests.py | 149 |
1 files changed, 101 insertions, 48 deletions
diff --git a/subversion/tests/cmdline/resolve_tests.py b/subversion/tests/cmdline/resolve_tests.py index c032b06..0d3b28a 100755 --- a/subversion/tests/cmdline/resolve_tests.py +++ b/subversion/tests/cmdline/resolve_tests.py @@ -41,8 +41,8 @@ Issues = svntest.testcase.Issues_deco Issue = svntest.testcase.Issue_deco Wimp = svntest.testcase.Wimp_deco -from merge_tests import set_up_branch -from merge_tests import expected_merge_output +from svntest.mergetrees import set_up_branch +from svntest.mergetrees import expected_merge_output ###################################################################### @@ -70,13 +70,12 @@ def automatic_conflict_resolution(sbox): # Make a change on the A_COPY branch such that a subsequent merge # conflicts. svntest.main.file_write(psi_COPY_path, "Branch content.\n") - svntest.actions.run_and_verify_svn(None, None, [], + svntest.actions.run_and_verify_svn(None, [], 'commit', '-m', 'log msg', wc_dir) def do_text_conflicting_merge(): - svntest.actions.run_and_verify_svn(None, None, [], + svntest.actions.run_and_verify_svn(None, [], 'revert', '--recursive', A_COPY_path) svntest.actions.run_and_verify_svn( - None, expected_merge_output([[3]], [ "C %s\n" % psi_COPY_path, " U %s\n" % A_COPY_path], @@ -126,10 +125,10 @@ def prop_conflict_resolution(sbox): psi_path = os.path.join(wc_dir, "A", "D", "H", "psi") # r2 - Set property 'propname:propval' on iota, A/mu, and A/D/gamma. - svntest.actions.run_and_verify_svn(None, None, [], + svntest.actions.run_and_verify_svn(None, [], 'ps', 'propname', 'propval', iota_path, mu_path, gamma_path) - svntest.actions.run_and_verify_svn(None, None, [], 'commit', + svntest.actions.run_and_verify_svn(None, [], 'commit', '-m', 'create some new properties', wc_dir) @@ -138,15 +137,15 @@ def prop_conflict_resolution(sbox): # iota : Delete property 'propname' # A/mu : Change property 'propname' to 'incoming-conflict' # A/D/gamma : Change property 'propname' to 'incoming-no-conflict' - svntest.actions.run_and_verify_svn(None, None, [], + svntest.actions.run_and_verify_svn(None, [], 'pd', 'propname', iota_path) - svntest.actions.run_and_verify_svn(None, None, [], + svntest.actions.run_and_verify_svn(None, [], 'ps', 'propname', 'incoming-conflict', mu_path) - svntest.actions.run_and_verify_svn(None, None, [], + svntest.actions.run_and_verify_svn(None, [], 'ps', 'propname', 'incoming-no-conflict', gamma_path) - svntest.actions.run_and_verify_svn(None, None, [], + svntest.actions.run_and_verify_svn(None, [], 'commit', '-m', 'delete a property', wc_dir) @@ -156,7 +155,7 @@ def prop_conflict_resolution(sbox): """Revert the WC, update it to r2, and set the following properties: - itoa : 'propname' = 'local_edit' + iota : 'propname' = 'local_edit' 'newprop' = 'new-val-no-incoming' A/mu : 'propname' = 'local_edit' A/D/gamma : 'propname' = 'incoming-no-conflict' @@ -168,9 +167,9 @@ def prop_conflict_resolution(sbox): Using svn propget, check that the resolution results in the following properties: - itoa : 'propname' = RESOLVED_EDITED_PROP_VAL_OUTPUT + iota : 'propname' = RESOLVED_DELETED_PROP_VAL_OUTPUT 'newprop' = 'new-val-no-incoming' - A/mu : 'propname' = RESOLVED_DELETED_PROP_VAL_OUTPUT + A/mu : 'propname' = RESOLVED_EDITED_PROP_VAL_OUTPUT A/D/gamma : 'propname' = 'incoming-no-conflict' A/D/H/psi : 'newprop' = 'new-val-no-incoming' @@ -178,50 +177,46 @@ def prop_conflict_resolution(sbox): both follow the rules for the expected_stdout arg to run_and_verify_svn2()""" - svntest.actions.run_and_verify_svn(None, None, [], + svntest.actions.run_and_verify_svn(None, [], 'revert', '--recursive', wc_dir) - svntest.actions.run_and_verify_svn(None, None, [], 'up', '-r2', wc_dir) + svntest.actions.run_and_verify_svn(None, [], 'up', '-r2', wc_dir) # Set some properties that will conflict when we update. - svntest.actions.run_and_verify_svn(None, None, [], 'ps', + svntest.actions.run_and_verify_svn(None, [], 'ps', 'propname', 'local_edit', iota_path, mu_path) # Set a property that should always merge cleanly with the update. - svntest.actions.run_and_verify_svn(None, None, [], 'ps', + svntest.actions.run_and_verify_svn(None, [], 'ps', 'propname', 'incoming-no-conflict', gamma_path) # Set a property that has no update coming. - svntest.actions.run_and_verify_svn(None, None, [], 'ps', + svntest.actions.run_and_verify_svn(None, [], 'ps', 'newprop', 'new-val-no-incoming', psi_path, iota_path) # Update, postponing all conflict resolution. - svntest.actions.run_and_verify_svn(None, None, [], 'up', + svntest.actions.run_and_verify_svn(None, [], 'up', '--accept=postpone', wc_dir) svntest.actions.run_and_verify_resolve([iota_path, mu_path], '-R', '--accept', resolve_accept, wc_dir) + if resolved_deleted_prop_val_output: + expected_deleted_stderr = [] + else: + expected_deleted_stderr = '.*W200017: Property.*not found' + svntest.actions.run_and_verify_svn( - 'svn revolve -R --accept=' + resolve_accept + ' of prop conflict ' - 'not resolved as expected;', - resolved_deleted_prop_val_output, [], 'pg', 'propname', iota_path) + resolved_deleted_prop_val_output, expected_deleted_stderr, + 'pg', 'propname', iota_path) svntest.actions.run_and_verify_svn( - 'svn revolve -R --accept=' + resolve_accept + ' of prop conflict ' - 'not resolved as expected;', ['new-val-no-incoming\n'], [], 'pg', 'newprop', iota_path) svntest.actions.run_and_verify_svn( - 'svn revolve -R --accept=' + resolve_accept + ' of prop conflict ' - 'not resolved as expected;', resolved_edited_prop_val_output, [], 'pg', 'propname', mu_path) svntest.actions.run_and_verify_svn( - 'svn revolve -R --accept=' + resolve_accept + ' modified a ' - 'non-conflicted property', ['incoming-no-conflict\n'], [], 'pg', 'propname', gamma_path) svntest.actions.run_and_verify_svn( - 'svn revolve -R --accept=' + resolve_accept + ' modified a ' - 'non-conflicted property', ['new-val-no-incoming\n'], [], 'pg', 'newprop', psi_path) # Test how svn resolve deals with prop conflicts and other local @@ -294,7 +289,7 @@ def resolved_on_wc_root(sbox): # Commit mods svntest.main.file_append(i, "changed iota.\n") svntest.main.file_append(g, "changed gamma.\n") - svntest.actions.run_and_verify_svn(None, None, [], + svntest.actions.run_and_verify_svn(None, [], 'propset', 'foo', 'foo-val', B) expected_output = svntest.wc.State(wc, { @@ -308,9 +303,7 @@ def resolved_on_wc_root(sbox): svntest.actions.run_and_verify_commit(wc, expected_output, - expected_status, - None, - wc) + expected_status) # Go back to rev 1 expected_output = svntest.wc.State(wc, { @@ -324,12 +317,12 @@ def resolved_on_wc_root(sbox): expected_output, expected_disk, expected_status, - None, None, None, None, None, False, + [], False, '-r1', wc) # Deletions so that the item becomes unversioned and # will have a tree-conflict upon update. - svntest.actions.run_and_verify_svn(None, None, [], + svntest.actions.run_and_verify_svn(None, [], 'rm', i, B, g) # Update so that conflicts appear @@ -356,7 +349,7 @@ def resolved_on_wc_root(sbox): expected_output, expected_disk, None, - None, None, None, None, None, False, + [], False, wc) svntest.actions.run_and_verify_unquiet_status(wc, expected_status) @@ -367,6 +360,7 @@ def resolved_on_wc_root(sbox): svntest.actions.run_and_verify_unquiet_status(wc, expected_status) #---------------------------------------------------------------------- +@SkipUnless(svntest.main.server_has_mergeinfo) def resolved_on_deleted_item(sbox): "resolved on deleted item" @@ -384,7 +378,7 @@ def resolved_on_deleted_item(sbox): A2_url = sbox.repo_url + '/A2' # make a copy of A - svntest.actions.run_and_verify_svn(None, None, [], + svntest.actions.run_and_verify_svn(None, [], 'cp', A_url, A2_url, '-m', 'm') expected_output = svntest.wc.State(wc, { @@ -454,13 +448,13 @@ def resolved_on_deleted_item(sbox): expected_output, expected_disk, expected_status, - None, None, None, None, None, False, + [], False, wc) # Create some conflicts... # Modify the paths in the one directory. - svntest.actions.run_and_verify_svn(None, None, [], + svntest.actions.run_and_verify_svn(None, [], 'propset', 'foo', 'foo-val', B) svntest.main.file_append(g, "Modified gamma.\n") @@ -473,12 +467,10 @@ def resolved_on_deleted_item(sbox): svntest.actions.run_and_verify_commit(wc, expected_output, - expected_status, - None, - wc) + expected_status) # Delete the paths in the second directory. - svntest.actions.run_and_verify_svn(None, None, [], + svntest.actions.run_and_verify_svn(None, [], 'rm', B2, g2) expected_output = svntest.wc.State(wc, { @@ -494,7 +486,7 @@ def resolved_on_deleted_item(sbox): svntest.actions.run_and_verify_commit(wc, expected_output, expected_status, - None, + [], A2) # Now merge A to A2, creating conflicts... @@ -547,7 +539,7 @@ def resolved_on_deleted_item(sbox): expected_mergeinfo_output, expected_elision_output, expected_disk, None, expected_skip, - None, dry_run = False) + [], dry_run = False) svntest.actions.run_and_verify_unquiet_status(A2, expected_status) # Now resolve by recursing on the working copy root. @@ -570,7 +562,7 @@ def theirs_conflict_in_subdir(sbox): alpha_path2 = os.path.join(wc2, 'A', 'B', 'E', 'alpha') svntest.main.file_append(alpha_path, "Modified alpha.\n") - svntest.main.run_svn(None, 'ci', '-m', 'logmsg', wc) + sbox.simple_commit(message='logmsg') svntest.main.file_append(alpha_path2, "Modified alpha, too.\n") svntest.main.run_svn(None, 'up', wc2) @@ -606,6 +598,66 @@ def multi_range_merge_with_accept(sbox): svntest.main.run_svn(None, 'merge', '-c4,3', '^/iota', 'iota', '--accept=theirs-conflict') +#---------------------------------------------------------------------- + +# Test for issue #4647 'auto resolution mine-full fails on binary file' +@Issue(4647) +def automatic_binary_conflict_resolution(sbox): + "resolve -R --accept [base | mf | tf] binary file" + + sbox.build() + wc_dir = sbox.wc_dir + + # Some paths we'll care about + A_COPY_path = os.path.join(wc_dir, "A_COPY") + + # Add a binary file to the project in revision 2. + theta_contents = open(os.path.join(sys.path[0], "theta.bin"), 'rb').read() + theta_path = sbox.ospath('A/theta') + svntest.main.file_write(theta_path, theta_contents, 'wb') + svntest.main.run_svn(None, 'add', theta_path) + svntest.main.run_svn(None, 'commit', '-m', 'log msg', wc_dir) + + # Branch A to A_COPY in revision 3. + svntest.main.run_svn(None, 'copy', wc_dir + "/A", A_COPY_path) + svntest.main.run_svn(None, 'commit', '-m', 'log msg', wc_dir) + + # Modify the binary file on trunk and in the branch, so that both versions + # differ. + theta_branch_path = sbox.ospath('A_COPY/theta') + svntest.main.file_append_binary(theta_path, theta_contents) + svntest.main.run_svn(None, 'commit', '-m', 'log msg', wc_dir) + svntest.main.file_append_binary(theta_branch_path, theta_contents) + svntest.main.file_append_binary(theta_branch_path, theta_contents) + svntest.main.run_svn(None, 'commit', '-m', 'log msg', wc_dir) + + # Run an svn update now to prevent mixed-revision working copy [1:4] error. + svntest.main.run_svn(None, 'update', wc_dir) + + + def do_binary_conflicting_merge(): + svntest.actions.run_and_verify_svn(None, [], + 'revert', '--recursive', A_COPY_path) + svntest.main.run_svn(None, 'merge', sbox.repo_url + "/A/theta", wc_dir + "/A_COPY/theta") + + # Test 'svn resolve -R --accept base' + do_binary_conflicting_merge() + svntest.actions.run_and_verify_resolve([theta_branch_path], + '-R', '--accept', 'base', + A_COPY_path) + + # Test 'svn resolve -R --accept mine-full' + do_binary_conflicting_merge() + svntest.actions.run_and_verify_resolve([theta_branch_path], + '-R', '--accept', 'mine-full', + A_COPY_path) + + # Test 'svn resolve -R --accept theirs-full' + do_binary_conflicting_merge() + svntest.actions.run_and_verify_resolve([theta_branch_path], + '-R', '--accept', 'tf', + A_COPY_path) + ######################################################################## # Run the tests @@ -619,6 +671,7 @@ test_list = [ None, resolved_on_deleted_item, theirs_conflict_in_subdir, multi_range_merge_with_accept, + automatic_binary_conflict_resolution, ] if __name__ == '__main__': |