You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by eh...@apache.org on 2010/10/08 21:35:06 UTC
svn commit: r1005985 - in /subversion/trunk/subversion/libsvn_wc:
wc-queries.sql wc_db.c wc_db.h workqueue.c
Author: ehu
Date: Fri Oct 8 19:35:06 2010
New Revision: 1005985
URL: http://svn.apache.org/viewvc?rev=1005985&view=rev
Log:
Make revert remove all ACTUAL_NODE rows that aren't required to stay around.
* subversion/libsvn_wc/wc_db.h
* subversion/libsvn_wc/wc_db.c
(svn_wc__db_op_revert_actual): New.
* subversion/libsvn_wc/wc-queries.sql
(STMT_DELETE_ACTUAL_NODE_WITHOUT_CHANGELIST,
STMT_CLEAR_ACTUAL_NODE_LEAVING_CHANGELIST): New.
* subversion/libsvn_wc/workqueue.c
(run_revert): Change cleanup order and use new svn_wc__db_op_revert().
While in there, clean up an empty if statement.
Modified:
subversion/trunk/subversion/libsvn_wc/wc-queries.sql
subversion/trunk/subversion/libsvn_wc/wc_db.c
subversion/trunk/subversion/libsvn_wc/wc_db.h
subversion/trunk/subversion/libsvn_wc/workqueue.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=1005985&r1=1005984&r2=1005985&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Fri Oct 8 19:35:06 2010
@@ -261,6 +261,26 @@ WHERE wc_id = ?1 AND local_relpath = ?2;
DELETE FROM actual_node
WHERE wc_id = ?1 AND local_relpath = ?2;
+-- STMT_DELETE_ACTUAL_NODE_WITHOUT_CHANGELIST
+DELETE FROM actual_node
+WHERE wc_id = ?1 AND local_relpath = ?2
+ AND changelist IS NULL;
+
+-- STMT_CLEAR_ACTUAL_NODE_LEAVING_CHANGELIST
+UPDATE actual_node
+SET properties = NULL,
+ text_mod = NULL,
+ conflict_data = 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;
+
-- STMT_UPDATE_NODE_BASE_DEPTH
UPDATE nodes SET depth = ?3
WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0;
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1005985&r1=1005984&r2=1005985&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Fri Oct 8 19:35:06 2010
@@ -3727,6 +3727,46 @@ svn_wc__db_op_set_tree_conflict(svn_wc__
svn_error_t *
+svn_wc__db_op_revert_actual(svn_wc__db_t *db,
+ const char *local_abspath,
+ apr_pool_t *scratch_pool)
+{
+ svn_wc__db_pdh_t *pdh;
+ const char *local_relpath;
+ svn_sqlite__stmt_t *stmt;
+ int affected_rows;
+
+ SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
+
+ SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &local_relpath, db,
+ local_abspath, svn_sqlite__mode_readwrite,
+ scratch_pool, scratch_pool));
+ VERIFY_USABLE_PDH(pdh);
+
+ SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
+ STMT_DELETE_ACTUAL_NODE));
+ SVN_ERR(svn_sqlite__bindf(stmt, "is", pdh->wcroot->wc_id, local_relpath));
+ SVN_ERR(svn_sqlite__update(&affected_rows, stmt));
+
+ if (affected_rows == 0) {
+ /* Failed to delete the row.
+ Presumably because there was a changelist set on it */
+
+ SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
+ STMT_CLEAR_ACTUAL_NODE_LEAVING_CHANGELIST));
+ SVN_ERR(svn_sqlite__bindf(stmt, "is", pdh->wcroot->wc_id, local_relpath));
+ SVN_ERR(svn_sqlite__step_done(stmt));
+ /* We're not interested here if there was an affected row or not:
+ If there isn't by now, then there simply was no row to begin with */
+ }
+
+ /* Some entries have cached the above values. Kapow!! */
+ SVN_ERR(flush_entries(db, pdh, local_abspath, scratch_pool));
+
+ return SVN_NO_ERROR;
+}
+
+svn_error_t *
svn_wc__db_op_revert(svn_wc__db_t *db,
const char *local_abspath,
svn_depth_t depth,
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=1005985&r1=1005984&r2=1005985&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Fri Oct 8 19:35:06 2010
@@ -1259,6 +1259,16 @@ svn_wc__db_op_mark_resolved(svn_wc__db_t
apr_pool_t *scratch_pool);
+/* Revert all local changes which are being maintained in the database,
+ * including conflict storage, properties and text modification status.
+ */
+svn_error_t *
+svn_wc__db_op_revert_actual(svn_wc__db_t *db,
+ const char *local_abspath,
+ apr_pool_t *scratch_pool);
+
+
+
svn_error_t *
svn_wc__db_op_revert(svn_wc__db_t *db,
const char *local_abspath,
Modified: subversion/trunk/subversion/libsvn_wc/workqueue.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/workqueue.c?rev=1005985&r1=1005984&r2=1005985&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/workqueue.c (original)
+++ subversion/trunk/subversion/libsvn_wc/workqueue.c Fri Oct 8 19:35:06 2010
@@ -206,8 +206,43 @@ run_revert(svn_wc__db_t *db,
db, local_abspath,
scratch_pool, scratch_pool));
- SVN_ERR(svn_wc__db_op_set_props(db, local_abspath, NULL, NULL, NULL,
- scratch_pool));
+ if (kind == svn_wc__db_kind_dir)
+ parent_abspath = local_abspath;
+ else
+ parent_abspath = svn_dirent_dirname(local_abspath, scratch_pool);
+
+
+ if (conflicted)
+ {
+ const apr_array_header_t *conflicts;
+ int i;
+
+ SVN_ERR(svn_wc__db_read_conflicts(&conflicts, db, local_abspath,
+ scratch_pool, scratch_pool));
+
+ for (i = 0; i < conflicts->nelts; i++)
+ {
+ const svn_wc_conflict_description2_t *cd;
+
+ cd = APR_ARRAY_IDX(conflicts, i,
+ const svn_wc_conflict_description2_t *);
+
+ SVN_ERR(maybe_remove_conflict(parent_abspath, cd->base_file,
+ local_abspath, scratch_pool));
+ SVN_ERR(maybe_remove_conflict(parent_abspath, cd->their_file,
+ local_abspath, scratch_pool));
+ SVN_ERR(maybe_remove_conflict(parent_abspath, cd->my_file,
+ local_abspath, scratch_pool));
+ SVN_ERR(maybe_remove_conflict(parent_abspath, cd->merged_file,
+ local_abspath, scratch_pool));
+ }
+ }
+
+ /* Reverting the actual node destroys conflict markers and local props.
+ Don't use svn_wc__db_op_set_props() and svn_wc__db_op_mark_resolved()
+ because those leave a record in the ACTUALS table, which is a
+ performance issue. Besides, this does all that in one blow. */
+ SVN_ERR(svn_wc__db_op_revert_actual(db, local_abspath, scratch_pool));
/* Deal with the working file, as needed. */
if (kind == svn_wc__db_kind_file)
@@ -224,18 +259,8 @@ run_revert(svn_wc__db_t *db,
using the original base. */
reinstall_working = magic_changed || replaced;
- /* ### This "if (replaced)" looks very likely to be an artifact of the
- old WC-1 "revert-base and normal-base" system, and if so then it
- should go away. */
- if (replaced)
- {
- /* With the Pristine Store, there is no longer a "revert-base"
- text that needs to be moved to a "normal text-base" location.
-
- ### JAF: I wonder why the "revert-base" properties weren't being
- handled the same way in this same code path. An oversight? */
- }
- else if (!reinstall_working)
+ if (!replaced && !reinstall_working)
+ /* check for additional scenarios which need the actual re-installed */
{
svn_node_kind_t check_kind;
@@ -305,41 +330,6 @@ run_revert(svn_wc__db_t *db,
SVN_ERR(svn_io_dir_make(local_abspath, APR_OS_DEFAULT, scratch_pool));
}
- if (kind == svn_wc__db_kind_dir)
- parent_abspath = local_abspath;
- else
- parent_abspath = svn_dirent_dirname(local_abspath, scratch_pool);
-
- /* ### in wc-ng: the following block clears ACTUAL_NODE. */
- if (conflicted)
- {
- const apr_array_header_t *conflicts;
- int i;
-
- SVN_ERR(svn_wc__db_read_conflicts(&conflicts, db, local_abspath,
- scratch_pool, scratch_pool));
-
- for (i = 0; i < conflicts->nelts; i++)
- {
- const svn_wc_conflict_description2_t *cd;
-
- cd = APR_ARRAY_IDX(conflicts, i,
- const svn_wc_conflict_description2_t *);
-
- SVN_ERR(maybe_remove_conflict(parent_abspath, cd->base_file,
- local_abspath, scratch_pool));
- SVN_ERR(maybe_remove_conflict(parent_abspath, cd->their_file,
- local_abspath, scratch_pool));
- SVN_ERR(maybe_remove_conflict(parent_abspath, cd->my_file,
- local_abspath, scratch_pool));
- SVN_ERR(maybe_remove_conflict(parent_abspath, cd->merged_file,
- local_abspath, scratch_pool));
- }
-
- SVN_ERR(svn_wc__db_op_mark_resolved(db, local_abspath,
- TRUE, TRUE, FALSE,
- scratch_pool));
- }
{
svn_boolean_t is_wc_root;