Author: stsp Date: Fri Jul 29 17:46:16 2011 New Revision: 1152324 URL: http://svn.apache.org/viewvc?rev=1152324&view=rev Log: Restore the changes from r1152293 (which see for log full message), including the following fix:
* subversion/libsvn_wc/wc-queries.sql (STMT_SELECT_MOVED_HERE_CHILDREN): Do not select nodes with moved_to relpaths that are not children of the ?2 parameter. Fixed by changing the condition (moved_to > ?2 || '/') into this: (moved_to > ?2 || '/' AND moved_to < ?2 || '0') Modified: subversion/trunk/subversion/libsvn_wc/wc-queries.sql subversion/trunk/subversion/libsvn_wc/wc_db.c subversion/trunk/subversion/tests/cmdline/copy_tests.py Modified: subversion/trunk/subversion/libsvn_wc/wc-queries.sql URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc-queries.sql?rev=1152324&r1=1152323&r2=1152324&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original) +++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Fri Jul 29 17:46:16 2011 @@ -1342,6 +1342,10 @@ WHERE wc_id = ?1 AND local_relpath = ?2 (SELECT MAX(op_depth) FROM nodes WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth > 0) +-- STMT_SELECT_MOVED_HERE_CHILDREN +SELECT moved_to, local_relpath FROM nodes_current +WHERE wc_id = ?1 AND (moved_to > ?2 || '/' AND moved_to < ?2 || '0') + /* ------------------------------------------------------------------------- */ /* Queries for verification. */ Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1152324&r1=1152323&r2=1152324&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_wc/wc_db.c (original) +++ subversion/trunk/subversion/libsvn_wc/wc_db.c Fri Jul 29 17:46:16 2011 @@ -6033,11 +6033,12 @@ op_delete_txn(void *baton, svn_sqlite__stmt_t *stmt; apr_int64_t select_depth; /* Depth of what is to be deleted */ svn_boolean_t refetch_depth = FALSE; + svn_wc__db_kind_t kind; SVN_ERR(svn_sqlite__exec_statements(wcroot->sdb, STMT_CREATE_DELETE_LIST)); SVN_ERR(read_info(&status, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + &kind, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &op_root, NULL, NULL, NULL, NULL, NULL, @@ -6094,6 +6095,80 @@ op_delete_txn(void *baton, SVN_ERR(svn_sqlite__step_done(stmt)); SVN_ERR(svn_sqlite__reset(stmt)); } + + /* If a subtree is being moved-away, we need to update moved-to + * information in BASE for all children that were moved into this + * subtree. */ + if (kind == svn_wc__db_kind_dir) + { + apr_pool_t *iterpool; + + SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb, + STMT_SELECT_MOVED_HERE_CHILDREN)); + SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath)); + + SVN_ERR(svn_sqlite__step(&have_row, stmt)); + + iterpool = svn_pool_create(scratch_pool); + while (have_row) + { + svn_wc__db_status_t child_status; + const char *child_moved_from_relpath; + const char *child_delete_op_root_relpath; + const char *moved_here_child_relpath = + svn_sqlite__column_text(stmt, 0, scratch_pool); + + svn_pool_clear(iterpool); + + /* The moved-here-children query returns info based on the + * delete-half of the move. Check if that the copied-half of + * the move matches this information. */ + SVN_ERR(read_info(&child_status, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, + wcroot, moved_here_child_relpath, + iterpool, iterpool)); + if (child_status == svn_wc__db_status_added) + SVN_ERR(scan_addition(&child_status, NULL, NULL, NULL, + NULL, NULL, NULL, + &child_moved_from_relpath, + &child_delete_op_root_relpath, + wcroot, moved_here_child_relpath, + iterpool, iterpool)); + if (child_status == svn_wc__db_status_moved_here) + { + const char *child_subtree_relpath; + const char *new_moved_to_relpath; + svn_sqlite__stmt_t *moved_to_stmt; + + /* Compute the new moved-to path for this child... */ + child_subtree_relpath = + svn_relpath_skip_ancestor(local_relpath, + moved_here_child_relpath); + SVN_ERR_ASSERT(child_subtree_relpath); + + new_moved_to_relpath = + svn_relpath_join(b->moved_to_relpath, + child_subtree_relpath, iterpool); + /* ... and update the BASE moved-to record. */ + SVN_ERR(svn_sqlite__get_statement( + &moved_to_stmt, wcroot->sdb, + STMT_UPDATE_MOVED_TO_RELPATH)); + SVN_ERR(svn_sqlite__bindf(moved_to_stmt, "iss", + wcroot->wc_id, + child_moved_from_relpath, + new_moved_to_relpath)); + SVN_ERR(svn_sqlite__step(&have_row, moved_to_stmt)); + SVN_ERR(svn_sqlite__reset(moved_to_stmt)); + } + + SVN_ERR(svn_sqlite__step(&have_row, stmt)); + } + svn_pool_destroy(iterpool); + + SVN_ERR(svn_sqlite__reset(stmt)); + } } if (op_root) Modified: subversion/trunk/subversion/tests/cmdline/copy_tests.py URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/copy_tests.py?rev=1152324&r1=1152323&r2=1152324&view=diff ============================================================================== --- subversion/trunk/subversion/tests/cmdline/copy_tests.py (original) +++ subversion/trunk/subversion/tests/cmdline/copy_tests.py Fri Jul 29 17:46:16 2011 @@ -5487,7 +5487,6 @@ def commit_copied_half_of_move(sbox): 'commit', '-m', 'foo', D_path) @Issue(3631) -@XFail() def commit_copied_half_of_nested_move(sbox): "attempt to commit the copied part of a nested move" sbox.build(read_only = True) @@ -5515,8 +5514,6 @@ def commit_copied_half_of_nested_move(sb 'commit', '-m', 'foo', C_path) # A/C/D/iota -> A/iota; verify that iota's moved-from hasn't changed - ### This currently fails because iota's moved-from info isn't updated - ### during the A/D->A/C/D move. D_iota_path = sbox.ospath('A/C/D/iota') A_iota_path = sbox.ospath('A/iota') svntest.actions.run_and_verify_svn(None, None, [], 'mv', D_iota_path,