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 2011/02/09 18:45:22 UTC

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

Author: philip
Date: Wed Feb  9 17:45:22 2011
New Revision: 1068995

URL: http://svn.apache.org/viewvc?rev=1068995&view=rev
Log:
Make the before and after nodes more explicit in the test.

* subversion/tests/libsvn_wc/op-depth-test.c
  (revert): Change parameters from common/removed/added to before/after.
  (test_op_revert): Adjust to match.

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=1068995&r1=1068994&r2=1068995&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c Wed Feb  9 17:45:22 2011
@@ -1920,32 +1920,12 @@ static svn_error_t *
 revert(wc_baton_t *b,
        const char *local_relpath,
        svn_depth_t depth,
-       nodes_row_t *common,
-       nodes_row_t *removed,
-       nodes_row_t *added)
+       nodes_row_t *before,
+       nodes_row_t *after)
 {
   const char *local_abspath = wc_path(b, local_relpath);
-  nodes_row_t *before, *after;
-  apr_int64_t num_com = count_rows(common);
-  apr_int64_t num_rem = count_rows(removed);
-  apr_int64_t num_add = count_rows(added);
-  int i;
   svn_error_t *err;
 
-  before = apr_palloc(b->pool, sizeof(*before) * (num_com + num_rem + 1));
-  for (i = 0; i < num_com; ++i)
-    before[i] = common[i];
-  for (i = 0; i < num_rem; ++i)
-    before[num_com+i] = removed[i];
-  before[num_com+num_rem].local_relpath = NULL;
-
-  after = apr_palloc(b->pool, sizeof(*before) * (num_com + num_add + 1));
-  for (i = 0; i < num_com; ++i)
-    after[i] = common[i];
-  for (i = 0; i < num_add; ++i)
-    after[num_com+i] = added[i];
-  after[num_com+num_add].local_relpath = NULL;
-
   SVN_ERR(insert_dirs(b, before));
   SVN_ERR(check_db_rows(b, "", before));
   err = svn_wc__db_op_revert(b->wc_ctx->db, local_abspath, depth, b->pool);
@@ -1963,7 +1943,6 @@ static svn_error_t *
 test_op_revert(const svn_test_opts_t *opts, apr_pool_t *pool)
 {
   wc_baton_t b;
-  nodes_row_t no_rows[] = { { 0 } };
 
   b.pool = pool;
   SVN_ERR(svn_test__create_repos_and_wc(&b.repos_url, &b.wc_abspath,
@@ -1971,54 +1950,75 @@ test_op_revert(const svn_test_opts_t *op
   SVN_ERR(svn_wc_context_create(&b.wc_ctx, NULL, pool, pool));
 
   {
-    nodes_row_t common[] = {
+    nodes_row_t before[] = {
       { 0, "",    "normal", 4, "" },
       { 0, "A",   "normal", 4, "A" },
+      { 2, "A/B", "normal", NO_COPY_FROM },
       { 0 },
     };
-
-    nodes_row_t removed1[] = {
-      { 2, "A/B", "normal", NO_COPY_FROM },
+    nodes_row_t after[] = {
+      { 0, "",    "normal", 4, "" },
+      { 0, "A",   "normal", 4, "A" },
       { 0 },
     };
+    SVN_ERR(revert(&b, "A/B", svn_depth_infinity, before, after));
+  }
 
-    nodes_row_t removed2[] = {
+  {
+    nodes_row_t before[] = {
+      { 0, "",        "normal", 4, "" },
+      { 0, "A",       "normal", 4, "A" },
       { 2, "A/B",     "normal", 2, "X/B" },
       { 2, "A/B/C",   "normal", 2, "X/B/C" },
       { 2, "A/B/C/D", "normal", 2, "X/B/C/D" },
       { 0 },
     };
-
-    SVN_ERR(revert(&b, "A/B", svn_depth_infinity, common, removed1, no_rows));
-    SVN_ERR(revert(&b, "A/B", svn_depth_infinity, common, removed2, no_rows));
+    nodes_row_t after[] = {
+      { 0, "",    "normal", 4, "" },
+      { 0, "A",   "normal", 4, "A" },
+      { 0 },
+    };
+    SVN_ERR(revert(&b, "A/B", svn_depth_infinity, before, after));
   }
 
   {
-    nodes_row_t common[] = {
+    nodes_row_t before[] = {
       { 0, "",        "normal", 4, "" },
       { 0, "A",       "normal", 4, "A" },
       { 0, "A/B",     "normal", 4, "A/B" },
       { 0, "A/B/C",   "normal", 4, "A/B" },
+      { 3, "A/B/C",   "base-deleted", NO_COPY_FROM },
       { 0 },
     };
-
-    nodes_row_t removed1[] = {
-      { 3, "A/B/C", "base-deleted", NO_COPY_FROM },
+    nodes_row_t after[] = {
+      { 0, "",        "normal", 4, "" },
+      { 0, "A",       "normal", 4, "A" },
+      { 0, "A/B",     "normal", 4, "A/B" },
+      { 0, "A/B/C",   "normal", 4, "A/B" },
       { 0 },
     };
+    SVN_ERR(revert(&b, "A/B/C", svn_depth_infinity, before, after));
+  }
 
-    nodes_row_t removed2[] = {
-      { 2, "A/B",   "base-deleted", NO_COPY_FROM },
-      { 2, "A/B/C", "base-deleted", NO_COPY_FROM },
+  {
+    nodes_row_t before[] = {
+      { 0, "",        "normal", 4, "" },
+      { 0, "A",       "normal", 4, "A" },
+      { 0, "A/B",     "normal", 4, "A/B" },
+      { 0, "A/B/C",   "normal", 4, "A/B" },
+      { 2, "A/B",     "base-deleted", NO_COPY_FROM },
+      { 2, "A/B/C",   "base-deleted", NO_COPY_FROM },
       { 0 },
     };
-    nodes_row_t added2[] = {
-      { 3, "A/B/C", "base-deleted", NO_COPY_FROM },
+    nodes_row_t after[] = {
+      { 0, "",        "normal", 4, "" },
+      { 0, "A",       "normal", 4, "A" },
+      { 0, "A/B",     "normal", 4, "A/B" },
+      { 0, "A/B/C",   "normal", 4, "A/B" },
+      { 3, "A/B/C",   "base-deleted", NO_COPY_FROM },
       { 0 },
     };
-
-    SVN_ERR(revert(&b, "A/B/C", svn_depth_infinity, common, removed1, no_rows));
-    SVN_ERR(revert(&b, "A/B", svn_depth_infinity, common, removed2, added2));
+    SVN_ERR(revert(&b, "A/B", svn_depth_infinity, before, after));
   }
 
   {
@@ -2034,11 +2034,11 @@ test_op_revert(const svn_test_opts_t *op
       { 0 },
     };
 
-    err = revert(&b, "A/B/C", svn_depth_infinity, common, no_rows, no_rows);
+    err = revert(&b, "A/B/C", svn_depth_infinity, common, common);
     SVN_TEST_ASSERT(err && err->apr_err == SVN_ERR_WC_INVALID_OPERATION_DEPTH);
     svn_error_clear(err);
 
-    err = revert(&b, "X", svn_depth_infinity, common, no_rows, no_rows);
+    err = revert(&b, "X", svn_depth_infinity, common, common);
     SVN_TEST_ASSERT(err && err->apr_err == SVN_ERR_WC_INVALID_OPERATION_DEPTH);
     svn_error_clear(err);
   }