You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ph...@apache.org on 2012/12/07 19:49:09 UTC
svn commit: r1418431 - in /subversion/trunk/subversion:
libsvn_wc/wc-queries.sql libsvn_wc/wc_db.c libsvn_wc/wc_db_private.h
libsvn_wc/wc_db_update_move.c tests/libsvn_wc/op-depth-test.c
Author: philip
Date: Fri Dec 7 18:49:08 2012
New Revision: 1418431
URL: http://svn.apache.org/viewvc?rev=1418431&view=rev
Log:
Reuse some wc_db.c code rather than copying it (the copied code had a
bug).
* subversion/libsvn_wc/wc-queries.sql
(STMT_INSTALL_WORKING_NODE_FOR_DELETE_FROM_BASE): Remove.
* subversion/libsvn_wc/wc_db_private.c
(svn_wc__db_extend_parent_delete): New.
* subversion/libsvn_wc/wc_db.c
(extend_parent_delete): Rename to...
(svn_wc__db_extend_parent_delete): ...this, add op-depth and kind
parameters, avoid relying on base node.
(svn_wc__db_retract_parent_delete): Tweak comment.
(insert_base_node): Call renamed function.
* subversion/libsvn_wc/wc_db_update_move.c
(tc_editor_add_file): Use svn_wc__db_extend_parent_delete.
(replace_moved_layer): Delete comment.
* subversion/tests/libsvn_wc/op-depth-test.c
(move_update): Extend.
Modified:
subversion/trunk/subversion/libsvn_wc/wc-queries.sql
subversion/trunk/subversion/libsvn_wc/wc_db.c
subversion/trunk/subversion/libsvn_wc/wc_db_private.h
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=1418431&r1=1418430&r2=1418431&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Fri Dec 7 18:49:08 2012
@@ -827,15 +827,6 @@ VALUES (?1, ?2, 0,
AND local_relpath = ?2
AND op_depth = 0))
--- STMT_INSTALL_WORKING_NODE_FOR_DELETE_FROM_BASE
-INSERT OR REPLACE INTO nodes (
- wc_id, local_relpath, op_depth,
- parent_relpath, presence, kind)
-SELECT wc_id, local_relpath, ?3 /*op_depth*/,
- parent_relpath, 'base-deleted', kind
-FROM nodes
-WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0
-
-- STMT_INSTALL_WORKING_NODE_FOR_DELETE
INSERT OR REPLACE INTO nodes (
wc_id, local_relpath, op_depth,
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1418431&r1=1418430&r2=1418431&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Fri Dec 7 18:49:08 2012
@@ -641,17 +641,19 @@ blank_ibb(insert_base_baton_t *pibb)
A/B/C/D normal base-del normal
A/B/C/D/E normal base-del
- When adding a base node if the parent has a working node then the
- parent base is deleted and this must be extended to cover new base
- node.
+ When adding a node if the parent has a higher working node then the
+ parent node is deleted (or replaced) and the delete must be extended
+ to cover new node.
In the example above A/B/C/D and A/B/C/D/E are the nodes that get
the extended delete, A/B/C is already deleted.
*/
-static svn_error_t *
-extend_parent_delete(svn_wc__db_wcroot_t *wcroot,
- const char *local_relpath,
- apr_pool_t *scratch_pool)
+svn_error_t *
+svn_wc__db_extend_parent_delete(svn_wc__db_wcroot_t *wcroot,
+ const char *local_relpath,
+ svn_kind_t kind,
+ int op_depth,
+ apr_pool_t *scratch_pool)
{
svn_boolean_t have_row;
svn_sqlite__stmt_t *stmt;
@@ -662,26 +664,29 @@ extend_parent_delete(svn_wc__db_wcroot_t
SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
STMT_SELECT_LOWEST_WORKING_NODE));
- SVN_ERR(svn_sqlite__bindf(stmt, "isd", wcroot->wc_id, parent_relpath, 0));
+ SVN_ERR(svn_sqlite__bindf(stmt, "isd", wcroot->wc_id, parent_relpath,
+ op_depth));
SVN_ERR(svn_sqlite__step(&have_row, stmt));
if (have_row)
parent_op_depth = svn_sqlite__column_int(stmt, 0);
SVN_ERR(svn_sqlite__reset(stmt));
if (have_row)
{
- int op_depth;
+ int existing_op_depth;
- SVN_ERR(svn_sqlite__bindf(stmt, "isd", wcroot->wc_id, local_relpath, 0));
+ SVN_ERR(svn_sqlite__bindf(stmt, "isd", wcroot->wc_id, local_relpath,
+ op_depth));
SVN_ERR(svn_sqlite__step(&have_row, stmt));
if (have_row)
- op_depth = svn_sqlite__column_int(stmt, 0);
+ existing_op_depth = svn_sqlite__column_int(stmt, 0);
SVN_ERR(svn_sqlite__reset(stmt));
- if (!have_row || parent_op_depth < op_depth)
+ if (!have_row || parent_op_depth < existing_op_depth)
{
SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
- STMT_INSTALL_WORKING_NODE_FOR_DELETE_FROM_BASE));
- SVN_ERR(svn_sqlite__bindf(stmt, "isd", wcroot->wc_id,
- local_relpath, parent_op_depth));
+ STMT_INSTALL_WORKING_NODE_FOR_DELETE));
+ SVN_ERR(svn_sqlite__bindf(stmt, "isdst", wcroot->wc_id,
+ local_relpath, parent_op_depth,
+ parent_relpath, kind_map, kind));
SVN_ERR(svn_sqlite__update(NULL, stmt));
}
}
@@ -690,11 +695,11 @@ extend_parent_delete(svn_wc__db_wcroot_t
}
-/* This is the reverse of extend_parent_delete.
+/* This is the reverse of svn_wc__db_extend_parent_delete.
- When removing a base node if the parent has a working node then the
- parent base and this node are both deleted and so the delete of
- this node must be removed.
+ When removing a node if the parent has a higher working node then
+ the parent node and this node are both deleted or replaced and any
+ delete over this node must be removed.
*/
svn_error_t *
svn_wc__db_retract_parent_delete(svn_wc__db_wcroot_t *wcroot,
@@ -856,7 +861,9 @@ insert_base_node(void *baton,
|| (pibb->status == svn_wc__db_status_incomplete))
&& ! pibb->file_external)
{
- SVN_ERR(extend_parent_delete(wcroot, local_relpath, scratch_pool));
+ SVN_ERR(svn_wc__db_extend_parent_delete(wcroot, local_relpath,
+ pibb->kind, 0,
+ scratch_pool));
}
else if (pibb->status == svn_wc__db_status_not_present
|| pibb->status == svn_wc__db_status_server_excluded
Modified: subversion/trunk/subversion/libsvn_wc/wc_db_private.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db_private.h?rev=1418431&r1=1418430&r2=1418431&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db_private.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db_private.h Fri Dec 7 18:49:08 2012
@@ -337,6 +337,13 @@ svn_wc__db_get_children_op_depth(apr_has
svn_error_t *
+svn_wc__db_extend_parent_delete(svn_wc__db_wcroot_t *wcroot,
+ const char *local_relpath,
+ svn_kind_t kind,
+ int op_depth,
+ apr_pool_t *scratch_pool);
+
+svn_error_t *
svn_wc__db_retract_parent_delete(svn_wc__db_wcroot_t *wcroot,
const char *local_relpath,
int op_depth,
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=1418431&r1=1418430&r2=1418431&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c Fri Dec 7 18:49:08 2012
@@ -93,31 +93,10 @@ tc_editor_add_file(void *baton,
apr_pool_t *scratch_pool)
{
struct tc_editor_baton *b = baton;
- int parent_op_depth, op_depth = relpath_depth(b->move_root_dst_relpath);
- const char *parent_relpath = svn_relpath_dirname(relpath, scratch_pool);
- svn_boolean_t have_row;
- svn_sqlite__stmt_t *stmt;
+ int op_depth = relpath_depth(b->move_root_dst_relpath);
- /* Extend base-delete. */
- SVN_ERR(svn_sqlite__get_statement(&stmt, b->wcroot->sdb,
- STMT_SELECT_LOWEST_WORKING_NODE));
- SVN_ERR(svn_sqlite__bindf(stmt, "isd", b->wcroot->wc_id, parent_relpath,
- op_depth));
- SVN_ERR(svn_sqlite__step(&have_row, stmt));
- if (have_row)
- parent_op_depth = svn_sqlite__column_int(stmt, 0);
- SVN_ERR(svn_sqlite__reset(stmt));
- if (have_row)
- {
- /* Adding this deleted NODES row is valid if we add the
- underlying normal row before completing the transaction. */
- SVN_ERR(svn_sqlite__get_statement(&stmt, b->wcroot->sdb,
- STMT_INSTALL_WORKING_NODE_FOR_DELETE));
- SVN_ERR(svn_sqlite__bindf(stmt, "isdss", b->wcroot->wc_id, relpath,
- parent_op_depth, parent_relpath,
- "file" /* ### TODO use kind_map */ ));
- SVN_ERR(svn_sqlite__update(NULL, stmt));
- }
+ SVN_ERR(svn_wc__db_extend_parent_delete(b->wcroot, relpath, svn_kind_file,
+ op_depth, scratch_pool));
/* ### TODO check for, and flag, tree conflict */
@@ -817,9 +796,6 @@ replace_moved_layer(const char *src_relp
}
SVN_ERR(svn_sqlite__reset(stmt));
- /* TODO: extend/retract any base-deleted layers to account for
- added/removed nodes in the replaced layer. */
-
return SVN_NO_ERROR;
}
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=1418431&r1=1418430&r2=1418431&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c Fri Dec 7 18:49:08 2012
@@ -4304,6 +4304,14 @@ move_update(const svn_test_opts_t *opts,
SVN_ERR(sbox_wc_add(&b, "A/B/g"));
SVN_ERR(sbox_wc_delete(&b, "A/B/h"));
SVN_ERR(sbox_wc_commit(&b, ""));
+ SVN_ERR(sbox_wc_mkdir(&b, "X"));
+ sbox_file_write(&b, "X/f", "r4 content\n");
+ sbox_file_write(&b, "X/g", "r4 content\n");
+ sbox_file_write(&b, "X/h", "r4 content\n");
+ SVN_ERR(sbox_wc_add(&b, "X/f"));
+ SVN_ERR(sbox_wc_add(&b, "X/g"));
+ SVN_ERR(sbox_wc_add(&b, "X/h"));
+ SVN_ERR(sbox_wc_commit(&b, ""));
SVN_ERR(sbox_wc_update(&b, "", 1));
/* A is single-revision so A2 is a single-revision copy */
@@ -4464,6 +4472,66 @@ move_update(const svn_test_opts_t *opts,
SVN_ERR(check_db_rows(&b, "", nodes));
}
+ SVN_ERR(sbox_wc_update(&b, "X", 4));
+ SVN_ERR(sbox_wc_copy(&b, "X", "A2/B"));
+ {
+ nodes_row_t nodes[] = {
+ {0, "", "normal", 2, ""},
+ {0, "A", "normal", 2, "A"},
+ {0, "A/B", "normal", 2, "A/B"},
+ {0, "A/B/f", "normal", 2, "A/B/f"},
+ {0, "A/B/h", "normal", 2, "A/B/h"},
+ {0, "X", "normal", 4, "X"},
+ {0, "X/f", "normal", 4, "X/f"},
+ {0, "X/g", "normal", 4, "X/g"},
+ {0, "X/h", "normal", 4, "X/h"},
+ {1, "A", "base-deleted", NO_COPY_FROM, "A2"},
+ {1, "A/B", "base-deleted", NO_COPY_FROM},
+ {1, "A/B/f", "base-deleted", NO_COPY_FROM},
+ {1, "A/B/h", "base-deleted", NO_COPY_FROM},
+ {1, "A2", "normal", 2, "A", MOVED_HERE},
+ {1, "A2/B", "normal", 2, "A/B", MOVED_HERE},
+ {1, "A2/B/f", "normal", 2, "A/B/f", MOVED_HERE},
+ {1, "A2/B/h", "normal", 2, "A/B/h", MOVED_HERE},
+ {2, "A2/B", "normal", 4, "X"},
+ {2, "A2/B/f", "normal", 4, "X/f"},
+ {2, "A2/B/g", "normal", 4, "X/g"},
+ {2, "A2/B/h", "normal", 4, "X/h"},
+ {0}
+ };
+ SVN_ERR(check_db_rows(&b, "", nodes));
+ }
+
+ SVN_ERR(sbox_wc_update(&b, "", 4));
+ SVN_ERR(sbox_wc_resolve(&b, "A", svn_wc_conflict_choose_mine_conflict));
+ {
+ nodes_row_t nodes[] = {
+ {0, "", "normal", 4, ""},
+ {0, "A", "normal", 4, "A"},
+ {0, "A/B", "normal", 4, "A/B"},
+ {0, "A/B/f", "normal", 4, "A/B/f"},
+ {0, "A/B/g", "normal", 4, "A/B/g"},
+ {0, "X", "normal", 4, "X"},
+ {0, "X/f", "normal", 4, "X/f"},
+ {0, "X/g", "normal", 4, "X/g"},
+ {0, "X/h", "normal", 4, "X/h"},
+ {1, "A", "base-deleted", NO_COPY_FROM, "A2"},
+ {1, "A/B", "base-deleted", NO_COPY_FROM},
+ {1, "A/B/f", "base-deleted", NO_COPY_FROM},
+ {1, "A/B/g", "base-deleted", NO_COPY_FROM},
+ {1, "A2", "normal", 4, "A", MOVED_HERE},
+ {1, "A2/B", "normal", 4, "A/B", MOVED_HERE},
+ {1, "A2/B/f", "normal", 4, "A/B/f", MOVED_HERE},
+ {1, "A2/B/g", "normal", 4, "A/B/g", MOVED_HERE},
+ {2, "A2/B", "normal", 4, "X"},
+ {2, "A2/B/f", "normal", 4, "X/f"},
+ {2, "A2/B/g", "normal", 4, "X/g"},
+ {2, "A2/B/h", "normal", 4, "X/h"},
+ {0}
+ };
+ SVN_ERR(check_db_rows(&b, "", nodes));
+ }
+
return SVN_NO_ERROR;
}