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/25 14:12:20 UTC

svn commit: r1039029 - /subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c

Author: philip
Date: Thu Nov 25 13:12:20 2010
New Revision: 1039029

URL: http://svn.apache.org/viewvc?rev=1039029&view=rev
Log:
Add a new test for mv-of-a-mv.  This is a low-level test for the failure
in copy_tests.py 83.

* subversion/tests/libsvn_wc/op-depth-test.c
  (wc_move): New helper.
  (test_wc_move): New test.
  (test_funcs): Make new test as WIMP.

Modified:
    subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c

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=1039029&r1=1039028&r2=1039029&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c Thu Nov 25 13:12:20 2010
@@ -231,6 +231,19 @@ wc_resolved(wc_baton_t *b, const char *p
   return svn_client_resolved(wc_path(b, path), TRUE, ctx, b->pool);
 }
 
+static svn_error_t *
+wc_move(wc_baton_t *b, const char *src, const char *dst)
+{
+  svn_client_ctx_t *ctx;
+  apr_array_header_t *paths = apr_array_make(b->pool, 1,
+                                             sizeof(const char *));
+
+  SVN_ERR(svn_client_create_context(&ctx, b->pool));
+  APR_ARRAY_PUSH(paths, const char *) = wc_path(b, src);
+  return svn_client_move6(paths, wc_path(b, dst),
+                          FALSE, FALSE, NULL, NULL, NULL, ctx, b->pool);
+}
+
 /* Create the Greek tree on disk in the WC, and commit it. */
 static svn_error_t *
 add_and_commit_greek_tree(wc_baton_t *b)
@@ -1678,6 +1691,55 @@ test_temp_op_make_copy(const svn_test_op
   return SVN_NO_ERROR;
 }
 
+static svn_error_t *
+test_wc_move(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,
+                                        "wc_move", opts, pool));
+  SVN_ERR(svn_wc_context_create(&b.wc_ctx, NULL, pool, pool));
+  SVN_ERR(wc_mkdir(&b, "A"));
+  SVN_ERR(wc_mkdir(&b, "A/B"));
+  SVN_ERR(wc_mkdir(&b, "A/B/C"));
+  SVN_ERR(wc_commit(&b, ""));
+  SVN_ERR(wc_update(&b, "", 1));
+
+  SVN_ERR(wc_move(&b, "A/B/C", "A/B/C-move"));
+  {
+    nodes_row_t rows[] = {
+      { 0, "",           "normal",       1, "" },
+      { 0, "A",          "normal",       1, "A" },
+      { 0, "A/B",        "normal",       1, "A/B" },
+      { 0, "A/B/C",      "normal",       1, "A/B/C" },
+      { 3, "A/B/C",      "base-deleted", NO_COPY_FROM },
+      { 3, "A/B/C-move", "normal",       1, "A/B/C" },
+      { 0 }
+    };
+    SVN_ERR(check_db_rows(&b, "", rows));
+  }
+
+  SVN_ERR(wc_move(&b, "A/B", "A/B-move"));
+  {
+    nodes_row_t rows[] = {
+      { 0, "",                "normal",       1, "" },
+      { 0, "A",               "normal",       1, "A" },
+      { 0, "A/B",             "normal",       1, "A/B" },
+      { 0, "A/B/C",           "normal",       1, "A/B/C" },
+      { 2, "A/B",             "base-deleted", NO_COPY_FROM },
+      { 2, "A/B/C",           "base-deleted", NO_COPY_FROM },
+      { 2, "A/B-move",        "normal",       1, "A/B" },
+      { 2, "A/B-move/C",      "not-present",  NO_COPY_FROM },
+      { 3, "A/B-move/C-move", "normal",       1, "A/B/C" },
+      { 0 }
+    };
+    SVN_ERR(check_db_rows(&b, "", rows));
+  }
+
+  return SVN_NO_ERROR;
+}
+
 /* ---------------------------------------------------------------------- */
 /* The list of test functions */
 
@@ -1717,5 +1779,8 @@ struct svn_test_descriptor_t test_funcs[
     SVN_TEST_OPTS_WIMP(test_temp_op_make_copy,
                        "test_temp_op_make_copy",
                        "needs op_depth"),
+    SVN_TEST_OPTS_WIMP(test_wc_move,
+                       "test_wc_move",
+                       "needs op_depth"),
     SVN_TEST_NULL
   };