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 2011/03/14 13:09:54 UTC
svn commit: r1081344 - in /subversion/trunk/subversion:
libsvn_client/commit_util.c tests/cmdline/schedule_tests.py
Author: julianfoad
Date: Mon Mar 14 12:09:54 2011
New Revision: 1081344
URL: http://svn.apache.org/viewvc?rev=1081344&view=rev
Log:
Fix issue #3468 "children of replaced directories cannot be deleted
post-replace", making use of the new functions added in r1081342.
* subversion/libsvn_client/commit_util.c
(harvest_committables): Eliminate the hack that skipped deletions inside a
replaced directory. By using svn_wc__node_get_children2(), process the
correct set of children and so handle such deletions properly.
* subversion/tests/cmdline/schedule_tests.py
(replace_dir_delete_child): New test.
(test_list): Run it.
Modified:
subversion/trunk/subversion/libsvn_client/commit_util.c
subversion/trunk/subversion/tests/cmdline/schedule_tests.py
Modified: subversion/trunk/subversion/libsvn_client/commit_util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/commit_util.c?rev=1081344&r1=1081343&r2=1081344&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/commit_util.c (original)
+++ subversion/trunk/subversion/libsvn_client/commit_util.c Mon Mar 14 12:09:54 2011
@@ -762,15 +762,14 @@ harvest_committables(apr_hash_t *committ
apr_pool_t *iterpool = svn_pool_create(scratch_pool);
int i;
- SVN_ERR(svn_wc__node_get_children(&children, ctx->wc_ctx, local_abspath,
- copy_mode, scratch_pool, iterpool));
+ SVN_ERR(svn_wc__node_get_children2(&children, ctx->wc_ctx, local_abspath,
+ copy_mode, scratch_pool, iterpool));
for (i = 0; i < children->nelts; i++)
{
const char *this_abspath = APR_ARRAY_IDX(children, i, const char *);
const char *name = svn_dirent_basename(this_abspath, NULL);
const char *this_repos_relpath;
svn_depth_t this_depth;
- svn_boolean_t is_replaced, this_is_deleted;
svn_node_kind_t this_kind;
svn_pool_clear(iterpool);
@@ -781,67 +780,6 @@ harvest_committables(apr_hash_t *committ
if (this_depth == svn_depth_exclude)
continue;
- /* Issue #3281.
- *
- * Skip schedule-delete children inside of schedule-replace
- * directories. They cause an out-of-date error upon commit,
- * and prevent replaced directories from being committed.
- *
- * The out-of-date error happens because we recursively delete the
- * replaced directory in the transaction, then copy the replacing
- * directory in its place, and then try to delete nodes inside
- * the directory which existed only in its pre-replaced state.
- * The attempt to delete non-existent nodes from the transaction
- * (with node kind "none") is prevented by libsvn_repos/commit.c:
- * delete_entry() which sends the out-of-date error.
- *
- * ### We should not skip deletions which happened post-replace.
- * ###
- * ### This is not possible in wc-1 right now, because post-replace
- * ### deletions are not represented in working copy meta data.
- * ### Such nodes simply have NO entry at all in wc-1. The entry
- * ### gets blown away as part of deleting the apparently "locally
- * ### added" node, instead of changing the entry's schedule to
- * ### "delete". Note that replaced directories can only happen as
- * ### part of a set of local changes, either made manually or by a
- * ### merge. That's why nodes inside of replaced dirs are always
- * ### considered "locally added". The subtleties of the
- * ### locally-added-inside-of-a-replaced-parent-directory case are
- * ### wrongfully ignored during entry deletion.
- * ###
- * ### On top of that, libsvn_repos/commit.c:add_directory() will
- * ### always do server-side copies for directories added with
- * ### history, instead of copying the directory state verbatim
- * ### from the WC. This causes nodes which the user meant to delete
- * ### post-replace to show up in the commit transaction regardless.
- * ### This is not a problem in itself, but because there is no
- * ### entry for a post-replace deleted node, we cannot send a
- * ### separate deletion to remove the post-replace deleted node
- * ### from the transaction after the directory was copied on the
- * ### server.
- * ### Worse, the entry comes back only after an update which
- * ### explicitly targets the node which is now locally missing
- * ### but present on the server, in a revision the WC thinks it
- * ### has the entire state of! By not handling the
- * ### locally-added-inside-of-a-replaced-parent-directory entry
- * ### removal case properly, the client corrupts the WC meta data
- * ### without realising the mess it just made.
- * ###
- * ### So our ignorance about post-replace deleted nodes here is
- * ### just a side-effect of a much bigger problem, which has existed
- * ### for some time (at least since 1.5.x, probably much longer).
- * ###
- * ### WC-NG should fix all of this before 1.7 release.
- * ### Note that, in trunk, the entry of post-replace deleted nodes
- * ### does not get blown away, so trunk is one step ahead of 1.6.x
- * ### already. */
- SVN_ERR(svn_wc__node_is_status_deleted(&this_is_deleted, ctx->wc_ctx,
- this_abspath, iterpool));
- SVN_ERR(svn_wc__node_is_replaced(&is_replaced, ctx->wc_ctx,
- local_abspath, iterpool));
- if (is_replaced && this_is_deleted)
- continue;
-
this_repos_relpath = svn_relpath_join(repos_relpath, name,
iterpool);
Modified: subversion/trunk/subversion/tests/cmdline/schedule_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/schedule_tests.py?rev=1081344&r1=1081343&r2=1081344&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/schedule_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/schedule_tests.py Mon Mar 14 12:09:54 2011
@@ -677,6 +677,44 @@ def propset_on_deleted_should_fail(sbox)
svntest.actions.run_and_verify_svn(None, None, "svn: E155023: Can't set propert.*",
'ps', 'prop', 'val', iota)
+@Issue(3468)
+def replace_dir_delete_child(sbox):
+ "replace a dir, then delete a child"
+ # The purpose of this test is to make sure that when a child of a
+ # replaced directory is deleted, the result can be committed.
+
+ sbox.build()
+
+ # Replace A/D/H with a copy of A/B
+ sbox.simple_rm('A/D/H')
+ sbox.simple_copy('A/B', 'A/D/H')
+
+ # Remove two children
+ sbox.simple_rm('A/D/H/lambda')
+ sbox.simple_rm('A/D/H/E')
+
+ # Don't look at what "svn status" says before commit. It's not clear
+ # what it should be and that's not the point of this test.
+
+ # Commit.
+ expected_output = svntest.wc.State(sbox.wc_dir, {
+ 'A/D/H' : Item(verb='Replacing'),
+ 'A/D/H/lambda' : Item(verb='Deleting'),
+ 'A/D/H/E' : Item(verb='Deleting'),
+ })
+
+ expected_status = svntest.actions.get_virginal_state(sbox.wc_dir, 1)
+ expected_status.add({
+ 'A/D/H/F' : Item(status=' ', wc_rev=0),
+ })
+ expected_status.tweak('A/D/H', 'A/D/H/F', wc_rev=2)
+ expected_status.remove('A/D/H/psi', 'A/D/H/omega', 'A/D/H/chi')
+
+ svntest.actions.run_and_verify_commit(sbox.wc_dir,
+ expected_output,
+ expected_status,
+ None, sbox.wc_dir)
+
########################################################################
# Run the tests
@@ -699,6 +737,7 @@ test_list = [ None,
delete_non_existent,
delete_redelete_fudgery,
propset_on_deleted_should_fail,
+ replace_dir_delete_child,
]
if __name__ == '__main__':