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/08 19:18:16 UTC
svn commit: r1032657 - in /subversion/trunk/subversion: libsvn_wc/copy.c
libsvn_wc/wc_db.c libsvn_wc/wc_db.h tests/libsvn_wc/op-depth-test.c
Author: julianfoad
Date: Mon Nov 8 18:18:16 2010
New Revision: 1032657
URL: http://svn.apache.org/viewvc?rev=1032657&view=rev
Log:
Implement op-depth for repo-to-WC copies, if SVN_WC__OP_DEPTH is defined.
Makes op-depth-test 7 pass.
* subversion/libsvn_wc/copy.c
(copy_versioned_file, copy_versioned_dir): Take a destination op-root
parameter and pass it on to svn_wc__db_op_copy().
(svn_wc_copy3): Pass dst_abspath as destination op-root.
* subversion/libsvn_wc/wc_db.h
(svn_wc__db_op_copy): Take a destination op-root parameter.
* subversion/libsvn_wc/wc_db.c
(cross_db_copy, db_op_copy): Take a destination op-depth parameter and use
it or pass it on.
(svn_wc__db_op_copy): Take a destination op-root parameter and calculate
destination op-depth from it for db_op_copy().
* subversion/tests/libsvn_wc/op-depth-test.c
(repo_wc_copies): Add sub-tests for copying over a deleted same-kind node.
(test_repo_wc_copies): Use a test-specific name for the working directories.
Modified:
subversion/trunk/subversion/libsvn_wc/copy.c
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/libsvn_wc/copy.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/copy.c?rev=1032657&r1=1032656&r2=1032657&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/copy.c (original)
+++ subversion/trunk/subversion/libsvn_wc/copy.c Mon Nov 8 18:18:16 2010
@@ -203,6 +203,7 @@ static svn_error_t *
copy_versioned_file(svn_wc__db_t *db,
const char *src_abspath,
const char *dst_abspath,
+ const char *dst_op_root_abspath,
svn_boolean_t metadata_only,
svn_cancel_func_t cancel_func,
void *cancel_baton,
@@ -258,7 +259,7 @@ copy_versioned_file(svn_wc__db_t *db,
/* Copy the (single) node's metadata, and move the new filesystem node
into place. */
- SVN_ERR(svn_wc__db_op_copy(db, src_abspath, dst_abspath,
+ SVN_ERR(svn_wc__db_op_copy(db, src_abspath, dst_abspath, dst_op_root_abspath,
work_items, scratch_pool));
SVN_ERR(svn_wc__wq_run(db, dir_abspath,
cancel_func, cancel_baton, scratch_pool));
@@ -282,6 +283,7 @@ static svn_error_t *
copy_versioned_dir(svn_wc__db_t *db,
const char *src_abspath,
const char *dst_abspath,
+ const char *dst_op_root_abspath,
svn_boolean_t metadata_only,
svn_cancel_func_t cancel_func,
void *cancel_baton,
@@ -322,7 +324,7 @@ copy_versioned_dir(svn_wc__db_t *db,
/* Copy the (single) node's metadata, and move the new filesystem node
into place. */
- SVN_ERR(svn_wc__db_op_copy(db, src_abspath, dst_abspath,
+ SVN_ERR(svn_wc__db_op_copy(db, src_abspath, dst_abspath, dst_op_root_abspath,
work_items, scratch_pool));
SVN_ERR(svn_wc__wq_run(db, dir_abspath,
cancel_func, cancel_baton, scratch_pool));
@@ -366,12 +368,14 @@ copy_versioned_dir(svn_wc__db_t *db,
if (child_kind == svn_wc__db_kind_file)
SVN_ERR(copy_versioned_file(db,
child_src_abspath, child_dst_abspath,
+ dst_op_root_abspath,
metadata_only,
cancel_func, cancel_baton, NULL, NULL,
iterpool));
else if (child_kind == svn_wc__db_kind_dir)
SVN_ERR(copy_versioned_dir(db,
child_src_abspath, child_dst_abspath,
+ dst_op_root_abspath,
metadata_only,
cancel_func, cancel_baton, NULL, NULL,
iterpool));
@@ -728,14 +732,16 @@ svn_wc_copy3(svn_wc_context_t *wc_ctx,
if (src_db_kind == svn_wc__db_kind_file
|| src_db_kind == svn_wc__db_kind_symlink)
{
- SVN_ERR(copy_versioned_file(db, src_abspath, dst_abspath, metadata_only,
+ SVN_ERR(copy_versioned_file(db, src_abspath, dst_abspath, dst_abspath,
+ metadata_only,
cancel_func, cancel_baton,
notify_func, notify_baton,
scratch_pool));
}
else
{
- SVN_ERR(copy_versioned_dir(db, src_abspath, dst_abspath, metadata_only,
+ SVN_ERR(copy_versioned_dir(db, src_abspath, dst_abspath, dst_abspath,
+ metadata_only,
cancel_func, cancel_baton,
notify_func, notify_baton,
scratch_pool));
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1032657&r1=1032656&r2=1032657&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Mon Nov 8 18:18:16 2010
@@ -2671,6 +2671,7 @@ cross_db_copy(svn_wc__db_pdh_t *src_pdh,
svn_wc__db_pdh_t *dst_pdh,
const char *dst_relpath,
svn_wc__db_status_t dst_status,
+ apr_int64_t dst_op_depth,
svn_wc__db_kind_t kind,
const apr_array_header_t *children,
apr_int64_t copyfrom_id,
@@ -2734,7 +2735,7 @@ cross_db_copy(svn_wc__db_pdh_t *src_pdh,
iwb.original_revnum = copyfrom_rev;
iwb.moved_here = FALSE;
- iwb.op_depth = 2; /* ### temporary op_depth */
+ iwb.op_depth = dst_op_depth;
iwb.checksum = checksum;
iwb.children = children;
@@ -2933,6 +2934,7 @@ db_op_copy(svn_wc__db_pdh_t *src_pdh,
const char *src_relpath,
svn_wc__db_pdh_t *dst_pdh,
const char *dst_relpath,
+ apr_int64_t dst_op_depth,
const svn_skel_t *work_items,
apr_pool_t *scratch_pool)
{
@@ -2943,7 +2945,6 @@ db_op_copy(svn_wc__db_pdh_t *src_pdh,
apr_int64_t copyfrom_id;
svn_wc__db_kind_t kind;
const apr_array_header_t *children;
- apr_int64_t op_depth;
SVN_ERR(get_info_for_copy(©from_id, ©from_relpath, ©from_rev,
&status, &kind, &have_work,
@@ -2987,8 +2988,6 @@ db_op_copy(svn_wc__db_pdh_t *src_pdh,
else
children = NULL;
- op_depth = 2; /* ### temporary op_depth */
-
if (src_pdh->wcroot == dst_pdh->wcroot)
{
svn_sqlite__stmt_t *stmt;
@@ -3005,7 +3004,7 @@ db_op_copy(svn_wc__db_pdh_t *src_pdh,
SVN_ERR(svn_sqlite__bindf(stmt, "issisnnnt",
src_pdh->wcroot->wc_id, src_relpath,
dst_relpath,
- op_depth,
+ dst_op_depth,
dst_parent_relpath,
presence_map, dst_status));
@@ -3033,13 +3032,13 @@ db_op_copy(svn_wc__db_pdh_t *src_pdh,
NULL /* inherit repos_path */,
copyfrom_rev,
children,
- op_depth,
+ dst_op_depth,
scratch_pool));
}
else
{
SVN_ERR(cross_db_copy(src_pdh, src_relpath,
- dst_pdh, dst_relpath, dst_status,
+ dst_pdh, dst_relpath, dst_status, dst_op_depth,
kind, children,
copyfrom_id, copyfrom_relpath, copyfrom_rev,
scratch_pool));
@@ -3057,11 +3056,13 @@ svn_error_t *
svn_wc__db_op_copy(svn_wc__db_t *db,
const char *src_abspath,
const char *dst_abspath,
+ const char *dst_op_root_abspath,
const svn_skel_t *work_items,
apr_pool_t *scratch_pool)
{
svn_wc__db_pdh_t *src_pdh, *dst_pdh;
- const char *src_relpath, *dst_relpath;
+ const char *src_relpath, *dst_relpath, *dst_op_root_relpath;
+ apr_int64_t dst_op_depth;
SVN_ERR_ASSERT(svn_dirent_is_absolute(src_abspath));
SVN_ERR_ASSERT(svn_dirent_is_absolute(dst_abspath));
@@ -3078,9 +3079,19 @@ svn_wc__db_op_copy(svn_wc__db_t *db,
scratch_pool, scratch_pool));
VERIFY_USABLE_PDH(dst_pdh);
+#ifdef SVN_WC__OP_DEPTH
+ SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&dst_pdh, &dst_op_root_relpath,
+ db, dst_op_root_abspath,
+ svn_sqlite__mode_readwrite,
+ scratch_pool, scratch_pool));
+ dst_op_depth = relpath_depth(dst_op_root_relpath);
+#else
+ dst_op_depth = 2; /* ### temporary op_depth */
+#endif
+
/* ### This should all happen in one transaction. */
SVN_ERR(db_op_copy(src_pdh, src_relpath, dst_pdh, dst_relpath,
- work_items, scratch_pool));
+ dst_op_depth, work_items, 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=1032657&r1=1032656&r2=1032657&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Mon Nov 8 18:18:16 2010
@@ -1051,6 +1051,7 @@ svn_error_t *
svn_wc__db_op_copy(svn_wc__db_t *db,
const char *src_abspath,
const char *dst_abspath,
+ const char *dst_op_root_abspath,
const svn_skel_t *work_items,
apr_pool_t *scratch_pool);
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=1032657&r1=1032656&r2=1032657&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c Mon Nov 8 18:18:16 2010
@@ -591,15 +591,14 @@ wc_wc_copies(wc_baton_t *b)
static svn_error_t *
repo_wc_copies(wc_baton_t *b)
{
- const char source_base_file[] = "A/B/lambda";
- const char source_base_dir[] = "A/B/E";
-
SVN_ERR(add_and_commit_greek_tree(b));
/* Delete some nodes so that we can test copying onto these paths */
+ SVN_ERR(wc_delete(b, "A/B/lambda"));
SVN_ERR(wc_delete(b, "A/D/gamma"));
SVN_ERR(wc_delete(b, "A/D/G"));
+ SVN_ERR(wc_delete(b, "A/D/H"));
/* Test copying various things */
@@ -613,36 +612,56 @@ repo_wc_copies(wc_baton_t *b)
}
subtests[] =
{
- /* file */
- { source_base_file, "A/C/copy1", {
- { 3, "", "normal", 1, source_base_file }
+ /* file onto nothing */
+ { "iota", "A/C/copy1", {
+ { 3, "", "normal", 1, "iota" },
+ } },
+
+ /* dir onto nothing */
+ { "A/B/E", "A/C/copy2", {
+ { 3, "", "normal", 1, "A/B/E" },
+ { 3, "alpha", "normal", NO_COPY_FROM },
+ { 3, "beta", "normal", NO_COPY_FROM },
} },
- /* dir */
- { source_base_dir, "A/C/copy2", {
- { 3, "", "normal", 1, source_base_dir },
- { 3, "alpha", "normal", NO_COPY_FROM },
- { 3, "beta", "normal", NO_COPY_FROM }
+ /* file onto a schedule-delete file */
+ { "iota", "A/B/lambda", {
+ { 0, "", "normal", 1, "A/B/lambda" },
+ { 3, "", "normal", 1, "iota" },
+ } },
+
+ /* dir onto a schedule-delete dir */
+ { "A/B/E", "A/D/G", {
+ { 0, "", "normal", 1, "A/D/G" },
+ { 0, "pi", "normal", 1, "A/D/G/pi" },
+ { 0, "rho", "normal", 1, "A/D/G/rho" },
+ { 0, "tau", "normal", 1, "A/D/G/tau" },
+ { 3, "", "normal", 1, "A/B/E" },
+ { 3, "pi", "base-deleted", NO_COPY_FROM },
+ { 3, "rho", "base-deleted", NO_COPY_FROM },
+ { 3, "tau", "base-deleted", NO_COPY_FROM },
+ { 3, "alpha", "normal", NO_COPY_FROM },
+ { 3, "beta", "normal", NO_COPY_FROM },
} },
/* dir onto a schedule-delete file */
- { source_base_dir, "A/D/gamma", {
- { 0, "", "normal", 1, "A/D/gamma" },
- { 3, "", "normal", 1, source_base_dir },
- { 3, "alpha", "normal", NO_COPY_FROM },
- { 3, "beta", "normal", NO_COPY_FROM }
+ { "A/B/E", "A/D/gamma", {
+ { 0, "", "normal", 1, "A/D/gamma" },
+ { 3, "", "normal", 1, "A/B/E" },
+ { 3, "alpha", "normal", NO_COPY_FROM },
+ { 3, "beta", "normal", NO_COPY_FROM },
} },
/* file onto a schedule-delete dir */
- { source_base_file, "A/D/G", {
- { 0, "", "normal", 1, "A/D/G" },
- { 0, "pi", "normal", 1, "A/D/G/pi" },
- { 0, "rho", "normal", 1, "A/D/G/rho" },
- { 0, "tau", "normal", 1, "A/D/G/tau" },
- { 3, "", "normal", 1, source_base_file },
- { 3, "pi", "base-deleted", NO_COPY_FROM },
- { 3, "rho", "base-deleted", NO_COPY_FROM },
- { 3, "tau", "base-deleted", NO_COPY_FROM }
+ { "iota", "A/D/H", {
+ { 0, "", "normal", 1, "A/D/H" },
+ { 0, "chi", "normal", 1, "A/D/H/chi" },
+ { 0, "psi", "normal", 1, "A/D/H/psi" },
+ { 0, "omega", "normal", 1, "A/D/H/omega" },
+ { 3, "", "normal", 1, "iota" },
+ { 3, "chi", "base-deleted", NO_COPY_FROM },
+ { 3, "psi", "base-deleted", NO_COPY_FROM },
+ { 3, "omega", "base-deleted", NO_COPY_FROM },
} },
{ 0 }
@@ -965,7 +984,7 @@ test_repo_wc_copies(const svn_test_opts_
b.pool = pool;
SVN_ERR(svn_test__create_repos_and_wc(&b.repos_url, &b.wc_abspath,
- "wc_wc_copies", opts, pool));
+ "repo_wc_copies", opts, pool));
SVN_ERR(svn_wc_context_create(&b.wc_ctx, NULL, pool, pool));
return repo_wc_copies(&b);