You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2015/01/15 18:32:47 UTC
svn commit: r1652184 - in /subversion/trunk/subversion:
libsvn_wc/wc-queries.sql libsvn_wc/wc_db.c libsvn_wc/wc_db_update_move.c
tests/libsvn_wc/op-depth-test.c
Author: rhuijben
Date: Thu Jan 15 17:32:47 2015
New Revision: 1652184
URL: http://svn.apache.org/r1652184
Log:
Properly remove the working copy delete information for descendants of nodes that
are removed by the 'update move' handling. This resolves a case of an invalid
database state identified by the move4_update_delself_AAA() op-depth test.
* subversion/libsvn_wc/wc-queries.sql
(STMT_DELETE_WORKING_BASE_DELETE): Make the '0' for BASE nodes configurable
to allow using this same query for higher layers.
* subversion/libsvn_wc/wc_db.c
(db_base_remove): Update statement usage.
* subversion/libsvn_wc/wc_db_update_move.c
(delete_move_leaf): Replace baton with separate arguments. Retract
base-deletes recursively, instead of only for the node itself.
(update_moved_away_node): Update caller.
* subversion/tests/libsvn_wc/op-depth-test.c
(move4_update_delself_AAA): Update assumptions, after fixing the root cause.
(test_funcs): Mark move4_update_delself_AAA PASS.
Modified:
subversion/trunk/subversion/libsvn_wc/wc-queries.sql
subversion/trunk/subversion/libsvn_wc/wc_db.c
subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c
subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c
Modified: subversion/trunk/subversion/libsvn_wc/wc-queries.sql
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc-queries.sql?rev=1652184&r1=1652183&r2=1652184&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Thu Jan 15 17:32:47 2015
@@ -235,11 +235,11 @@ WHERE wc_id = ?1 AND IS_STRICT_DESCENDAN
DELETE FROM nodes
WHERE wc_id = ?1 AND IS_STRICT_DESCENDANT_OF(local_relpath, ?2)
AND presence = MAP_BASE_DELETED
- AND op_depth > 0
+ AND op_depth > ?3
AND op_depth = (SELECT MIN(op_depth) FROM nodes n
WHERE n.wc_id = ?1
AND n.local_relpath = nodes.local_relpath
- AND op_depth > 0)
+ AND op_depth > ?3)
-- STMT_DELETE_WORKING_RECURSIVE
DELETE FROM nodes
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1652184&r1=1652183&r2=1652184&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Thu Jan 15 17:32:47 2015
@@ -2351,7 +2351,7 @@ db_base_remove(svn_wc__db_wcroot_t *wcro
{
SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
STMT_DELETE_WORKING_BASE_DELETE));
- SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
+ SVN_ERR(svn_sqlite__bindf(stmt, "isd", wcroot->wc_id, local_relpath, 0));
SVN_ERR(svn_sqlite__step_done(stmt));
}
else
Modified: subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c?rev=1652184&r1=1652183&r2=1652184&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c Thu Jan 15 17:32:47 2015
@@ -1233,23 +1233,23 @@ tc_editor_delete(update_move_baton_t *b,
/* Delete handling for both WORKING and shadowed nodes */
static svn_error_t *
-delete_move_leaf(update_move_baton_t *b,
- const char *relpath,
+delete_move_leaf(svn_wc__db_wcroot_t *wcroot,
+ const char *local_relpath,
+ int op_depth,
apr_pool_t *scratch_pool)
{
svn_sqlite__stmt_t *stmt;
- int op_depth = relpath_depth(b->move_root_dst_relpath);
- const char *parent_relpath = svn_relpath_dirname(relpath, scratch_pool);
svn_boolean_t have_row;
int op_depth_below;
- /* Deleting the ROWS is valid so long as we update the parent before
+ /* Deleting the ROWS is valid as long as we update the parent before
committing the transaction. The removed rows could have been
replacing a lower layer in which case we need to add base-deleted
rows. */
- SVN_ERR(svn_sqlite__get_statement(&stmt, b->wcroot->sdb,
+ SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
STMT_SELECT_HIGHEST_WORKING_NODE));
- SVN_ERR(svn_sqlite__bindf(stmt, "isd", b->wcroot->wc_id, parent_relpath,
+ SVN_ERR(svn_sqlite__bindf(stmt, "isd", wcroot->wc_id,
+ svn_relpath_dirname(local_relpath, scratch_pool),
op_depth));
SVN_ERR(svn_sqlite__step(&have_row, stmt));
if (have_row)
@@ -1258,30 +1258,38 @@ delete_move_leaf(update_move_baton_t *b,
if (have_row)
{
/* Remove non-shadowing nodes. */
- SVN_ERR(svn_sqlite__get_statement(&stmt, b->wcroot->sdb,
+ SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
STMT_DELETE_NO_LOWER_LAYER));
- SVN_ERR(svn_sqlite__bindf(stmt, "isdd", b->wcroot->wc_id, relpath,
+ SVN_ERR(svn_sqlite__bindf(stmt, "isdd", wcroot->wc_id, local_relpath,
op_depth, op_depth_below));
SVN_ERR(svn_sqlite__step_done(stmt));
/* Convert remaining shadowing nodes to presence='base-deleted'. */
- SVN_ERR(svn_sqlite__get_statement(&stmt, b->wcroot->sdb,
+ SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
STMT_REPLACE_WITH_BASE_DELETED));
- SVN_ERR(svn_sqlite__bindf(stmt, "isd", b->wcroot->wc_id, relpath,
+ SVN_ERR(svn_sqlite__bindf(stmt, "isd", wcroot->wc_id, local_relpath,
op_depth));
SVN_ERR(svn_sqlite__step_done(stmt));
}
else
{
- SVN_ERR(svn_sqlite__get_statement(&stmt, b->wcroot->sdb,
+ SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
STMT_DELETE_WORKING_OP_DEPTH));
- SVN_ERR(svn_sqlite__bindf(stmt, "isd", b->wcroot->wc_id, relpath,
+ SVN_ERR(svn_sqlite__bindf(stmt, "isd", wcroot->wc_id, local_relpath,
op_depth));
SVN_ERR(svn_sqlite__step_done(stmt));
}
- /* Retract any base-delete. */
- SVN_ERR(svn_wc__db_retract_parent_delete(b->wcroot, relpath, op_depth,
+ /* Retract any base-delete for descendants. */
+ {
+ SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
+ STMT_DELETE_WORKING_BASE_DELETE));
+ SVN_ERR(svn_sqlite__bindf(stmt, "isd", wcroot->wc_id, local_relpath,
+ op_depth));
+ SVN_ERR(svn_sqlite__step_done(stmt));
+ }
+ /* And for the node itself */
+ SVN_ERR(svn_wc__db_retract_parent_delete(wcroot, local_relpath, op_depth,
scratch_pool));
return SVN_NO_ERROR;
@@ -1523,7 +1531,9 @@ update_moved_away_node(update_move_baton
/* And perform some work that in some ways belongs in
replace_moved_layer() after creating all conflicts */
- SVN_ERR(delete_move_leaf(b, dst_relpath, scratch_pool));
+ SVN_ERR(delete_move_leaf(b->wcroot, dst_relpath,
+ relpath_depth(b->move_root_dst_relpath),
+ scratch_pool));
}
if (src_kind != svn_node_none && src_kind != dst_kind)
Modified: subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c?rev=1652184&r1=1652183&r2=1652184&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c Thu Jan 15 17:32:47 2015
@@ -9314,25 +9314,24 @@ move4_update_delself_AAA(const svn_test_
/* Resolve a few conflicts manually */
SVN_ERR(sbox_wc_resolve(&b, "A", svn_depth_empty,
svn_wc_conflict_choose_mine_conflict));
- SVN_ERR(sbox_wc_resolve(&b, "B", svn_depth_empty,
- svn_wc_conflict_choose_mine_conflict));
- SVN_ERR(sbox_wc_resolve(&b, "C/A", svn_depth_empty,
- svn_wc_conflict_choose_mine_conflict));
{
nodes_row_t nodes[] = {
- /* ### We have an invalid database state here!!!
- One of the calls before this left a delete of A_moved/A/A/A */
{1, "A_moved", "normal", 2, "A", MOVED_HERE},
{1, "A_moved/A", "normal", 2, "A/A", MOVED_HERE},
- {3, "A_moved/A/A/A", "base-deleted", NO_COPY_FROM},
{ 0 },
};
SVN_ERR(check_db_rows(&b, "A_moved", nodes));
}
+ SVN_ERR(sbox_wc_resolve(&b, "B", svn_depth_empty,
+ svn_wc_conflict_choose_mine_conflict));
+ SVN_ERR(sbox_wc_resolve(&b, "C/A", svn_depth_empty,
+ svn_wc_conflict_choose_mine_conflict));
+
+
/* ### These can currently only be resolved to merged ???? */
SVN_ERR(sbox_wc_resolve(&b, "D/A/A", svn_depth_empty,
svn_wc_conflict_choose_merged));
@@ -9370,7 +9369,6 @@ move4_update_delself_AAA(const svn_test_
{1, "AAA_3/A", "normal", 1, "C/A/A/A"},
{1, "A_moved", "normal", 2, "A", MOVED_HERE},
{1, "A_moved/A", "normal", 2, "A/A", MOVED_HERE},
- {3, "A_moved/A/A/A", "base-deleted", NO_COPY_FROM}, /* ### */
{1, "B", "base-deleted", NO_COPY_FROM, "A"},
{0, "B", "normal", 1, "B"},
{1, "B/A", "base-deleted", NO_COPY_FROM},
@@ -9381,7 +9379,6 @@ move4_update_delself_AAA(const svn_test_
{0, "B/A/A/A", "normal", 1, "B/A/A/A"},
{1, "BA_moved", "normal", 1, "A/A", MOVED_HERE},
{1, "BA_moved/A", "normal", 1, "A/A/A", MOVED_HERE},
- {2, "BA_moved/A/A", "base-deleted", NO_COPY_FROM},
{1, "BA_moved/A/A", "normal", 1, "A/A/A/A", MOVED_HERE},
{0, "C", "normal", 1, "C"},
{2, "C/A", "base-deleted", NO_COPY_FROM, "A/A"},
@@ -10117,7 +10114,7 @@ static struct svn_test_descriptor_t test
"move4: delete AAA"),
SVN_TEST_OPTS_PASS(move4_update_add_AAA,
"move4: add AAA"),
- SVN_TEST_OPTS_XFAIL(move4_update_delself_AAA,
+ SVN_TEST_OPTS_PASS(move4_update_delself_AAA,
"move4: delete self AAA"),
SVN_TEST_OPTS_PASS(simple_move_bump,
"simple move bump"),