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/03/03 19:18:06 UTC
svn commit: r1076715 - in /subversion/trunk/subversion:
libsvn_wc/wc-queries.sql libsvn_wc/wc_db.c tests/libsvn_wc/op-depth-test.c
Author: philip
Date: Thu Mar 3 18:18:06 2011
New Revision: 1076715
URL: http://svn.apache.org/viewvc?rev=1076715&view=rev
Log:
Make new recursive revert leave changelists.
* subversion/libsvn_wc/wc_db.c
(op_revert_recursive_txn): Clear rather than remove actual nodes with
changelist if they are still files.
* subversion/libsvn_wc/wc-queries.sql
(STMT_DELETE_ACTUAL_NODE_LEAVING_CHANGELIST): Tweak select to match
recursive case.
(STMT_DELETE_ACTUAL_NODE_LEAVING_CHANGELIST_RECURSIVE,
STMT_CLEAR_ACTUAL_NODE_LEAVING_CHANGELIST_RECURSIVE): New.
* subversion/tests/libsvn_wc/op-depth-test.c
(test_op_revert_changelist): Add recursive cases.
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=1076715&r1=1076714&r2=1076715&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Thu Mar 3 18:18:06 2011
@@ -360,8 +360,19 @@ WHERE wc_id = ?1 AND local_relpath = ?2
DELETE FROM actual_node
WHERE wc_id = ?1 AND local_relpath = ?2
AND (changelist IS NULL
- OR 'file' NOT IN (SELECT kind FROM nodes_current
- WHERE wc_id = ?1 AND local_relpath = ?2))
+ OR local_relpath NOT IN (SELECT local_relpath FROM nodes_current
+ WHERE wc_id = ?1 AND local_relpath = ?2
+ AND kind = 'file'));
+
+-- STMT_DELETE_ACTUAL_NODE_LEAVING_CHANGELIST_RECURSIVE
+DELETE FROM actual_node
+WHERE wc_id = ?1 AND (local_relpath = ?2 OR local_relpath LIKE ?3 ESCAPE '#')
+ AND (changelist IS NULL
+ OR local_relpath NOT IN (SELECT local_relpath FROM nodes_current
+ WHERE wc_id = ?1
+ AND (local_relpath = ?2
+ OR local_relpath LIKE ?3 ESCAPE '#')
+ AND kind = 'file'));
-- STMT_DELETE_CHILD_NODES_RECURSIVE
DELETE FROM nodes
@@ -382,6 +393,20 @@ SET properties = NULL,
right_checksum = NULL
WHERE wc_id = ?1 and local_relpath = ?2;
+-- STMT_CLEAR_ACTUAL_NODE_LEAVING_CHANGELIST_RECURSIVE
+UPDATE actual_node
+SET properties = NULL,
+ text_mod = NULL,
+ tree_conflict_data = NULL,
+ conflict_old = NULL,
+ conflict_new = NULL,
+ conflict_working = NULL,
+ prop_reject = NULL,
+ older_checksum = NULL,
+ left_checksum = NULL,
+ right_checksum = NULL
+WHERE wc_id = ?1 and local_relpath = ?2 OR local_relpath LIKE ?3 ESCAPE '#';
+
-- STMT_CLEAR_ACTUAL_NODE_LEAVING_CONFLICT
UPDATE actual_node
SET properties = NULL,
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1076715&r1=1076714&r2=1076715&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Thu Mar 3 18:18:06 2011
@@ -3726,24 +3726,25 @@ op_revert_recursive_txn(void *baton,
svn_boolean_t have_row;
apr_int64_t op_depth;
int affected_rows;
+ const char *like_arg = construct_like_arg(local_relpath, scratch_pool);
/* ### Similar structure to op_revert_txn, should they be
combined? */
SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
- STMT_DELETE_ACTUAL_NODE_RECURSIVE));
- SVN_ERR(svn_sqlite__bindf(stmt, "iss", wcroot->wc_id,
- local_relpath,
- construct_like_arg(local_relpath, scratch_pool)));
- SVN_ERR(svn_sqlite__step(&affected_rows, stmt));
-
- SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
STMT_SELECT_NODE_INFO));
SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
SVN_ERR(svn_sqlite__step(&have_row, stmt));
if (!have_row)
{
SVN_ERR(svn_sqlite__reset(stmt));
+
+ SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
+ STMT_DELETE_ACTUAL_NODE_RECURSIVE));
+ SVN_ERR(svn_sqlite__bindf(stmt, "iss", wcroot->wc_id,
+ local_relpath, like_arg));
+ SVN_ERR(svn_sqlite__step(&affected_rows, stmt));
+
if (affected_rows)
return SVN_NO_ERROR; /* actual-only revert */
@@ -3771,9 +3772,19 @@ op_revert_recursive_txn(void *baton,
SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
STMT_DELETE_NODES_RECURSIVE));
SVN_ERR(svn_sqlite__bindf(stmt, "issi", wcroot->wc_id,
- local_relpath,
- construct_like_arg(local_relpath, scratch_pool),
- op_depth));
+ local_relpath, like_arg, op_depth));
+ SVN_ERR(svn_sqlite__step_done(stmt));
+
+ SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
+ STMT_DELETE_ACTUAL_NODE_LEAVING_CHANGELIST_RECURSIVE));
+ SVN_ERR(svn_sqlite__bindf(stmt, "iss", wcroot->wc_id,
+ local_relpath, like_arg));
+ SVN_ERR(svn_sqlite__step_done(stmt));
+
+ SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
+ STMT_CLEAR_ACTUAL_NODE_LEAVING_CHANGELIST_RECURSIVE));
+ SVN_ERR(svn_sqlite__bindf(stmt, "iss", wcroot->wc_id,
+ local_relpath, like_arg));
SVN_ERR(svn_sqlite__step_done(stmt));
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=1076715&r1=1076714&r2=1076715&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c Thu Mar 3 18:18:06 2011
@@ -2552,6 +2552,10 @@ test_op_revert_changelist(const svn_test
};
SVN_ERR(revert(&b, "A/f", svn_depth_empty,
before, after, before_actual, after_actual));
+ SVN_ERR(revert(&b, "A/f", svn_depth_infinity,
+ before, after, before_actual, after_actual));
+ SVN_ERR(revert(&b, "", svn_depth_infinity,
+ before, after, before_actual, after_actual));
}
{
@@ -2574,6 +2578,10 @@ test_op_revert_changelist(const svn_test
};
SVN_ERR(revert(&b, "A/f", svn_depth_empty,
before, after, common_actual, common_actual));
+ SVN_ERR(revert(&b, "A/f", svn_depth_infinity,
+ before, after, common_actual, common_actual));
+ SVN_ERR(revert(&b, "", svn_depth_infinity,
+ before, after, common_actual, common_actual));
}
{
@@ -2595,6 +2603,10 @@ test_op_revert_changelist(const svn_test
};
SVN_ERR(revert(&b, "A/f", svn_depth_empty,
before, after, common_actual, common_actual));
+ SVN_ERR(revert(&b, "A/f", svn_depth_infinity,
+ before, after, common_actual, common_actual));
+ SVN_ERR(revert(&b, "", svn_depth_infinity,
+ before, after, common_actual, common_actual));
}
return SVN_NO_ERROR;