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/10 20:55:19 UTC

svn commit: r1069547 - in /subversion/trunk/subversion: libsvn_wc/wc-queries.sql libsvn_wc/wc_db.c tests/libsvn_wc/op-depth-test.c

Author: philip
Date: Thu Feb 10 19:55:19 2011
New Revision: 1069547

URL: http://svn.apache.org/viewvc?rev=1069547&view=rev
Log:
A tree replaced by a single node can be non-recursive reverted even
if the tree is recursive.

* subversion/libsvn_wc/wc_db.c
  (op_revert_txn): Revert a single node that replaces a tree.

* subversion/libsvn_wc/wc_db.c
  (STMT_SELECT_GE_OP_DEPTH_CHILDREN): Don't select base-deleted at
   same op-depth.

* subversion/tests/libsvn_wc/op-depth-test.c
  (test_op_revert): Two more cases, fix some copyfrom relpaths.

Modified:
    subversion/trunk/subversion/libsvn_wc/wc-queries.sql
    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-queries.sql
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc-queries.sql?rev=1069547&r1=1069546&r2=1069547&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Thu Feb 10 19:55:19 2011
@@ -147,7 +147,8 @@ WHERE wc_id = ?1 AND parent_relpath = ?2
 
 -- STMT_SELECT_GE_OP_DEPTH_CHILDREN
 SELECT 1 FROM nodes
-WHERE wc_id = ?1 AND parent_relpath = ?2 AND op_depth >= ?3;
+WHERE wc_id = ?1 AND parent_relpath = ?2
+  AND (op_depth > ?3 OR (op_depth = ?3 AND presence != 'base-deleted'));
 
 -- STMT_SELECT_NODE_CHILDREN
 SELECT local_relpath FROM nodes

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1069547&r1=1069546&r2=1069547&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Thu Feb 10 19:55:19 2011
@@ -3602,19 +3602,17 @@ op_revert_txn(void *baton, svn_sqlite__d
                                                             b->local_relpath,
                                                             scratch_pool));
         }
-      else if (status == svn_wc__db_status_deleted)
-        {
-          /* Rewrite the op-depth of all deleted children making the
-             direct children into roots of deletes. */
-          const char *like_arg = construct_like_arg(b->local_relpath,
-                                                    scratch_pool);
+
+      /* Rewrite the op-depth of all deleted children making the
+         direct children into roots of deletes. */
           
-          SVN_ERR(svn_sqlite__get_statement(&stmt, b->wcroot->sdb,
-                                      STMT_UPDATE_OP_DEPTH_INCREASE_RECURSIVE));
-          SVN_ERR(svn_sqlite__bindf(stmt, "isi", b->wcroot->wc_id,
-                                    like_arg, op_depth));
-          SVN_ERR(svn_sqlite__step_done(stmt));
-        }
+      SVN_ERR(svn_sqlite__get_statement(&stmt, b->wcroot->sdb,
+                                     STMT_UPDATE_OP_DEPTH_INCREASE_RECURSIVE));
+      SVN_ERR(svn_sqlite__bindf(stmt, "isi", b->wcroot->wc_id,
+                                construct_like_arg(b->local_relpath,
+                                                   scratch_pool),
+                                op_depth));
+      SVN_ERR(svn_sqlite__step_done(stmt));
 
       SVN_ERR(svn_sqlite__get_statement(&stmt, b->wcroot->sdb,
                                         STMT_DELETE_WORKING_NODE));

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=1069547&r1=1069546&r2=1069547&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c Thu Feb 10 19:55:19 2011
@@ -1942,6 +1942,7 @@ static svn_error_t *
 test_op_revert(const svn_test_opts_t *opts, apr_pool_t *pool)
 {
   wc_baton_t b;
+  svn_error_t *err;
 
   b.pool = pool;
   SVN_ERR(svn_test__create_repos_and_wc(&b.repos_url, &b.wc_abspath,
@@ -1964,7 +1965,6 @@ test_op_revert(const svn_test_opts_t *op
   }
 
   {
-    svn_error_t *err;
     nodes_row_t common[] = {
       { 0, "",        "normal", 4, "" },
       { 0, "A",       "normal", 4, "A" },
@@ -2005,7 +2005,7 @@ test_op_revert(const svn_test_opts_t *op
       { 0, "",        "normal", 4, "" },
       { 0, "A",       "normal", 4, "A" },
       { 0, "A/B",     "normal", 4, "A/B" },
-      { 0, "A/B/C",   "normal", 4, "A/B" },
+      { 0, "A/B/C",   "normal", 4, "A/B/C" },
       { 3, "A/B/C",   "base-deleted", NO_COPY_FROM },
       { 0 },
     };
@@ -2013,7 +2013,7 @@ test_op_revert(const svn_test_opts_t *op
       { 0, "",        "normal", 4, "" },
       { 0, "A",       "normal", 4, "A" },
       { 0, "A/B",     "normal", 4, "A/B" },
-      { 0, "A/B/C",   "normal", 4, "A/B" },
+      { 0, "A/B/C",   "normal", 4, "A/B/C" },
       { 0 },
     };
     SVN_ERR(revert(&b, "A/B/C", before, after));
@@ -2024,7 +2024,7 @@ test_op_revert(const svn_test_opts_t *op
       { 0, "",        "normal", 4, "" },
       { 0, "A",       "normal", 4, "A" },
       { 0, "A/B",     "normal", 4, "A/B" },
-      { 0, "A/B/C",   "normal", 4, "A/B" },
+      { 0, "A/B/C",   "normal", 4, "A/B/C" },
       { 2, "A/B",     "base-deleted", NO_COPY_FROM },
       { 2, "A/B/C",   "base-deleted", NO_COPY_FROM },
       { 2, "A/B/C/D", "base-deleted", NO_COPY_FROM },
@@ -2034,7 +2034,7 @@ test_op_revert(const svn_test_opts_t *op
       { 0, "",        "normal", 4, "" },
       { 0, "A",       "normal", 4, "A" },
       { 0, "A/B",     "normal", 4, "A/B" },
-      { 0, "A/B/C",   "normal", 4, "A/B" },
+      { 0, "A/B/C",   "normal", 4, "A/B/C" },
       { 3, "A/B/C",   "base-deleted", NO_COPY_FROM },
       { 3, "A/B/C/D", "base-deleted", NO_COPY_FROM },
       { 0 },
@@ -2047,7 +2047,7 @@ test_op_revert(const svn_test_opts_t *op
       { 0, "",        "normal", 4, "" },
       { 0, "A",       "normal", 4, "A" },
       { 0, "A/B",     "normal", 4, "A/B" },
-      { 0, "A/B/C",   "normal", 4, "A/B" },
+      { 0, "A/B/C",   "normal", 4, "A/B/C" },
       { 1, "A",       "normal", NO_COPY_FROM },
       { 1, "A/B",     "base-deleted", NO_COPY_FROM },
       { 1, "A/B/C",   "base-deleted", NO_COPY_FROM },
@@ -2059,7 +2059,7 @@ test_op_revert(const svn_test_opts_t *op
       { 0, "",        "normal", 4, "" },
       { 0, "A",       "normal", 4, "A" },
       { 0, "A/B",     "normal", 4, "A/B" },
-      { 0, "A/B/C",   "normal", 4, "A/B" },
+      { 0, "A/B/C",   "normal", 4, "A/B/C" },
       { 1, "A",       "normal", NO_COPY_FROM },
       { 1, "A/B",     "base-deleted", NO_COPY_FROM },
       { 1, "A/B/C",   "base-deleted", NO_COPY_FROM },
@@ -2070,7 +2070,7 @@ test_op_revert(const svn_test_opts_t *op
       { 0, "",        "normal", 4, "" },
       { 0, "A",       "normal", 4, "A" },
       { 0, "A/B",     "normal", 4, "A/B" },
-      { 0, "A/B/C",   "normal", 4, "A/B" },
+      { 0, "A/B/C",   "normal", 4, "A/B/C" },
       { 1, "A",       "normal", NO_COPY_FROM },
       { 1, "A/B",     "base-deleted", NO_COPY_FROM },
       { 1, "A/B/C",   "base-deleted", NO_COPY_FROM },
@@ -2080,6 +2080,49 @@ test_op_revert(const svn_test_opts_t *op
     SVN_ERR(revert(&b, "A/B", after1, after2));
   }
 
+  {
+    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/C" },
+      { 0, "A/B/C/D", "normal", 4, "A/B/C/D" },
+      { 2, "A/B",     "normal", NO_COPY_FROM },
+      { 2, "A/B/C",   "base-deleted", NO_COPY_FROM },
+      { 2, "A/B/C/D", "base-deleted", NO_COPY_FROM },
+      { 0 },
+    };
+    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/C" },
+      { 0, "A/B/C/D", "normal", 4, "A/B/C/D" },
+      { 3, "A/B/C",   "base-deleted", NO_COPY_FROM },
+      { 3, "A/B/C/D", "base-deleted", NO_COPY_FROM },
+      { 0 },
+    };
+    SVN_ERR(revert(&b, "A/B", before, after));
+  }
+
+  {
+    nodes_row_t common[] = {
+      { 0, "",        "normal", 4, "" },
+      { 0, "A",       "normal", 4, "A" },
+      { 0, "A/B",     "normal", 4, "A/B" },
+      { 0, "A/B/C",   "normal", 4, "A/B/C" },
+      { 0, "A/B/C/D", "normal", 4, "A/B/C/D" },
+      { 1, "A",       "normal", 2, "X/Y" },
+      { 1, "A/B",     "normal", 2, "X/Y/B" },
+      { 1, "A/B/C",   "base-deleted", NO_COPY_FROM },
+      { 1, "A/B/C/D", "base-deleted", NO_COPY_FROM },
+      { 0 },
+    };
+    err = revert(&b, "A", common, common);
+    SVN_TEST_ASSERT(err && err->apr_err == SVN_ERR_WC_INVALID_OPERATION_DEPTH);
+    svn_error_clear(err);
+  }
+
   return SVN_NO_ERROR;
 }