Author: jcorvel Date: Mon May 22 21:37:20 2017 New Revision: 1795861 URL: http://svn.apache.org/viewvc?rev=1795861&view=rev Log: Revert r1731699, to avoid raising unnecessary text conflicts.
This was discussed and agreed upon in this thread: https://mail-archives.apache.org/mod_mbox/subversion-dev/201705.mbox/%[email protected]%3E Date: Tue, 9 May 2017 12:14:20 +0200 From: Stefan Sperling To: Subversion development list Subject: stricter text conflicts in 1.10 Message ID: <[email protected]> Modified: subversion/trunk/subversion/libsvn_diff/diff3.c subversion/trunk/subversion/tests/cmdline/patch_tests.py subversion/trunk/subversion/tests/libsvn_diff/diff-diff3-test.c Modified: subversion/trunk/subversion/libsvn_diff/diff3.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_diff/diff3.c?rev=1795861&r1=1795860&r2=1795861&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_diff/diff3.c (original) +++ subversion/trunk/subversion/libsvn_diff/diff3.c Mon May 22 21:37:20 2017 @@ -325,7 +325,6 @@ svn_diff_diff3_2(svn_diff_t **diff, /* Produce a merged diff */ { svn_diff_t **diff_ref = diff; - svn_diff_t *diff_last = NULL; apr_off_t original_start = 1; apr_off_t modified_start = 1; @@ -435,7 +434,6 @@ svn_diff_diff3_2(svn_diff_t **diff, if (is_modified || is_latest) { - svn_boolean_t add_diff = TRUE; modified_length = modified_sync - modified_start; latest_length = latest_sync - latest_start; @@ -456,41 +454,17 @@ svn_diff_diff3_2(svn_diff_t **diff, &position_list[2], num_tokens, pool); - /* add_diff = TRUE */ } - else if (is_modified - && (!diff_last - || diff_last->type != svn_diff__type_diff_latest)) + else if (is_modified) { (*diff_ref)->type = svn_diff__type_diff_modified; - /* add_diff = TRUE */ - } - else if (is_latest - && (!diff_last - || diff_last->type != svn_diff__type_diff_modified)) - { - (*diff_ref)->type = svn_diff__type_diff_latest; - /* add_diff = TRUE */ } else { - /* We have a latest and a modified region that touch each other, - but not directly change the same location. Create a single - conflict region to properly mark a conflict, and to ease - resolving. */ - diff_last->type = svn_diff__type_conflict; - diff_last->original_length += (*diff_ref)->original_length; - diff_last->modified_length += (*diff_ref)->modified_length; - diff_last->latest_length += (*diff_ref)->latest_length; - - add_diff = FALSE; + (*diff_ref)->type = svn_diff__type_diff_latest; } - if (add_diff) - { - diff_last = *diff_ref; - diff_ref = &(*diff_ref)->next; - } + diff_ref = &(*diff_ref)->next; } /* Detect EOF */ @@ -516,7 +490,6 @@ svn_diff_diff3_2(svn_diff_t **diff, (*diff_ref)->latest_length = common_length; (*diff_ref)->resolved_diff = NULL; - diff_last = *diff_ref; diff_ref = &(*diff_ref)->next; } Modified: subversion/trunk/subversion/tests/cmdline/patch_tests.py URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/patch_tests.py?rev=1795861&r1=1795860&r2=1795861&view=diff ============================================================================== --- subversion/trunk/subversion/tests/cmdline/patch_tests.py (original) +++ subversion/trunk/subversion/tests/cmdline/patch_tests.py Mon May 22 21:37:20 2017 @@ -7690,6 +7690,7 @@ def patch_missed_trail(sbox): expected_output, expected_disk, expected_status, expected_skip) +@XFail() def patch_merge(sbox): "patching a specific merge" @@ -7752,31 +7753,24 @@ def patch_merge(sbox): expected_output, None, None, expected_skip) + # Currently we see D E F doubled, that is certainly bad behavior. + # I could imaging that just applying the 'C' line change would be ok, + # but most likely a text conflict is the proper thing to do here. expected_disk = svntest.main.greek_state.copy() expected_disk.add({ 'new.txt' : Item(contents='A\n' 'B\n' - '<<<<<<< .mine\n' - 'C\n' + ' C\n' 'D\n' 'E\n' 'F\n' - '||||||| .r2\n' - 'C\n' - '=======\n' - ' C\n' - 'D\n' - 'E\n' - 'F\n' - '>>>>>>> .r3\n' - 'J\n' - 'K\n' - 'L'), - 'new.txt.mine' : Item(contents="A\nB\nC\nD\nE\nF\nJ\nK\nL"), - 'new.txt.r2' : Item(contents="A\nB\nC\nJ\nK\nL"), - 'new.txt.r3' : Item(contents="A\nB\n C\nD\nE\nF\nJ\nK\nL"), - }) - expected_output.tweak('new.txt', status='C ') + #'D\n' # Doubled??? + #'E\n' # Doubled??? + #'F\n' # Doubled??? + 'J\n' + 'K\n' + 'L')}) + expected_output.tweak('new.txt', status='G ') svntest.actions.run_and_verify_update(wc_dir, expected_output, expected_disk, None, []) @@ -7790,32 +7784,7 @@ def patch_merge(sbox): expected_output, None, None, expected_skip) - expected_output.tweak('new.txt', status='C ') - expected_disk = svntest.main.greek_state.copy() - expected_disk.add({ - 'new.txt' : Item(contents='A\n' - 'B\n' - '<<<<<<< .working\n' - 'C\n' - 'D\n' - 'E\n' - 'F\n' - '||||||| .merge-left.r2\n' - 'C\n' - '=======\n' - ' C\n' - 'D\n' - 'E\n' - 'F\n' - '>>>>>>> .merge-right.r3\n' - 'J\n' - 'K\n' - 'L'), - 'new.txt.working' : Item(contents="A\nB\nC\nD\nE\nF\nJ\nK\nL"), - 'new.txt.merge-left.r2' : Item(contents="A\nB\nC\nJ\nK\nL"), - 'new.txt.merge-right.r3' : Item(contents="A\nB\n C\nD\nE\nF\nJ\nK\nL"), - }) - + expected_output.tweak('new.txt', status='G ') svntest.actions.run_and_verify_merge(wc_dir, 2, 3, repo_url, repo_url, expected_output, None, None, expected_disk, None, Modified: subversion/trunk/subversion/tests/libsvn_diff/diff-diff3-test.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_diff/diff-diff3-test.c?rev=1795861&r1=1795860&r2=1795861&view=diff ============================================================================== --- subversion/trunk/subversion/tests/libsvn_diff/diff-diff3-test.c (original) +++ subversion/trunk/subversion/tests/libsvn_diff/diff-diff3-test.c Mon May 22 21:37:20 2017 @@ -2407,8 +2407,6 @@ merge_with_part_already_present(apr_pool /* Merge is more "aggressive" about resolving conflicts than traditional * patch or diff3. Some people consider this behaviour to be a bug, see * http://subversion.tigris.org/servlets/ReadMsg?list=dev&msgNo=35014 - * - * The original behavior of this test (added in 2003) was tweaked in 2016. */ static svn_error_t * merge_adjacent_changes(apr_pool_t *pool) @@ -2430,13 +2428,8 @@ merge_adjacent_changes(apr_pool_t *pool) "zig\n" "foo\n" - "<<<<<<< adj2\n" "new_bar\n" - "baz\n" - "=======\n" - "bar\n" - "new_baz\n" - ">>>>>>> adj3\n", + "new_baz\n", NULL, svn_diff_conflict_display_modified_latest, @@ -3003,8 +2996,6 @@ three_way_double_add(apr_pool_t *pool) "D\n" /* New line 1a */ "E\n" /* New line 2a */ "F\n" /* New line 3a*/ - "||||||| doubleadd1\n" - "C\n" "=======\n" "O\n" "P\n" /* New line 1b */ @@ -3018,7 +3009,7 @@ three_way_double_add(apr_pool_t *pool) svn_diff_conflict_display_modified_original_latest, pool)); - SVN_ERR(three_way_merge("doubleadd4", "doubleadd5", "doubleadd6", + SVN_ERR(three_way_merge("doubleadd1", "doubleadd2", "doubleadd3", "A\n" "B\n" "C\n" @@ -3053,21 +3044,18 @@ three_way_double_add(apr_pool_t *pool) will be a PASS. */ "A\n" "B\n" - "<<<<<<< doubleadd5\n" + "<<<<<<< doubleadd2\n" "C\n" "D\n" /* New line 1a */ "E\n" /* New line 2a */ "F\n" /* New line 3a*/ - "||||||| doubleadd4\n" - "C\n" - "J\n" "=======\n" "O\n" "P\n" /* New line 1b */ "Q\n" /* New line 2b */ "R\n" /* New line 3b */ "J\n" - ">>>>>>> doubleadd6\n" + ">>>>>>> doubleadd3\n" "K\n" "L", NULL, @@ -3119,7 +3107,7 @@ static struct svn_test_descriptor_t test "2-way issue #3362 test v1"), SVN_TEST_PASS2(two_way_issue_3362_v2, "2-way issue #3362 test v2"), - SVN_TEST_PASS2(three_way_double_add, + SVN_TEST_XFAIL2(three_way_double_add, "3-way merge, double add"), SVN_TEST_NULL };
