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/10/28 14:13:28 UTC
svn commit: r1028271 - in /subversion/trunk/subversion/libsvn_wc: copy.c
wc_db.c wc_db.h
Author: julianfoad
Date: Thu Oct 28 12:13:27 2010
New Revision: 1028271
URL: http://svn.apache.org/viewvc?rev=1028271&view=rev
Log:
A follow-up to r1027851 which implemented op-depth for copies in
SVN_WC__OP_DEPTH builds. The new function svn_wc__db_op_copy_tree() failed
to handle cross-DB copies recursively. Stop trying to handle them here.
Instead, let the caller find out that it's a cross-DB copy and use its old
code path for that.
* subversion/libsvn_wc/copy.c
(copy_versioned_file, copy_versioned_dir): Include these functions in
SVN_WC__OP_DEPTH builds.
(svn_wc_copy3): Use the old code path for cross-DB copies.
* subversion/libsvn_wc/wc_db.c
(svn_wc__db_same_db): New function.
(svn_wc__db_op_copy_tree): Don't attempt to handle a cross-DB copy.
* subversion/libsvn_wc/wc_db.h
(svn_wc__db_same_db): New function.
(svn_wc__db_op_copy_tree): Expand the doc string.
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=1028271&r1=1028270&r2=1028271&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/copy.c (original)
+++ subversion/trunk/subversion/libsvn_wc/copy.c Thu Oct 28 12:13:27 2010
@@ -120,7 +120,6 @@ copy_to_tmpdir(const char **dst_abspath,
}
-#ifndef SVN_WC__OP_DEPTH
/* If SRC_ABSPATH and DST_ABSPATH use different pristine stores, copy the
pristine text of SRC_ABSPATH (if there is one) into the pristine text
store connected to DST_ABSPATH. This will only happen when copying into
@@ -432,7 +431,6 @@ copy_versioned_dir(svn_wc__db_t *db,
return SVN_NO_ERROR;
}
-#endif
#ifdef SVN_WC__OP_DEPTH
@@ -562,7 +560,7 @@ svn_wc_copy3(svn_wc_context_t *wc_ctx,
svn_wc__db_t *db = wc_ctx->db;
svn_wc__db_kind_t src_db_kind;
const char *dstdir_abspath;
-
+
SVN_ERR_ASSERT(svn_dirent_is_absolute(src_abspath));
SVN_ERR_ASSERT(svn_dirent_is_absolute(dst_abspath));
@@ -714,12 +712,16 @@ svn_wc_copy3(svn_wc_context_t *wc_ctx,
}
#ifdef SVN_WC__OP_DEPTH
- SVN_ERR(copy_versioned_node(db, src_abspath, dst_abspath,
- metadata_only,
- cancel_func, cancel_baton,
- notify_func, notify_baton,
- scratch_pool));
-#else
+ if (svn_wc__db_same_db(db, src_abspath, dst_abspath, scratch_pool))
+ {
+ SVN_ERR(copy_versioned_node(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)
{
@@ -735,7 +737,6 @@ svn_wc_copy3(svn_wc_context_t *wc_ctx,
notify_func, notify_baton,
scratch_pool));
}
-#endif
return SVN_NO_ERROR;
}
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1028271&r1=1028270&r2=1028271&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Thu Oct 28 12:13:27 2010
@@ -3043,6 +3043,38 @@ 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,
@@ -3206,22 +3238,17 @@ svn_wc__db_op_copy_tree(svn_wc__db_t *db
b.work_items = work_items;
- if (b.src_pdh->wcroot == b.dst_pdh->wcroot)
- {
- /* ASSERT(presence == normal) */
+ 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));
+ SVN_ERR(svn_sqlite__with_transaction(b.dst_pdh->wcroot->sdb,
+ db_op_copy_tree, &b, scratch_pool));
- /* ### Do we need to flush entries?
- * SVN_ERR(flush_entries(db, b.dst_pdh, dst_abspath, scratch_pool)); */
- }
- else
- {
- /* Cross-DB copy */
- SVN_ERR(db_op_copy(b.src_pdh, b.src_relpath, b.dst_pdh, b.dst_relpath,
- b.work_items, 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;
}
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=1028271&r1=1028270&r2=1028271&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Thu Oct 28 12:13:27 2010
@@ -1010,9 +1010,26 @@ 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, both in DB. The parent of DST_ABSPATH must be a versioned
- * directory.
+ * 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 *