Author: hwright Date: Mon Aug 8 13:43:49 2011 New Revision: 1154963 URL: http://svn.apache.org/viewvc?rev=1154963&view=rev Log: Merge r1154009, r1154273 from trunk:
* r1154009, r1154273 Fix issue #3978 'Reverse merge which adds subtree fails' Justification: Prevents an assertion during a legitimate merge. Notes: r1154009 is the fix, r1154273 is a test. Votes: +1: pburba, arfrever, philip Modified: subversion/branches/1.7.x/ (props changed) subversion/branches/1.7.x/STATUS subversion/branches/1.7.x/subversion/libsvn_client/merge.c subversion/branches/1.7.x/subversion/tests/cmdline/merge_tests.py Propchange: subversion/branches/1.7.x/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Mon Aug 8 13:43:49 2011 @@ -55,4 +55,4 @@ /subversion/branches/tree-conflicts:868291-873154 /subversion/branches/tree-conflicts-notify:873926-874008 /subversion/branches/uris-as-urls:1060426-1064427 -/subversion/trunk:1146013,1146121,1146219,1146222,1146274,1146492,1146555,1146606,1146620,1146684,1146781,1146832,1146834,1146870,1146899,1146904,1147293,1147309,1147882,1148071,1148131,1148374,1148424,1148566,1148588,1148853,1148877,1148882,1148936,1149105,1149141,1149160,1149228,1149240,1149343,1149371-1149372,1149377,1149398,1149401,1149539,1149572,1149627,1149675,1149701,1149713,1150242,1150254,1150260-1150261,1150266,1150302,1150327,1150368,1150372,1150441,1150506,1150812,1150853,1151036,1151177,1151610,1151906,1151911,1152129,1152140,1152189-1152190,1152282,1152726,1153138,1153141,1153416,1153799,1153807,1153968,1154023,1154121,1154461 +/subversion/trunk:1146013,1146121,1146219,1146222,1146274,1146492,1146555,1146606,1146620,1146684,1146781,1146832,1146834,1146870,1146899,1146904,1147293,1147309,1147882,1148071,1148131,1148374,1148424,1148566,1148588,1148853,1148877,1148882,1148936,1149105,1149141,1149160,1149228,1149240,1149343,1149371-1149372,1149377,1149398,1149401,1149539,1149572,1149627,1149675,1149701,1149713,1150242,1150254,1150260-1150261,1150266,1150302,1150327,1150368,1150372,1150441,1150506,1150812,1150853,1151036,1151177,1151610,1151906,1151911,1152129,1152140,1152189-1152190,1152282,1152726,1153138,1153141,1153416,1153799,1153807,1153968,1154009,1154023,1154121,1154273,1154461 Modified: subversion/branches/1.7.x/STATUS URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x/STATUS?rev=1154963&r1=1154962&r2=1154963&view=diff ============================================================================== --- subversion/branches/1.7.x/STATUS (original) +++ subversion/branches/1.7.x/STATUS Mon Aug 8 13:43:49 2011 @@ -186,11 +186,3 @@ Veto-blocked changes: Approved changes: ================= - - * r1154009, r1154273 - Fix issue #3978 'Reverse merge which adds subtree fails' - Justification: - Prevents an assertion during a legitimate merge. - Notes: r1154009 is the fix, r1154273 is a test. - Votes: - +1: pburba, arfrever, philip Modified: subversion/branches/1.7.x/subversion/libsvn_client/merge.c URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x/subversion/libsvn_client/merge.c?rev=1154963&r1=1154962&r2=1154963&view=diff ============================================================================== --- subversion/branches/1.7.x/subversion/libsvn_client/merge.c (original) +++ subversion/branches/1.7.x/subversion/libsvn_client/merge.c Mon Aug 8 13:43:49 2011 @@ -7728,6 +7728,9 @@ record_mergeinfo_for_dir_merge(svn_merge DEPTH, NOTIFY_B, MERGE_B, and SQUELCH_MERGEINFO_NOTIFICATIONS, are cascaded from do_directory_merge's arguments of the same names. + + Note: This is intended to support forward merges only, i.e. + MERGED_RANGE->START must be older than MERGED_RANGE->END. */ static svn_error_t * record_mergeinfo_for_added_subtrees( @@ -7746,6 +7749,8 @@ record_mergeinfo_for_added_subtrees( if (!notify_b->added_abspaths) return SVN_NO_ERROR; + SVN_ERR_ASSERT(merged_range->start < merged_range->end); + iterpool = svn_pool_create(pool); for (hi = apr_hash_first(pool, notify_b->added_abspaths); hi; hi = apr_hash_next(hi)) @@ -8566,7 +8571,9 @@ do_directory_merge(svn_mergeinfo_catalog So here we look at the root path of each subtree added during the merge and set explicit mergeinfo on it if it meets the aforementioned conditions. */ - if (err == SVN_NO_ERROR) + if (err == SVN_NO_ERROR + && (range.start < range.end)) /* Nothing to record on added subtrees + resulting from reverse merges. */ { err = record_mergeinfo_for_added_subtrees( &range, mergeinfo_path, depth, Modified: subversion/branches/1.7.x/subversion/tests/cmdline/merge_tests.py URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x/subversion/tests/cmdline/merge_tests.py?rev=1154963&r1=1154962&r2=1154963&view=diff ============================================================================== --- subversion/branches/1.7.x/subversion/tests/cmdline/merge_tests.py (original) +++ subversion/branches/1.7.x/subversion/tests/cmdline/merge_tests.py Mon Aug 8 13:43:49 2011 @@ -16727,6 +16727,140 @@ def foreign_repos_prop_conflict(sbox): sbox.repo_url, other_wc_dir) +#---------------------------------------------------------------------- +# A test for issue #3978 'reverse merge which adds subtree fails'. +@Issue(3978) +@SkipUnless(server_has_mergeinfo) +def reverse_merge_adds_subtree(sbox): + "reverse merge adds subtree" + + sbox.build() + wc_dir = sbox.wc_dir + wc_disk, wc_status = set_up_branch(sbox) + + A_path = os.path.join(wc_dir, 'A') + chi_path = os.path.join(wc_dir, 'A', 'D', 'H', 'chi') + A_COPY_path = os.path.join(wc_dir, 'A_COPY') + H_COPY_path = os.path.join(wc_dir, 'A_COPY', 'D', 'H') + + # r7 - Delete A\D\H\chi + svntest.actions.run_and_verify_svn(None, None, [], 'delete', chi_path) + svntest.actions.run_and_verify_svn(None, None, [], 'ci', '-m', + 'Delete a file', wc_dir) + + # r8 - Merge r7 from A to A_COPY + svntest.actions.run_and_verify_svn(None, None, [], 'merge', + sbox.repo_url + '/A', + A_COPY_path, '-c7') + svntest.actions.run_and_verify_svn(None, None, [], 'ci', '-m', + 'Cherry-pick r7 from A to A_COPY', wc_dir) + + # r9 - File depth sync merge from A/D/H to A_COPY/D/H/ + svntest.actions.run_and_verify_svn(None, None, [], 'up', wc_dir) + svntest.actions.run_and_verify_svn(None, None, [], 'merge', + sbox.repo_url + '/A/D/H', + H_COPY_path, '--depth', 'files') + svntest.actions.run_and_verify_svn(None, None, [], 'ci', '-m', + 'Cherry-pick r7 from A to A_COPY', wc_dir) + + # Reverse merge r7 from A to A_COPY + # + # Prior to the issue #3978 fix this merge failed with an assertion: + # + # >svn merge ^/A A_COPY -c-7 + # --- Reverse-merging r7 into 'A_COPY\D\H': + # A A_COPY\D\H\chi + # --- Recording mergeinfo for reverse merge of r7 into 'A_COPY': + # U A_COPY + # --- Recording mergeinfo for reverse merge of r7 into 'A_COPY\D\H': + # U A_COPY\D\H + # ..\..\..\subversion\svn\util.c:913: (apr_err=200020) + # ..\..\..\subversion\libsvn_client\merge.c:10990: (apr_err=200020) + # ..\..\..\subversion\libsvn_client\merge.c:10944: (apr_err=200020) + # ..\..\..\subversion\libsvn_client\merge.c:10944: (apr_err=200020) + # ..\..\..\subversion\libsvn_client\merge.c:10914: (apr_err=200020) + # ..\..\..\subversion\libsvn_client\merge.c:8928: (apr_err=200020) + # ..\..\..\subversion\libsvn_client\merge.c:7850: (apr_err=200020) + # ..\..\..\subversion\libsvn_client\mergeinfo.c:120: (apr_err=200020) + # ..\..\..\subversion\libsvn_wc\props.c:2472: (apr_err=200020) + # ..\..\..\subversion\libsvn_wc\props.c:2247: (apr_err=200020) + # ..\..\..\subversion\libsvn_wc\props.c:2576: (apr_err=200020) + # ..\..\..\subversion\libsvn_subr\mergeinfo.c:705: (apr_err=200020) + # svn: E200020: Could not parse mergeinfo string '-7' + # ..\..\..\subversion\libsvn_subr\mergeinfo.c:688: (apr_err=200022) + # ..\..\..\subversion\libsvn_subr\mergeinfo.c:607: (apr_err=200022) + # ..\..\..\subversion\libsvn_subr\mergeinfo.c:504: (apr_err=200022) + # ..\..\..\subversion\libsvn_subr\kitchensink.c:57: (apr_err=200022) + # svn: E200022: Negative revision number found parsing '-7' + svntest.actions.run_and_verify_svn(None, None, [], 'up', wc_dir) + svntest.actions.run_and_verify_svn(None, None, [], 'up', wc_dir) + expected_output = wc.State(A_COPY_path, { + 'D/H/chi' : Item(status='A '), + }) + expected_mergeinfo_output = wc.State(A_COPY_path, { + '' : Item(status=' U'), + 'D/H' : Item(status=' U'), + }) + expected_elision_output = wc.State(A_COPY_path, { + '' : Item(status=' U'), + }) + expected_status = wc.State(A_COPY_path, { + '' : Item(status=' M'), + 'B' : Item(status=' '), + 'mu' : Item(status=' '), + 'B/E' : Item(status=' '), + 'B/E/alpha' : Item(status=' '), + 'B/E/beta' : Item(status=' '), + 'B/lambda' : Item(status=' '), + 'B/F' : Item(status=' '), + 'C' : Item(status=' '), + 'D' : Item(status=' '), + 'D/G' : Item(status=' '), + 'D/G/pi' : Item(status=' '), + 'D/G/rho' : Item(status=' '), + 'D/G/tau' : Item(status=' '), + 'D/gamma' : Item(status=' '), + 'D/H' : Item(status=' M'), + 'D/H/chi' : Item(status='A ', copied='+'), + 'D/H/psi' : Item(status=' '), + 'D/H/omega' : Item(status=' '), + }) + expected_status.tweak(wc_rev=9) + expected_status.tweak('D/H/chi', wc_rev='-') + expected_disk = wc.State('', { + 'B' : Item(), + 'mu' : Item("This is the file 'mu'.\n"), + 'B/E' : Item(), + 'B/E/alpha' : Item("This is the file 'alpha'.\n"), + 'B/E/beta' : Item("This is the file 'beta'.\n"), + 'B/lambda' : Item("This is the file 'lambda'.\n"), + 'B/F' : Item(), + 'C' : Item(), + 'D' : Item(), + 'D/G' : Item(), + 'D/G/pi' : Item("This is the file 'pi'.\n"), + 'D/G/rho' : Item("This is the file 'rho'.\n"), + 'D/G/tau' : Item("This is the file 'tau'.\n"), + 'D/gamma' : Item("This is the file 'gamma'.\n"), + 'D/H' : Item(props={SVN_PROP_MERGEINFO : '/A/D/H:2-6*,8*'}), + 'D/H/chi' : Item("This is the file 'chi'.\n"), + 'D/H/psi' : Item("New content", + props={SVN_PROP_MERGEINFO : '/A/D/H/psi:2-8'}), + 'D/H/omega' : Item("New content", + props={SVN_PROP_MERGEINFO : '/A/D/H/omega:2-8'}), + }) + expected_skip = wc.State('.', { }) + svntest.actions.run_and_verify_merge(A_COPY_path, 7, 6, + sbox.repo_url + '/A', None, + expected_output, + expected_mergeinfo_output, + expected_elision_output, + expected_disk, + expected_status, + expected_skip, + None, None, None, None, + None, 1, False) + ######################################################################## # Run the tests @@ -16851,6 +16985,7 @@ test_list = [ None, merge_change_to_file_with_executable, dry_run_merge_conflicting_binary, foreign_repos_prop_conflict, + reverse_merge_adds_subtree, ] if __name__ == '__main__':