You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2011/07/26 18:51:25 UTC
svn commit: r1151166 - in /subversion/trunk/subversion:
include/private/svn_wc_private.h libsvn_wc/adm_ops.c libsvn_wc/copy.c
libsvn_wc/update_editor.c libsvn_wc/wc-queries.sql libsvn_wc/wc_db.c
libsvn_wc/wc_db.h tests/libsvn_wc/op-depth-test.c
Author: stsp
Date: Tue Jul 26 16:51:23 2011
New Revision: 1151166
URL: http://svn.apache.org/viewvc?rev=1151166&view=rev
Log:
Record moved-to information at the delete-half of a move.
* subversion/include/private/svn_wc_private.h
(svn_wc__delete_internal): Declare.
* subversion/libsvn_wc/adm_ops.c
(svn_wc__delete_internal): New. This is like svn_wc_delete4() but has
one additional parameter MOVED_TO_ABSPATH. If not NULL, this indicates
that the delete is the delete-half of a move.
(svn_wc_delete4): Reimplement as a wrapper around svn_wc__delete_internal().
* subversion/libsvn_wc/wc-queries.sql
(STMT_INSERT_DELETE_FROM_NODE_RECURSIVE): Adjust to only insert children
of the node being deleted.
(STMT_INSERT_DELETE_NODE): New. This statement deletes a single node,
and allows populating the moved_to column in NODES.
* subversion/libsvn_wc/copy.c
(svn_wc_move): Call svn_wc__delete_internal() with a MOVED_TO_ABSPATH
instead of calling svn_wc_delete4().
* subversion/libsvn_wc/wc_db.c
(op_delete_baton_t): Add new field MOVED_TO_RELPATH.
(op_delete_txn): Use STMT_INSERT_DELETE_NODE to delete LOCAL_ABSPATH
itself, and possibly mark LOCAL_ABSPATH has having been moved elsewhere.
Use STMT_INSERT_DELETE_FROM_NODE_RECURSIVE to delete children of
LOCAL_ABSPATH (before, this statement was also used to delete LOCAL_ABSPATH
itself).
(svn_wc__db_op_delete): New parameter MOVED_TO_ABSPATH. Convert this to
a relpath and put that into the op_delete baton.
(scan_deletion_txn): Update a comment that referred to the BASE_NODE table.
This is now called NODES_BASE in the query this code is evaluating.
* subversion/libsvn_wc/wc_db.h
(svn_wc__db_op_delete): Add MOVED_TO_ABSPATH parameter and update docstring.
* subversion/tests/libsvn_wc/op-depth-test.c,
subversion/libsvn_wc/update_editor.c
(do_delete, add_directory): Adjust calls to svn_wc__db_op_delete().
Modified:
subversion/trunk/subversion/include/private/svn_wc_private.h
subversion/trunk/subversion/libsvn_wc/adm_ops.c
subversion/trunk/subversion/libsvn_wc/copy.c
subversion/trunk/subversion/libsvn_wc/update_editor.c
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/tests/libsvn_wc/op-depth-test.c
Modified: subversion/trunk/subversion/include/private/svn_wc_private.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_wc_private.h?rev=1151166&r1=1151165&r2=1151166&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_wc_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_wc_private.h Tue Jul 26 16:51:23 2011
@@ -1096,6 +1096,21 @@ svn_wc__get_info(svn_wc_context_t *wc_ct
void *cancel_baton,
apr_pool_t *scratch_pool);
+/* Internal version of svn_wc_delete4(). It has one additional parameter,
+ * MOVED_TO_ABSPATH. If not NULL, this parameter indicates that the
+ * delete operation is the delete-half of a move. */
+svn_error_t *
+svn_wc__delete_internal(svn_wc_context_t *wc_ctx,
+ const char *local_abspath,
+ svn_boolean_t keep_local,
+ svn_boolean_t delete_unversioned_target,
+ const char *moved_to_abspath,
+ svn_cancel_func_t cancel_func,
+ void *cancel_baton,
+ svn_wc_notify_func2_t notify_func,
+ void *notify_baton,
+ apr_pool_t *scratch_pool);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
Modified: subversion/trunk/subversion/libsvn_wc/adm_ops.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_ops.c?rev=1151166&r1=1151165&r2=1151166&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_ops.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_ops.c Tue Jul 26 16:51:23 2011
@@ -595,15 +595,16 @@ erase_unversioned_from_wc(const char *pa
svn_error_t *
-svn_wc_delete4(svn_wc_context_t *wc_ctx,
- const char *local_abspath,
- svn_boolean_t keep_local,
- svn_boolean_t delete_unversioned_target,
- svn_cancel_func_t cancel_func,
- void *cancel_baton,
- svn_wc_notify_func2_t notify_func,
- void *notify_baton,
- apr_pool_t *scratch_pool)
+svn_wc__delete_internal(svn_wc_context_t *wc_ctx,
+ const char *local_abspath,
+ svn_boolean_t keep_local,
+ svn_boolean_t delete_unversioned_target,
+ const char *moved_to_abspath,
+ svn_cancel_func_t cancel_func,
+ void *cancel_baton,
+ svn_wc_notify_func2_t notify_func,
+ void *notify_baton,
+ apr_pool_t *scratch_pool)
{
apr_pool_t *pool = scratch_pool;
svn_wc__db_t *db = wc_ctx->db;
@@ -670,7 +671,7 @@ svn_wc_delete4(svn_wc_context_t *wc_ctx,
SVN_ERR(svn_wc__db_read_conflicts(&conflicts, db, local_abspath,
scratch_pool, scratch_pool));
- SVN_ERR(svn_wc__db_op_delete(db, local_abspath,
+ SVN_ERR(svn_wc__db_op_delete(db, local_abspath, moved_to_abspath,
notify_func, notify_baton,
cancel_func, cancel_baton,
pool));
@@ -726,6 +727,26 @@ svn_wc_delete4(svn_wc_context_t *wc_ctx,
return SVN_NO_ERROR;
}
+svn_error_t *
+svn_wc_delete4(svn_wc_context_t *wc_ctx,
+ const char *local_abspath,
+ svn_boolean_t keep_local,
+ svn_boolean_t delete_unversioned_target,
+ svn_cancel_func_t cancel_func,
+ void *cancel_baton,
+ svn_wc_notify_func2_t notify_func,
+ void *notify_baton,
+ apr_pool_t *scratch_pool)
+{
+ return svn_error_trace(svn_wc__delete_internal(wc_ctx, local_abspath,
+ keep_local,
+ delete_unversioned_target,
+ NULL,
+ cancel_func, cancel_baton,
+ notify_func, notify_baton,
+ scratch_pool));
+}
+
/* Schedule the single node at LOCAL_ABSPATH, of kind KIND, for addition in
* its parent directory in the WC. It will have no properties. */
Modified: subversion/trunk/subversion/libsvn_wc/copy.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/copy.c?rev=1151166&r1=1151165&r2=1151166&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/copy.c (original)
+++ subversion/trunk/subversion/libsvn_wc/copy.c Tue Jul 26 16:51:23 2011
@@ -991,10 +991,11 @@ svn_wc_move(svn_wc_context_t *wc_ctx,
scratch_pool));
}
- SVN_ERR(svn_wc_delete4(wc_ctx, src_abspath, TRUE, FALSE,
- cancel_func, cancel_baton,
- notify_func, notify_baton,
- scratch_pool));
+ SVN_ERR(svn_wc__delete_internal(wc_ctx, src_abspath, TRUE, FALSE,
+ dst_abspath,
+ cancel_func, cancel_baton,
+ notify_func, notify_baton,
+ scratch_pool));
return SVN_NO_ERROR;
}
Modified: subversion/trunk/subversion/libsvn_wc/update_editor.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/update_editor.c?rev=1151166&r1=1151165&r2=1151166&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/update_editor.c Tue Jul 26 16:51:23 2011
@@ -2208,7 +2208,7 @@ add_directory(const char *path,
### to theirs with 'svn revert'. */
if (db->shadowed && db->obstruction_found)
{
- SVN_ERR(svn_wc__db_op_delete(eb->db, db->local_abspath,
+ SVN_ERR(svn_wc__db_op_delete(eb->db, db->local_abspath, NULL,
NULL, NULL /* notification */,
eb->cancel_func, eb->cancel_baton,
pool));
Modified: subversion/trunk/subversion/libsvn_wc/wc-queries.sql
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc-queries.sql?rev=1151166&r1=1151165&r2=1151166&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Tue Jul 26 16:51:23 2011
@@ -811,8 +811,18 @@ SELECT wc_id, local_relpath, ?4 /*op_dep
kind
FROM nodes
WHERE wc_id = ?1
- AND (local_relpath = ?2
- OR (local_relpath > ?2 || '/' AND local_relpath < ?2 || '0'))
+ AND (local_relpath > ?2 || '/' AND local_relpath < ?2 || '0')
+ AND op_depth = ?3
+ AND presence NOT IN ('base-deleted', 'not-present', 'excluded', 'absent')
+
+-- STMT_INSERT_DELETE_NODE
+INSERT INTO nodes (
+ wc_id, local_relpath, op_depth, parent_relpath, presence, kind, moved_to)
+SELECT wc_id, local_relpath, ?4 /*op_depth*/, parent_relpath, 'base-deleted',
+ kind, ?5 /* moved_to */
+FROM nodes
+WHERE wc_id = ?1
+ AND local_relpath = ?2
AND op_depth = ?3
AND presence NOT IN ('base-deleted', 'not-present', 'excluded', 'absent')
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1151166&r1=1151165&r2=1151166&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Tue Jul 26 16:51:23 2011
@@ -6015,6 +6015,7 @@ info_below_working(svn_boolean_t *have_b
struct op_delete_baton_t {
apr_int64_t delete_depth; /* op-depth for root of delete */
+ const char *moved_to_relpath; /* NULL if delete is not part of a move */
};
static svn_error_t *
@@ -6128,6 +6129,22 @@ op_delete_txn(void *baton,
if (add_work)
{
+ /* Delete the node at LOCAL_RELPATH, and possibly mark it as moved. */
+ SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
+ STMT_INSERT_DELETE_NODE));
+ if (b->moved_to_relpath)
+ SVN_ERR(svn_sqlite__bindf(stmt, "isiis",
+ wcroot->wc_id, local_relpath,
+ select_depth, b->delete_depth,
+ b->moved_to_relpath));
+ else
+ SVN_ERR(svn_sqlite__bindf(stmt, "isii",
+ wcroot->wc_id, local_relpath,
+ select_depth, b->delete_depth));
+
+ SVN_ERR(svn_sqlite__step_done(stmt));
+
+ /* Delete children, if any. */
SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
STMT_INSERT_DELETE_FROM_NODE_RECURSIVE));
SVN_ERR(svn_sqlite__bindf(stmt, "isii",
@@ -6190,6 +6207,7 @@ do_delete_notify(void *baton,
svn_error_t *
svn_wc__db_op_delete(svn_wc__db_t *db,
const char *local_abspath,
+ const char *moved_to_abspath,
svn_wc_notify_func2_t notify_func,
void *notify_baton,
svn_cancel_func_t cancel_func,
@@ -6197,7 +6215,9 @@ svn_wc__db_op_delete(svn_wc__db_t *db,
apr_pool_t *scratch_pool)
{
svn_wc__db_wcroot_t *wcroot;
+ svn_wc__db_wcroot_t *moved_to_wcroot;
const char *local_relpath;
+ const char *moved_to_relpath;
struct op_delete_baton_t odb;
SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
@@ -6206,8 +6226,30 @@ svn_wc__db_op_delete(svn_wc__db_t *db,
db, local_abspath,
scratch_pool, scratch_pool));
VERIFY_USABLE_WCROOT(wcroot);
+
+ if (moved_to_abspath)
+ {
+ SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&moved_to_wcroot,
+ &moved_to_relpath,
+ db, moved_to_abspath,
+ scratch_pool,
+ scratch_pool));
+ VERIFY_USABLE_WCROOT(moved_to_wcroot);
+
+ if (wcroot->wc_id != moved_to_wcroot->wc_id)
+ return svn_error_createf(SVN_ERR_UNSUPPORTED_FEATURE, NULL,
+ _("Cannot move '%s' to '%s' because they "
+ "are not in the same working copy"),
+ svn_dirent_local_style(local_abspath,
+ scratch_pool),
+ svn_dirent_local_style(moved_to_abspath,
+ scratch_pool));
+ }
+ else
+ moved_to_relpath = NULL;
odb.delete_depth = relpath_depth(local_relpath);
+ odb.moved_to_relpath = moved_to_relpath;
SVN_ERR(flush_entries(wcroot, local_abspath, svn_depth_infinity,
scratch_pool));
@@ -9369,7 +9411,7 @@ scan_deletion_txn(void *baton,
|| work_presence == svn_wc__db_status_base_deleted);
have_base = !svn_sqlite__column_is_null(stmt,
- 0 /* BASE_NODE.presence */);
+ 0 /* NODES_BASE.presence */);
if (have_base)
{
svn_wc__db_status_t base_presence
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=1151166&r1=1151165&r2=1151166&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Tue Jul 26 16:51:23 2011
@@ -1413,6 +1413,9 @@ svn_wc__db_temp_working_set_props(svn_wc
/* Mark LOCAL_ABSPATH, and all children, for deletion.
*
+ * If MOVED_TO_ABSPATH is not NULL, mark the deletion of LOCAL_ABSPATH
+ * as the delete-half of a move from LOCAL_ABSPATH to MOVED_TO_ABSPATH.
+ *
* If NOTIFY_FUNC is not NULL, then it will be called (with NOTIFY_BATON)
* for each node deleted. While this processing occurs, if CANCEL_FUNC is
* not NULL, then it will be called (with CANCEL_BATON) to detect cancellation
@@ -1424,6 +1427,7 @@ svn_wc__db_temp_working_set_props(svn_wc
svn_error_t *
svn_wc__db_op_delete(svn_wc__db_t *db,
const char *local_abspath,
+ const char *moved_to_abspath,
/* ### flip to CANCEL, then NOTIFY. precedent. */
svn_wc_notify_func2_t notify_func,
void *notify_baton,
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=1151166&r1=1151165&r2=1151166&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c Tue Jul 26 16:51:23 2011
@@ -2785,7 +2785,7 @@ do_delete(svn_test__sandbox_t *b,
SVN_ERR(insert_actual(b, actual_before));
SVN_ERR(check_db_rows(b, "", before));
SVN_ERR(check_db_actual(b, actual_before));
- SVN_ERR(svn_wc__db_op_delete(b->wc_ctx->db, local_abspath,
+ SVN_ERR(svn_wc__db_op_delete(b->wc_ctx->db, local_abspath, NULL,
NULL, NULL /* notification */,
NULL, NULL /* cancellation */,
b->pool));