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 11:29:58 UTC

svn commit: r1069329 - in /subversion/trunk/subversion: libsvn_wc/wc_db.c libsvn_wc/wc_db.h tests/libsvn_wc/op-depth-test.c

Author: philip
Date: Thu Feb 10 10:29:58 2011
New Revision: 1069329

URL: http://svn.apache.org/viewvc?rev=1069329&view=rev
Log:
The new revert is currently non-recursive so don't revert copies
with children.

* subversion/libsvn_wc/wc_db.c
  (op_revert_txn): Don't revert copies that have children.

* subversion/libsvn_wc/wc_db.h
  (svn_wc__db_op_revert): Tweak docstring.

* subversion/tests/libsvn_wc/op-depth-test.c
  (revert): Test revert on copies.

Modified:
    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/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1069329&r1=1069328&r2=1069329&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Thu Feb 10 10:29:58 2011
@@ -3584,36 +3584,24 @@ op_revert_txn(void *baton, svn_sqlite__d
                                                         b->local_relpath,
                                                         scratch_pool));
 
-      /* Check for higher op-depth children */
-      SVN_ERR(svn_sqlite__get_statement(&stmt, b->pdh->wcroot->sdb,
-                                     STMT_SELECT_NODES_GE_OP_DEPTH_RECURSIVE));
-      SVN_ERR(svn_sqlite__bindf(stmt, "issi", b->pdh->wcroot->wc_id,
-                                b->local_relpath,
-                                construct_like_arg(b->local_relpath,
-                                                   scratch_pool),
-                                op_depth + 1));
-      SVN_ERR(svn_sqlite__step(&have_row, stmt));
-      if (have_row)
-        return svn_error_createf(SVN_ERR_WC_INVALID_OPERATION_DEPTH, NULL,
-                                 _("Can't revert tree change for '%s' without"
-                                   " reverting children"),
-                                 path_for_error_message(b->pdh->wcroot,
-                                                        b->local_relpath,
-                                                        scratch_pool));
-
       SVN_ERR(convert_to_working_status(&status, status));
 
       if (status == svn_wc__db_status_added)
         {
-          SVN_ERR(remove_children(b->pdh, b->local_relpath,
-                                  svn_wc__db_status_normal,
-                                  op_depth, scratch_pool));
-          SVN_ERR(remove_children(b->pdh, b->local_relpath,
-                                  svn_wc__db_status_not_present,
-                                  op_depth, scratch_pool));
-          SVN_ERR(remove_children(b->pdh, b->local_relpath,
-                                  svn_wc__db_status_incomplete,
-                                  op_depth, scratch_pool));
+          /* Check for children */
+          SVN_ERR(svn_sqlite__get_statement(&stmt, b->pdh->wcroot->sdb,
+                                            STMT_SELECT_NODE_CHILDREN));
+          SVN_ERR(svn_sqlite__bindf(stmt, "is", b->pdh->wcroot->wc_id,
+                                    b->local_relpath));
+          SVN_ERR(svn_sqlite__step(&have_row, stmt));
+          SVN_ERR(svn_sqlite__reset(stmt));
+          if (have_row)
+            return svn_error_createf(SVN_ERR_WC_INVALID_OPERATION_DEPTH, NULL,
+                                     _("Can't revert tree change for '%s'"
+                                       " without reverting children"),
+                                     path_for_error_message(b->pdh->wcroot,
+                                                            b->local_relpath,
+                                                            scratch_pool));
         }
       else if (status == svn_wc__db_status_deleted)
         {

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=1069329&r1=1069328&r2=1069329&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Thu Feb 10 10:29:58 2011
@@ -1246,12 +1246,11 @@ svn_wc__db_op_revert_actual(svn_wc__db_t
 /* Revert all local changes which are being maintained in the database,
  * including conflict storage, properties and text modification status.
  *
- * This is a non-recursive operation except that reverting the root of
- * a copy will revert the whole copy.
+ * This is a non-recursive operation.
  *
  * Returns SVN_ERR_WC_INVALID_OPERATION_DEPTH if the revert is not
- * possible, e.g. copy/delete but not a root, or if there are higher
- * op-depth children.
+ * possible, e.g. copy/delete but not a root, or a copy root with
+ * children.
  */
 svn_error_t *
 svn_wc__db_op_revert(svn_wc__db_t *db,

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=1069329&r1=1069328&r2=1069329&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 10:29:58 2011
@@ -1964,20 +1964,40 @@ test_op_revert(const svn_test_opts_t *op
   }
 
   {
-    nodes_row_t before[] = {
+    svn_error_t *err;
+    nodes_row_t common[] = {
       { 0, "",        "normal", 4, "" },
       { 0, "A",       "normal", 4, "A" },
+      { 0, "P",       "normal", 4, "P" },
+      { 0, "P/Q",     "normal", 4, "P/Q" },
+      { 1, "P",       "normal", 3, "V" },
+      { 1, "P/Q",     "normal", 3, "V/Q" },
       { 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" },
+      { 1, "X",       "normal", NO_COPY_FROM },
+      { 2, "X/Y",     "normal", NO_COPY_FROM },
       { 0 },
     };
-    nodes_row_t after[] = {
-      { 0, "",    "normal", 4, "" },
-      { 0, "A",   "normal", 4, "A" },
-      { 0 },
-    };
-    SVN_ERR(revert(&b, "A/B", before, after));
+    err = revert(&b, "A/B/C/D", common, common);
+    SVN_TEST_ASSERT(err && err->apr_err == SVN_ERR_WC_INVALID_OPERATION_DEPTH);
+    svn_error_clear(err);
+
+    err = revert(&b, "A/B/C", common, common);
+    SVN_TEST_ASSERT(err && err->apr_err == SVN_ERR_WC_INVALID_OPERATION_DEPTH);
+    svn_error_clear(err);
+
+    err = revert(&b, "A/B", common, common);
+    SVN_TEST_ASSERT(err && err->apr_err == SVN_ERR_WC_INVALID_OPERATION_DEPTH);
+    svn_error_clear(err);
+
+    err = revert(&b, "P", common, common);
+    SVN_TEST_ASSERT(err && err->apr_err == SVN_ERR_WC_INVALID_OPERATION_DEPTH);
+    svn_error_clear(err);
+
+    err = revert(&b, "X", common, common);
+    SVN_TEST_ASSERT(err && err->apr_err == SVN_ERR_WC_INVALID_OPERATION_DEPTH);
+    svn_error_clear(err);
   }
 
   {
@@ -2007,6 +2027,7 @@ test_op_revert(const svn_test_opts_t *op
       { 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 },
+      { 2, "A/B/C/D", "base-deleted", NO_COPY_FROM },
       { 0 },
     };
     nodes_row_t after[] = {
@@ -2015,33 +2036,12 @@ test_op_revert(const svn_test_opts_t *op
       { 0, "A/B",     "normal", 4, "A/B" },
       { 0, "A/B/C",   "normal", 4, "A/B" },
       { 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));
   }
 
-  {
-    svn_error_t *err;
-    nodes_row_t common[] = {
-      { 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" },
-      { 1, "X",       "normal", NO_COPY_FROM },
-      { 2, "X/Y",     "normal", NO_COPY_FROM },
-      { 0 },
-    };
-
-    err = revert(&b, "A/B/C", common, common);
-    SVN_TEST_ASSERT(err && err->apr_err == SVN_ERR_WC_INVALID_OPERATION_DEPTH);
-    svn_error_clear(err);
-
-    err = revert(&b, "X", common, common);
-    SVN_TEST_ASSERT(err && err->apr_err == SVN_ERR_WC_INVALID_OPERATION_DEPTH);
-    svn_error_clear(err);
-  }
-
   return SVN_NO_ERROR;
 }