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 2011/02/13 13:13:03 UTC
svn commit: r1070220 - in /subversion/trunk/subversion:
libsvn_wc/wc-queries.sql libsvn_wc/wc_db.c tests/libsvn_wc/op-depth-test.c
Author: philip
Date: Sun Feb 13 12:13:02 2011
New Revision: 1070220
URL: http://svn.apache.org/viewvc?rev=1070220&view=rev
Log:
Don't do non-recursive revert of WORKING or actual-only node with
ACTUAL_NODE children.
* subversion/libsvn_wc/wc_db.c
(op_revert_txn): Check for children even when WORKING node is not added.
* subversion/libsvn_wc/wc-queries.sql
(STMT_SELECT_GE_OP_DEPTH_CHILDREN): Select ACTUAL_NODE children as well.
* subversion/tests/libsvn_wc/op-depth-tests.c
(test_op_revert): Add cases and tweak expectations.
Modified:
subversion/trunk/subversion/libsvn_wc/wc-queries.sql
subversion/trunk/subversion/libsvn_wc/wc_db.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=1070220&r1=1070219&r2=1070220&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Sun Feb 13 12:13:02 2011
@@ -148,7 +148,10 @@ WHERE wc_id = ?1 AND parent_relpath = ?2
-- STMT_SELECT_GE_OP_DEPTH_CHILDREN
SELECT 1 FROM nodes
WHERE wc_id = ?1 AND parent_relpath = ?2
- AND (op_depth > ?3 OR (op_depth = ?3 AND presence != 'base-deleted'));
+ AND (op_depth > ?3 OR (op_depth = ?3 AND presence != 'base-deleted'))
+UNION
+SELECT 1 FROM ACTUAL_NODE
+WHERE wc_id = ?1 AND parent_relpath = ?2;
-- STMT_SELECT_NODE_CHILDREN
SELECT local_relpath FROM nodes
@@ -657,6 +660,9 @@ FROM actual_node
WHERE wc_id = ?1 AND (local_relpath = ?2 OR local_relpath LIKE ?3 ESCAPE '#')
AND tree_conflict_data IS NULL;
+-- STMT_SELECT_ACTUAL_CHILDREN
+SELECT 1 FROM actual_node WHERE wc_id = ?1 AND parent_relpath = ?2;
+
/* ------------------------------------------------------------------------- */
/* these are used in entries.c */
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1070220&r1=1070219&r2=1070220&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Sun Feb 13 12:13:02 2011
@@ -3577,7 +3577,24 @@ op_revert_txn(void *baton, svn_sqlite__d
{
SVN_ERR(svn_sqlite__reset(stmt));
if (affected_rows)
- return SVN_NO_ERROR; /* actual-only revert */
+ {
+ /* Can't do non-recursive actual-only revert if actual-only
+ children exist */
+ SVN_ERR(svn_sqlite__get_statement(&stmt, b->wcroot->sdb,
+ STMT_SELECT_ACTUAL_CHILDREN));
+ SVN_ERR(svn_sqlite__bindf(stmt, "is", b->wcroot->wc_id,
+ b->local_relpath));
+ SVN_ERR(svn_sqlite__step(&have_row, stmt));
+ SVN_ERR(svn_sqlite__reset(stmt));
+ if (have_row)
+ return svn_error_createf(SVN_ERR_WC_INVALID_OPERATION_DEPTH, NULL,
+ _("Can't revert '%s' without"
+ " reverting children"),
+ path_for_error_message(b->wcroot,
+ b->local_relpath,
+ scratch_pool));
+ return SVN_NO_ERROR;
+ }
return svn_error_createf(SVN_ERR_WC_PATH_NOT_FOUND, NULL,
_("The node '%s' was not found."),
@@ -3602,27 +3619,23 @@ op_revert_txn(void *baton, svn_sqlite__d
SVN_ERR(convert_to_working_status(&status, status));
- if (status == svn_wc__db_status_added)
- {
- /* Check for children */
- SVN_ERR(svn_sqlite__get_statement(&stmt, b->wcroot->sdb,
- STMT_SELECT_GE_OP_DEPTH_CHILDREN));
- SVN_ERR(svn_sqlite__bindf(stmt, "isi", b->wcroot->wc_id,
- b->local_relpath, op_depth));
- SVN_ERR(svn_sqlite__step(&have_row, stmt));
- SVN_ERR(svn_sqlite__reset(stmt));
- if (have_row)
- return svn_error_createf(SVN_ERR_WC_INVALID_OPERATION_DEPTH, NULL,
- _("Can't revert '%s' without"
- " reverting children"),
- path_for_error_message(b->wcroot,
- b->local_relpath,
- scratch_pool));
- }
+ /* Can't do non-recursive revert if children exist */
+ SVN_ERR(svn_sqlite__get_statement(&stmt, b->wcroot->sdb,
+ STMT_SELECT_GE_OP_DEPTH_CHILDREN));
+ SVN_ERR(svn_sqlite__bindf(stmt, "isi", b->wcroot->wc_id,
+ b->local_relpath, op_depth));
+ SVN_ERR(svn_sqlite__step(&have_row, stmt));
+ SVN_ERR(svn_sqlite__reset(stmt));
+ if (have_row)
+ return svn_error_createf(SVN_ERR_WC_INVALID_OPERATION_DEPTH, NULL,
+ _("Can't revert '%s' without"
+ " reverting children"),
+ path_for_error_message(b->wcroot,
+ b->local_relpath,
+ scratch_pool));
/* Rewrite the op-depth of all deleted children making the
direct children into roots of deletes. */
-
SVN_ERR(svn_sqlite__get_statement(&stmt, b->wcroot->sdb,
STMT_UPDATE_OP_DEPTH_INCREASE_RECURSIVE));
SVN_ERR(svn_sqlite__bindf(stmt, "isi", b->wcroot->wc_id,
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=1070220&r1=1070219&r2=1070220&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c Sun Feb 13 12:13:02 2011
@@ -2081,19 +2081,27 @@ test_op_revert(const svn_test_opts_t *op
{ 0, "A", "normal", 4, "A" },
{ 0 },
};
- const char *before_actual1[] = { "A/B", "A/B/C", NULL };
- const char *after_actual1[] = { "A/B/C", NULL };
+ const char *before_actual1[] = { "A", "A/B", NULL };
+ const char *after_actual1[] = { "A", NULL };
const char *before_actual2[] = { "A/B", "A/B/C", NULL };
const char *after_actual2[] = { "A/B", NULL };
const char *before_actual3[] = { "", "A", "A/B", NULL };
const char *after_actual3[] = { "", "A/B", NULL };
const char *before_actual4[] = { "", "A/B", NULL };
const char *after_actual4[] = { "A/B", NULL };
+ const char *common_actual5[] = { "A/B", "A/B/C", NULL };
+ const char *common_actual6[] = { "A/B", "A/B/C", "A/B/C/D", NULL };
SVN_ERR(revert(&b, "A/B", before, after, NULL, NULL));
SVN_ERR(revert(&b, "A/B", before, after, before_actual1, after_actual1));
SVN_ERR(revert(&b, "A/B/C", before, before, before_actual2, after_actual2));
SVN_ERR(revert(&b, "A", before, before, before_actual3, after_actual3));
SVN_ERR(revert(&b, "", before, before, before_actual4, after_actual4));
+ err = revert(&b, "A/B", before, before, common_actual5, common_actual5);
+ SVN_TEST_ASSERT(err && err->apr_err == SVN_ERR_WC_INVALID_OPERATION_DEPTH);
+ svn_error_clear(err);
+ err = revert(&b, "A/B/C", before, before, common_actual6, common_actual6);
+ SVN_TEST_ASSERT(err && err->apr_err == SVN_ERR_WC_INVALID_OPERATION_DEPTH);
+ svn_error_clear(err);
}
{
@@ -2165,8 +2173,8 @@ test_op_revert(const svn_test_opts_t *op
{ 0, "A/B/C", "normal", 4, "A/B/C" },
{ 0 },
};
- const char *before_actual[] = { "A/B", "A/B/C", "A/B/C/D", NULL };
- const char *after_actual[] = {"A/B", "A/B/C/D", NULL };
+ const char *before_actual[] = { "A/B", "A/B/C", NULL };
+ const char *after_actual[] = {"A/B", NULL };
SVN_ERR(revert(&b, "A/B/C", before, after, NULL, NULL));
SVN_ERR(revert(&b, "A/B/C", before, after, before_actual, after_actual));
}