You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2010/11/25 17:09:39 UTC
svn commit: r1039081 - in /subversion/trunk/subversion/libsvn_wc: copy.c
wc_db.c wc_db.h
Author: julianfoad
Date: Thu Nov 25 16:09:39 2010
New Revision: 1039081
URL: http://svn.apache.org/viewvc?rev=1039081&view=rev
Log:
Remove the WC-to-WC copy code that I added in r1027851 and disabled in
r1038999. We could try this all-in-one approach again in the future as an
optimization, but for now it is not needed.
* subversion/libsvn_wc/copy.c
(copy_versioned_tree): Remove.
(svn_wc_copy3): Remove the already disabled call to copy_versioned_tree().
* subversion/libsvn_wc/wc_db.c
(copy_nodes_rows, copy_actual_rows, copy_tree_baton_t, db_op_copy_tree,
svn_wc__db_same_db, svn_wc__db_op_copy_tree): Remove.
* subversion/libsvn_wc/wc_db.h
(svn_wc__db_same_db, svn_wc__db_op_copy_tree): Remove.
Modified:
subversion/trunk/subversion/libsvn_wc/copy.c
subversion/trunk/subversion/libsvn_wc/wc_db.c
subversion/trunk/subversion/libsvn_wc/wc_db.h
Modified: subversion/trunk/subversion/libsvn_wc/copy.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/copy.c?rev=1039081&r1=1039080&r2=1039081&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/copy.c (original)
+++ subversion/trunk/subversion/libsvn_wc/copy.c Thu Nov 25 16:09:39 2010
@@ -442,120 +442,6 @@ copy_versioned_dir(svn_wc__db_t *db,
}
-#ifdef SVN_WC__OP_DEPTH
-/*
-A plan for copying a versioned node, recursively, with proper op-depths.
-
-Each DB change mentioned in a separate step is intended to change the WC
-from one valid state to another and must be exectuted within a DB txn.
-Several such changes can be batched together in a bigger txn if we don't
-want clients to be able to see intermediate states.
-
-TODO: We will probably want to notify all copied paths rather than just the
- root path, some time in the future. It may be difficult to get the list
- of visited paths directly, because the metadata copying is performed
- within a single SQL statement. We could walk the destination tree after
- copying, taking care to include any 'excluded' nodes but ignore any
- 'deleted' paths that may be left over from a replaced sub-tree.
-
-copy_versioned_tree:
- # Copy a versioned file/dir SRC_PATH to DST_PATH, recursively.
-
- # This function takes care to copy both the metadata tree and the disk
- # tree as they are, even if they are different node kinds and so different
- # tree shapes.
-
- src_op_depth = working_op_depth_of(src_path)
- src_depth = relpath_depth(src_path)
- dst_depth = relpath_depth(dst_path)
-
- # The source tree has in the NODES table, by design:
- # - zero or more rows below SRC_OP_DEPTH (these are uninteresting);
- # - one or more rows at SRC_OP_DEPTH;
- # - no rows with SRC_OP_DEPTH < row.op_depth <= SRC_DEPTH;
- # - zero or more rows above SRC_DEPTH (modifications);
- # and SRC_OP_DEPTH <= SRC_DEPTH.
-
- Copy single NODES row from src_path@src_op_depth to dst_path@dst_depth.
- Copy all rows of descendent paths in == src_op_depth to == dst_depth.
- Copy all rows of descendent paths in > src_depth to > dst_depth,
- adjusting op_depth by (dst_depth - src_depth).
-
- Copy disk node recursively (if it exists, and whatever its kind).
- Copy ACTUAL_NODE rows (props and any other actual metadata).
-
- # ### Are there no scenarios in which we would want to decrease dst_depth
- # and so subsume the destination into an existing op? I guess not.
-
-*/
-
-/* Copy the working version of the versioned tree at SRC_ABSPATH to
- * DST_ABSPATH, recursively. If METADATA_ONLY is true, then don't copy it
- * on disk, only in metadata, and don't care whether it already exists on
- * disk. */
-static svn_error_t *
-copy_versioned_tree(svn_wc__db_t *db,
- const char *src_abspath,
- const char *dst_abspath,
- svn_boolean_t metadata_only,
- 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_skel_t *work_item = NULL;
-
- /* Prepare a copy of the on-disk tree (if it exists, and whatever its kind),
- * in a temporary location. */
- if (! metadata_only)
- {
- const char *tmpdir_abspath;
- const char *tmp_dst_abspath;
- svn_node_kind_t kind;
-
- SVN_ERR(svn_wc__db_temp_wcroot_tempdir(&tmpdir_abspath, db, dst_abspath,
- scratch_pool, scratch_pool));
-
- SVN_ERR(copy_to_tmpdir(&tmp_dst_abspath, &kind, src_abspath,
- tmpdir_abspath,
- TRUE, /* recursive */
- cancel_func, cancel_baton,
- scratch_pool));
- if (tmp_dst_abspath)
- {
- SVN_ERR(svn_wc__wq_build_file_move(&work_item, db,
- tmp_dst_abspath, dst_abspath,
- scratch_pool, scratch_pool));
- }
- }
-
- /* Copy single NODES row from src_path@src_op_depth to dst_path@dst_depth. */
- /* Copy all rows of descendent paths in == src_op_depth to == dst_depth. */
- /* Copy all rows of descendent paths in > src_depth to > dst_depth,
- adjusting op_depth by (dst_depth - src_depth). */
- /* Copy ACTUAL_NODE rows (props and any other actual metadata). */
- SVN_ERR(svn_wc__db_op_copy_tree(db, src_abspath, dst_abspath,
- work_item, scratch_pool));
-
- SVN_ERR(svn_wc__wq_run(db, dst_abspath, cancel_func, cancel_baton,
- scratch_pool));
-
- /* Notify */
- if (notify_func)
- {
- svn_wc_notify_t *notify
- = svn_wc_create_notify(dst_abspath, svn_wc_notify_add,
- scratch_pool);
- notify->kind = svn_node_dir;
- (*notify_func)(notify_baton, notify, scratch_pool);
- }
-
- return SVN_NO_ERROR;
-}
-#endif
-
-
/* Public Interface */
svn_error_t *
@@ -723,17 +609,6 @@ svn_wc_copy3(svn_wc_context_t *wc_ctx,
scratch_pool));
}
-#if 0 /* was: #ifdef SVN_WC__OP_DEPTH */
- if (svn_wc__db_same_db(db, src_abspath, dst_abspath, scratch_pool))
- {
- SVN_ERR(copy_versioned_tree(db, src_abspath, dst_abspath,
- metadata_only,
- cancel_func, cancel_baton,
- notify_func, notify_baton,
- scratch_pool));
- }
- else
-#endif
if (src_db_kind == svn_wc__db_kind_file
|| src_db_kind == svn_wc__db_kind_symlink)
{
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1039081&r1=1039080&r2=1039081&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Thu Nov 25 16:09:39 2010
@@ -3182,38 +3182,6 @@ svn_wc__db_op_copy(svn_wc__db_t *db,
return SVN_NO_ERROR;
}
-svn_boolean_t
-svn_wc__db_same_db(svn_wc__db_t *db,
- const char *src_abspath,
- const char *dst_abspath,
- apr_pool_t *scratch_pool)
-{
- svn_error_t *err;
- svn_wc__db_pdh_t *src_pdh, *dst_pdh;
- const char *src_relpath, *dst_relpath;
-
- err = svn_wc__db_pdh_parse_local_abspath(&src_pdh, &src_relpath, db,
- src_abspath,
- svn_sqlite__mode_readonly,
- scratch_pool, scratch_pool);
- if (err)
- {
- src_pdh = NULL;
- svn_error_clear(err);
- }
- err = svn_wc__db_pdh_parse_local_abspath(&dst_pdh, &dst_relpath, db,
- dst_abspath,
- svn_sqlite__mode_readonly,
- scratch_pool, scratch_pool);
- if (err)
- {
- dst_pdh = NULL;
- svn_error_clear(err);
- }
-
- return (src_pdh && dst_pdh && src_pdh->wcroot == dst_pdh->wcroot);
-}
-
/* Set *OP_DEPTH to the highest op depth of PDH:LOCAL_RELPATH. */
static svn_error_t *
op_depth_of(apr_int64_t *op_depth,
@@ -3267,169 +3235,6 @@ catch_copy_of_absent(svn_wc__db_pdh_t *p
}
-/*
- * Copy single NODES row from src_path@src_op_depth to dst_path@dst_depth.
- * Copy all rows of descendent paths in == src_op_depth to == dst_depth.
- * Copy all rows of descendent paths in > src_depth to > dst_depth,
- * adjusting op_depth by (dst_depth - src_depth).
- *
- * ### TODO: Return a list of copied nodes. */
-static svn_error_t *
-copy_nodes_rows(svn_wc__db_pdh_t *src_pdh,
- const char *src_relpath,
- svn_wc__db_pdh_t *dst_pdh,
- const char *dst_relpath,
- apr_pool_t *scratch_pool)
-{
- apr_int64_t src_op_depth;
- apr_int64_t src_depth = relpath_depth(src_relpath);
- apr_int64_t dst_depth = relpath_depth(dst_relpath);
- svn_sqlite__stmt_t *stmt;
- const char *dst_parent_relpath = svn_relpath_dirname(dst_relpath,
- scratch_pool);
-
- SVN_ERR(op_depth_of(&src_op_depth, src_pdh, src_relpath));
-
- if (src_op_depth == 0)
- SVN_ERR(catch_copy_of_absent(src_pdh, src_relpath, scratch_pool));
-
- /* Root node */
- SVN_ERR(svn_sqlite__get_statement(&stmt, src_pdh->wcroot->sdb,
- STMT_COPY_NODES_ROW));
- SVN_ERR(svn_sqlite__bindf(stmt, "isissi",
- src_pdh->wcroot->wc_id,
- src_relpath,
- src_op_depth,
- dst_relpath,
- dst_parent_relpath,
- dst_depth));
- SVN_ERR(svn_sqlite__step_done(stmt));
-
- /* Descendants at same depth */
- SVN_ERR(svn_sqlite__get_statement(&stmt, src_pdh->wcroot->sdb,
- STMT_COPY_NODES_AT_SAME_OP_DEPTH));
- SVN_ERR(svn_sqlite__bindf(stmt, "isisii",
- src_pdh->wcroot->wc_id,
- construct_like_arg(src_relpath, scratch_pool),
- src_op_depth,
- dst_relpath,
- dst_depth,
- (apr_int64_t)(strlen(src_relpath) + 1)));
- SVN_ERR(svn_sqlite__step_done(stmt));
-
- /* Descendants at greater depths */
- SVN_ERR(svn_sqlite__get_statement(&stmt, src_pdh->wcroot->sdb,
- STMT_COPY_NODES_AT_GREATER_OP_DEPTH));
- SVN_ERR(svn_sqlite__bindf(stmt, "isisii",
- src_pdh->wcroot->wc_id,
- construct_like_arg(src_relpath, scratch_pool),
- src_depth,
- dst_relpath,
- dst_depth,
- (apr_int64_t)(strlen(src_relpath) + 1)));
- SVN_ERR(svn_sqlite__step_done(stmt));
-
- return SVN_NO_ERROR;
-}
-
-/* */
-static svn_error_t *
-copy_actual_rows(svn_wc__db_pdh_t *src_pdh,
- const char *src_relpath,
- svn_wc__db_pdh_t *dst_pdh,
- const char *dst_relpath,
- apr_pool_t *scratch_pool)
-{
- svn_sqlite__stmt_t *stmt;
- const char *src_parent_relpath = svn_relpath_dirname(src_relpath,
- scratch_pool);
- const char *dst_parent_relpath = svn_relpath_dirname(dst_relpath,
- scratch_pool);
-
- /* ### Copying changelist is OK for a move but what about a copy? */
- SVN_ERR(svn_sqlite__get_statement(&stmt, dst_pdh->wcroot->sdb,
- STMT_COPY_ACTUAL_NODE_ROWS));
- SVN_ERR(svn_sqlite__bindf(stmt, "issssii",
- src_pdh->wcroot->wc_id, src_relpath,
- construct_like_arg(src_relpath, scratch_pool),
- dst_relpath, dst_parent_relpath,
- (apr_int64_t)(strlen(src_relpath) + 1),
- (apr_int64_t)(strlen(src_parent_relpath) + 1)));
- SVN_ERR(svn_sqlite__step_done(stmt));
-
- return SVN_NO_ERROR;
-}
-
-
-struct copy_tree_baton_t
-{
- svn_wc__db_pdh_t *src_pdh, *dst_pdh;
- const char *src_relpath, *dst_relpath;
- const svn_skel_t *work_items;
-};
-
-/* */
-static svn_error_t *
-db_op_copy_tree(void *baton,
- svn_sqlite__db_t *sdb,
- apr_pool_t *scratch_pool)
-{
- struct copy_tree_baton_t *b = baton;
-
- SVN_ERR(copy_nodes_rows(b->src_pdh, b->src_relpath,
- b->dst_pdh, b->dst_relpath,
- scratch_pool));
-
- SVN_ERR(copy_actual_rows(b->src_pdh, b->src_relpath,
- b->dst_pdh, b->dst_relpath,
- scratch_pool));
-
- SVN_ERR(add_work_items(b->dst_pdh->wcroot->sdb, b->work_items, scratch_pool));
-
- return SVN_NO_ERROR;
-}
-
-svn_error_t *
-svn_wc__db_op_copy_tree(svn_wc__db_t *db,
- const char *src_abspath,
- const char *dst_abspath,
- const svn_skel_t *work_items,
- apr_pool_t *scratch_pool)
-{
- struct copy_tree_baton_t b;
- SVN_ERR_ASSERT(svn_dirent_is_absolute(src_abspath));
- SVN_ERR_ASSERT(svn_dirent_is_absolute(dst_abspath));
-
- SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&b.src_pdh, &b.src_relpath, db,
- src_abspath,
- svn_sqlite__mode_readwrite,
- scratch_pool, scratch_pool));
- VERIFY_USABLE_PDH(b.src_pdh);
-
- SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&b.dst_pdh, &b.dst_relpath, db,
- dst_abspath,
- svn_sqlite__mode_readwrite,
- scratch_pool, scratch_pool));
- VERIFY_USABLE_PDH(b.dst_pdh);
-
- b.work_items = work_items;
-
- SVN_ERR_ASSERT(b.src_pdh->wcroot == b.dst_pdh->wcroot);
- /* ASSERT(presence == normal) */
-
- SVN_ERR(svn_sqlite__with_transaction(b.dst_pdh->wcroot->sdb,
- db_op_copy_tree, &b, scratch_pool));
-
- /* ### Do we sometimes need to elide copy-from info and/or other fields on
- * the destination root node? See elide_copyfrom(). */
-
- /* ### Do we need to flush entries?
- * SVN_ERR(flush_entries(db, b.dst_pdh, dst_abspath, scratch_pool)); */
-
- return SVN_NO_ERROR;
-}
-
-
/* If COPYFROM_REPOS_ID+COPYFROM_RELPATH+COPYFROM_REVISION "match" the copyfrom
information for the parent of LOCAL_RELPATH then set *OP_DEPTH to
the op_depth of the parent, otherwise set *OP_DEPTH to the op_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=1039081&r1=1039080&r2=1039081&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Thu Nov 25 16:09:39 2010
@@ -1011,35 +1011,6 @@ svn_wc__db_pristine_repair(svn_wc__db_t
@{
*/
-/* Return TRUE if SRC_ABSPATH and DST_ABSPATH are versioned paths in the
- * same DB; FALSE otherwise. */
-svn_boolean_t
-svn_wc__db_same_db(svn_wc__db_t *db,
- const char *src_abspath,
- const char *dst_abspath,
- apr_pool_t *scratch_pool);
-
-/* Copy the tree at SRC_ABSPATH (in NODES and ACTUAL_NODE tables) to
- * DST_ABSPATH.
- *
- * SRC_ABSPATH and DST_ABSPATH must be in the same WC. SRC_ABSPATH must
- * exist, and must not be excluded/absent/not-present. The parent of
- * DST_ABSPATH must be a versioned directory. DST_ABSPATH must be in a
- * state suitable for creating a new node: nonexistent or deleted.
- *
- * Preserve changelist associations in the copy. Preserve all node states
- * including excluded/absent/not-present.
- *
- * Copy the metadata only: do not look at or copy the nodes on disk.
- *
- * Add WORK_ITEMS to the work queue. */
-svn_error_t *
-svn_wc__db_op_copy_tree(svn_wc__db_t *db,
- const char *src_abspath,
- const char *dst_abspath,
- const svn_skel_t *work_items,
- apr_pool_t *scratch_pool);
-
/* Copy the node at SRC_ABSPATH (in NODES and ACTUAL_NODE tables) to
* DST_ABSPATH, both in DB but not necessarily in the same WC. The parent
* of DST_ABSPATH must be a versioned directory.