Stephen Butler wrote:
> Author: sbutler
> Date: Wed Sep 2 16:35:11 2009
> New Revision: 39093
>
> Log:
> Fix WC-NG handling of "orphaned" items in a replaced dir.
>
> "Orphans" are items deleted by a merge that are within a replaced
> tree, but aren't themselve replaced by the incoming copy operation.
> They should remain deleted, but were being corrupted.
>
> This fix also eliminates the nonsensical "deleted with history" status
> that used to be displayed for orphaned items.
>
> * subversion/libsvn_wc/entries.c
> (write_entry): Fix the logic for translating schedule-delete entries
> to wc_db rows.
>
> * subversion/libsvn_wc/adm_ops.c
> (mark_tree): Don't set the "copied" flag for orphans.
> (process_committed_leaf): Relax an assertion that assumes the copied
> flag is set for orphans.
>
> * subversion/tests/cmdline/copy_tests.py
> (wc_to_wc_copy_deleted):
> * subversion/tests/cmdline/revert_tests.py
> (status_of_missing_dir_after_revert_replaced_with_history_dir):
> Tweak status expectations for orphaned items: show the wc-rev,
> don't show the '+' ("with history").
>
> * subversion/tests/cmdline/merge_tests.py
> (copy_then_replace_via_merge): Tweak status expectations. Add
> update and commit to check for WC corruption.
> (test_list): Remove XFail() from copy_then_replace_via_merge().
Hi Steve,
hm, this test fails on my side!
I did a clean checkout & build and got this:
[[[
$ ./merge_tests.py 134
subversion/svn/commit-cmd.c:142: (apr_err=160020)
subversion/libsvn_client/commit.c:853: (apr_err=160020)
svn: Commit failed (details follow):
subversion/libsvn_client/commit_util.c:1673: (apr_err=160020)
subversion/libsvn_delta/path_driver.c:251: (apr_err=160020)
subversion/libsvn_client/commit_util.c:1469: (apr_err=160020)
subversion/libsvn_repos/commit.c:364: (apr_err=160020)
subversion/libsvn_fs_fs/tree.c:1871: (apr_err=160020)
svn: File already exists: filesystem
'/home/neels/svn/patch/subversion/tests/cmdline/svn-test-work/repositories/merge_tests-134/db',
transaction '6-6', path '/branch/J/M'
Traceback (most recent call last):
File "/home/neels/svn/patch/subversion/tests/cmdline/svntest/main.py",
line 1166, in run
rc = self.pred.run(sandbox)
File "/home/neels/svn/patch/subversion/tests/cmdline/svntest/testcase.py",
line 129, in run
return self.func(sandbox)
File "./merge_tests.py", line 16220, in copy_then_replace_via_merge
None, branch_J)
File "/home/neels/svn/patch/subversion/tests/cmdline/svntest/actions.py",
line 1205, in run_and_verify_commit
*args)
File "/home/neels/svn/patch/subversion/tests/cmdline/svntest/main.py",
line 598, in run_svn
*(_with_auth(_with_config_dir(varargs))))
File "/home/neels/svn/patch/subversion/tests/cmdline/svntest/main.py",
line 366, in run_command
None, *varargs)
File "/home/neels/svn/patch/subversion/tests/cmdline/svntest/main.py",
line 531, in run_command_stdin
raise Failure
Failure
FAIL: merge_tests.py 134: copy then replace via merge
]]]
And I don't know what to make of it, really. Hopefully you know?
~Neels
>
> Modified:
> trunk/subversion/libsvn_wc/adm_ops.c
> trunk/subversion/libsvn_wc/entries.c
> trunk/subversion/tests/cmdline/copy_tests.py
> trunk/subversion/tests/cmdline/merge_tests.py
> trunk/subversion/tests/cmdline/revert_tests.py
>
> Modified: trunk/subversion/libsvn_wc/adm_ops.c
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_wc/adm_ops.c?pathrev=39093&r1=39092&r2=39093
> ==============================================================================
> --- trunk/subversion/libsvn_wc/adm_ops.c Wed Sep 2 16:02:04 2009 (r39092)
> +++ trunk/subversion/libsvn_wc/adm_ops.c Wed Sep 2 16:35:11 2009 (r39093)
> @@ -421,8 +421,7 @@ process_committed_leaf(int log_number,
> /* If we copy a deleted file, then it will become scheduled
> for deletion, but there is no base text for it. So we
> cannot get/compute a checksum for this file. */
> - SVN_ERR_ASSERT(entry->copied
> - && entry->schedule == svn_wc_schedule_delete);
> + SVN_ERR_ASSERT(entry->schedule == svn_wc_schedule_delete);
>
> /* checksum will remain NULL in this one case. */
> }
> @@ -841,7 +840,8 @@ svn_wc_process_committed4(const char *pa
> /* Recursively mark a tree ADM_ACCESS with a SCHEDULE, COPIED and/or KEEP_LOCAL
> flag, depending on the state of MODIFY_FLAGS (which may contain only a
> subset of the possible modification flags, namely, those indicating a change
> - to one of the three flags mentioned above). */
> + to one of the three flags mentioned above). If setting the COPIED
> + flag, skip items scheduled for deletion. */
> static svn_error_t *
> mark_tree(svn_wc_adm_access_t *adm_access,
> apr_uint64_t modify_flags,
> @@ -885,6 +885,10 @@ mark_tree(svn_wc_adm_access_t *adm_acces
> if (! strcmp((const char *)key, SVN_WC_ENTRY_THIS_DIR))
> continue;
>
> + /* If setting the COPIED flag, skip deleted items. */
> + if (copied && entry->schedule == svn_wc_schedule_delete)
> + continue;
> +
> base_name = key;
> fullpath = svn_dirent_join(svn_wc_adm_access_path(adm_access), base_name,
> subpool);
> @@ -941,7 +945,9 @@ mark_tree(svn_wc_adm_access_t *adm_acces
> this_dir_flags |= SVN_WC__ENTRY_MODIFY_SCHEDULE;
> }
>
> - if (modify_flags & SVN_WC__ENTRY_MODIFY_COPIED)
> + /* If setting the COPIED flag, skip deleted items. */
> + if (modify_flags & SVN_WC__ENTRY_MODIFY_COPIED
> + && entry->schedule != svn_wc_schedule_delete)
> {
> tmp_entry.copied = copied;
> this_dir_flags |= SVN_WC__ENTRY_MODIFY_COPIED;
>
> Modified: trunk/subversion/libsvn_wc/entries.c
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_wc/entries.c?pathrev=39093&r1=39092&r2=39093
> ==============================================================================
> --- trunk/subversion/libsvn_wc/entries.c Wed Sep 2 16:02:04 2009 (r39092)
> +++ trunk/subversion/libsvn_wc/entries.c Wed Sep 2 16:35:11 2009 (r39093)
> @@ -1898,10 +1898,12 @@ write_entry(svn_wc__db_t *db,
>
> case svn_wc_schedule_delete:
> working_node = MAYBE_ALLOC(working_node, scratch_pool);
> - if (!this_dir->copied)
> + /* If the entry is part of a REPLACED (not COPIED) subtree,
> + then it needs a BASE node. */
> + if (! (entry->copied
> + || (this_dir->copied
> + && this_dir->schedule == svn_wc_schedule_add)))
> base_node = MAYBE_ALLOC(base_node, scratch_pool);
> - /* ### what about a deleted BASE tree, with a copy over the top,
> - ### followed by a delete? there should be a base node then... */
> break;
>
> case svn_wc_schedule_replace:
> @@ -2195,9 +2197,12 @@ write_entry(svn_wc__db_t *db,
> }
> else
> {
> - /* If we are part of a COPIED subtree, then the deletion is
> - referring to the WORKING tree, not the BASE tree. */
> - if (entry->copied || this_dir->copied)
> + /* If the entry is part of a COPIED (not REPLACED) subtree,
> + then the deletion is referring to the WORKING node, not
> + the BASE node. */
> + if (entry->copied
> + || (this_dir->copied
> + && this_dir->schedule == svn_wc_schedule_add))
> working_node->presence = svn_wc__db_status_not_present;
> else
> working_node->presence = svn_wc__db_status_base_deleted;
>
> Modified: trunk/subversion/tests/cmdline/copy_tests.py
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/tests/cmdline/copy_tests.py?pathrev=39093&r1=39092&r2=39093
> ==============================================================================
> --- trunk/subversion/tests/cmdline/copy_tests.py Wed Sep 2 16:02:04 2009 (r39092)
> +++ trunk/subversion/tests/cmdline/copy_tests.py Wed Sep 2 16:35:11 2009 (r39093)
> @@ -1539,7 +1539,7 @@ def wc_to_wc_copy_deleted(sbox):
> 'A/B2' : Item(status='A ', wc_rev='-', copied='+'),
> 'A/B2/E' : Item(status=' ', wc_rev='-', copied='+'),
> 'A/B2/E/beta' : Item(status=' ', wc_rev='-', copied='+'),
> - 'A/B2/E/alpha' : Item(status='D ', wc_rev='-', copied='+'),
> + 'A/B2/E/alpha' : Item(status='D ', wc_rev=2),
> 'A/B2/lambda' : Item(status='D ', wc_rev='-', copied='+'),
> 'A/B2/F' : Item(status='D ', wc_rev='-', copied='+'),
> })
>
> Modified: trunk/subversion/tests/cmdline/merge_tests.py
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/tests/cmdline/merge_tests.py?pathrev=39093&r1=39092&r2=39093
> ==============================================================================
> --- trunk/subversion/tests/cmdline/merge_tests.py Wed Sep 2 16:02:04 2009 (r39092)
> +++ trunk/subversion/tests/cmdline/merge_tests.py Wed Sep 2 16:35:11 2009 (r39093)
> @@ -16211,14 +16211,14 @@ def copy_then_replace_via_merge(sbox):
> main.run_svn(None, 'merge', url_A, branch)
>
> # Check status:
> - # sigma and K from r4 were deleted
> - # theta and L from r4 were replaced by r6
> - # omega and M were added (from r6)
> + # sigma and K are deleted (not copied!)
> + # theta and L are replaced (deleted then copied-here)
> + # omega and M are copied-here
> expected_status = wc.State(branch_J, {
> '' : Item(status='R ', copied='+', wc_rev='-'),
> - 'sigma' : Item(status='D ', copied='+', wc_rev='-'),
> - 'K' : Item(status='D ', copied='+', wc_rev='-'),
> - 'K/zeta' : Item(status='D ', copied='+', wc_rev='-'),
> + 'sigma' : Item(status='D ', wc_rev=6),
> + 'K' : Item(status='D ', wc_rev=6),
> + 'K/zeta' : Item(status='D ', wc_rev=6),
> 'theta' : Item(status=' ', copied='+', wc_rev='-'),
> 'L' : Item(status=' ', copied='+', wc_rev='-'),
> 'L/zeta' : Item(status=' ', copied='+', wc_rev='-'),
> @@ -16228,6 +16228,25 @@ def copy_then_replace_via_merge(sbox):
> })
> actions.run_and_verify_status(branch_J, expected_status)
>
> + # Update and commit, just to make sure the WC isn't busted.
> + main.run_svn(None, 'up', branch_J)
> + expected_output = wc.State(branch_J, {
> + '' : Item(verb='Replacing'),
> + })
> + expected_status = wc.State(branch_J, {
> + '' : Item(status=' ', wc_rev=7),
> + 'theta' : Item(status=' ', wc_rev=7),
> + 'L' : Item(status=' ', wc_rev=7),
> + 'L/zeta' : Item(status=' ', wc_rev=7),
> + 'omega' : Item(status=' ', wc_rev=7),
> + 'M' : Item(status=' ', wc_rev=7),
> + 'M/zeta' : Item(status=' ', wc_rev=7),
> + })
> + actions.run_and_verify_commit(branch_J,
> + expected_output,
> + expected_status,
> + None, branch_J)
> +
> #----------------------------------------------------------------------
>
> def merge_replace_causes_tree_conflict2(sbox):
> @@ -16880,7 +16899,7 @@ test_list = [ None,
> svntest.main.is_ra_type_dav_serf),
> SkipUnless(handle_gaps_in_implicit_mergeinfo,
> server_has_mergeinfo),
> - XFail(copy_then_replace_via_merge),
> + copy_then_replace_via_merge,
> XFail(merge_replace_causes_tree_conflict2),
> XFail(merge_replace_causes_tree_conflict3),
> ]
>
> Modified: trunk/subversion/tests/cmdline/revert_tests.py
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/tests/cmdline/revert_tests.py?pathrev=39093&r1=39092&r2=39093
> ==============================================================================
> --- trunk/subversion/tests/cmdline/revert_tests.py Wed Sep 2 16:02:04 2009 (r39092)
> +++ trunk/subversion/tests/cmdline/revert_tests.py Wed Sep 2 16:35:11 2009 (r39093)
> @@ -778,8 +778,6 @@ def status_of_missing_dir_after_revert_r
> svntest.main.run_svn(None, 'up', wc_dir)
>
> # now rollback to r1, thereby reinstating the old 'G'
> - ### Eventually, expected output for 'A/D/G' should be 'R '
> - ### (replaced) instead of 'A ' (added). See issue #571 for details.
> expected_output = svntest.wc.State(wc_dir, {
> 'A/D/G': Item(status='R '),
> 'A/D/G/rho': Item(status='A '),
> @@ -796,9 +794,6 @@ def status_of_missing_dir_after_revert_r
> 'A/D/G/alpha' : Item(status='D ', wc_rev='3'),
> 'A/D/G/beta' : Item(status='D ', wc_rev='3'),
> })
> - ### these nodes are incorrectly reported as COPIED in wc-1. we probably
> - ### have to keep the extra COPIED markers in wc-ng.
> - expected_status.tweak('A/D/G/alpha', 'A/D/G/beta', copied='+', wc_rev='-')
>
> expected_skip = wc.State(wc_dir, { })
> expected_disk = svntest.main.greek_state.copy()
> @@ -821,11 +816,10 @@ def status_of_missing_dir_after_revert_r
> svntest.actions.run_and_verify_svn(None, expected_output, [], "revert", "-R",
> G_path)
>
> + ### Is it a bug that we'd need to run revert twice to finish the job?
> expected_output = svntest.verify.UnorderedOutput(
> ["A " + os.path.join(G_path, "pi") + "\n",
> "A " + os.path.join(G_path, "rho") + "\n",
> - "A " + os.path.join(G_path, "alpha") + "\n",
> - "A " + os.path.join(G_path, "beta") + "\n",
> "A " + os.path.join(G_path, "tau") + "\n"])
> svntest.actions.run_and_verify_svn(None, expected_output, [],
> "status", wc_dir)
>
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=495&dsMessageId=2390470
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2390490
Received on 2009-09-03 03:22:15 CEST