You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ph...@apache.org on 2010/11/29 19:01:36 UTC
svn commit: r1040204 - in /subversion/trunk/subversion: libsvn_wc/wc_db.c
tests/libsvn_wc/op-depth-test.c
Author: philip
Date: Mon Nov 29 18:01:36 2010
New Revision: 1040204
URL: http://svn.apache.org/viewvc?rev=1040204&view=rev
Log:
Make copy of a mixed-revision source produce a single op-depth copy.
* subversion/libsvn_wc/wc_db.c
(op_depth_for_copy): Use op_depth of incomplete node if it exists.
* subversion/tests/libsvn_wc/op-depth-test.c
(test_mixed_rev_copy): New test.
(test_funcs): Mark new test as WIMP.
Modified:
subversion/trunk/subversion/libsvn_wc/wc_db.c
subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1040204&r1=1040203&r2=1040204&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Mon Nov 29 18:01:36 2010
@@ -3246,10 +3246,12 @@ catch_copy_of_absent(svn_wc__db_pdh_t *p
}
-/* 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
- of LOCAL_RELPATH. */
+/* If LOCAL_RELPATH is presence=incomplete then set *OP_DEPTH to the
+ op_depth of the incomplete node, otherwise if the copyfrom
+ information COPYFROM_REPOS_ID+COPYFROM_RELPATH+COPYFROM_REVISION
+ "matches" 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 of LOCAL_RELPATH. */
static svn_error_t *
op_depth_for_copy(apr_int64_t *op_depth,
apr_int64_t copyfrom_repos_id,
@@ -3269,8 +3271,24 @@ op_depth_for_copy(apr_int64_t *op_depth,
if (!copyfrom_relpath)
return SVN_NO_ERROR;
- svn_relpath_split(&parent_relpath, &name, local_relpath, scratch_pool);
+ SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
+ STMT_SELECT_WORKING_NODE));
+ SVN_ERR(svn_sqlite__bindf(stmt, "is", pdh->wcroot->wc_id, local_relpath));
+ SVN_ERR(svn_sqlite__step(&have_row, stmt));
+ if (have_row)
+ {
+ svn_wc__db_status_t status = svn_sqlite__column_token(stmt, 1,
+ presence_map);
+ if (status == svn_wc__db_status_incomplete)
+ {
+ *op_depth = svn_sqlite__column_int64(stmt, 0);
+ SVN_ERR(svn_sqlite__reset(stmt));
+ return SVN_NO_ERROR;
+ }
+ }
+ SVN_ERR(svn_sqlite__reset(stmt));
+ svn_relpath_split(&parent_relpath, &name, local_relpath, scratch_pool);
SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
STMT_SELECT_WORKING_NODE));
SVN_ERR(svn_sqlite__bindf(stmt, "is", pdh->wcroot->wc_id, parent_relpath));
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=1040204&r1=1040203&r2=1040204&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 29 18:01:36 2010
@@ -1707,6 +1707,49 @@ test_wc_move(const svn_test_opts_t *opts
return SVN_NO_ERROR;
}
+static svn_error_t *
+test_mixed_rev_copy(const svn_test_opts_t *opts, apr_pool_t *pool)
+{
+ wc_baton_t b;
+
+ b.pool = pool;
+ SVN_ERR(svn_test__create_repos_and_wc(&b.repos_url, &b.wc_abspath,
+ "mixed_rev_copy", opts, pool));
+ SVN_ERR(svn_wc_context_create(&b.wc_ctx, NULL, pool, pool));
+ SVN_ERR(wc_mkdir(&b, "A"));
+ SVN_ERR(wc_commit(&b, ""));
+ SVN_ERR(wc_mkdir(&b, "A/B"));
+ SVN_ERR(wc_commit(&b, ""));
+ SVN_ERR(wc_mkdir(&b, "A/B/C"));
+ SVN_ERR(wc_commit(&b, ""));
+
+ SVN_ERR(wc_copy(&b, "A", "X"));
+ {
+ nodes_row_t rows[] = {
+ { 1, "X", "normal", 1, "A" },
+ { 1, "X/B", "normal", 2, "A/B" },
+ { 1, "X/B/C", "normal", 3, "A/B/C" },
+ { 0 }
+ };
+ SVN_ERR(check_db_rows(&b, "X", rows));
+ }
+
+ SVN_ERR(wc_copy(&b, "A/B", "X/Y"));
+ {
+ nodes_row_t rows[] = {
+ { 1, "X", "normal", 1, "A" },
+ { 1, "X/B", "normal", 2, "A/B" },
+ { 1, "X/B/C", "normal", 3, "A/B/C" },
+ { 2, "X/Y", "normal", 2, "A/B" },
+ { 2, "X/Y/C", "normal", 3, "A/B/C" },
+ { 0 }
+ };
+ SVN_ERR(check_db_rows(&b, "X", rows));
+ }
+
+ return SVN_NO_ERROR;
+}
+
/* ---------------------------------------------------------------------- */
/* The list of test functions */
@@ -1748,5 +1791,8 @@ struct svn_test_descriptor_t test_funcs[
SVN_TEST_OPTS_WIMP(test_wc_move,
"test_wc_move",
"needs op_depth"),
+ SVN_TEST_OPTS_WIMP(test_mixed_rev_copy,
+ "test_mixed_rev_copy",
+ "needs op_depth"),
SVN_TEST_NULL
};