subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From phi...@apache.org
Subject svn commit: r1069001 - in /subversion/trunk/subversion: libsvn_wc/wc_db.c libsvn_wc/wc_db.h tests/libsvn_wc/op-depth-test.c
Date Wed, 09 Feb 2011 17:54:02 GMT
Author: philip
Date: Wed Feb  9 17:54:02 2011
New Revision: 1069001

URL: http://svn.apache.org/viewvc?rev=1069001&view=rev
Log:
The new revert is non-recursive in the database so remove the depth
parameter.  Allow actual-only revert.

* subversion/libsvn_wc/wc_db.c
  (svn_wc__db_op_revert): Remove depth parameter, allow actual-only revert.

* subversion/libsvn_wc/wc_db.h
  (svn_wc__db_op_revert_actual): Restore previous docstring.
  (svn_wc__db_op_revert): Move docstring here, remove depth parameter.

* subversion/tests/libsvn_wc/op-depth-test.c
  (revert): Remove depth parameter.
  (test_op_revert): Don't pass depth.

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=1069001&r1=1069000&r2=1069001&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Wed Feb  9 17:54:02 2011
@@ -3574,69 +3574,70 @@ op_revert_txn(void *baton, svn_sqlite__d
   status = svn_sqlite__column_token(stmt, 3, presence_map);
   SVN_ERR(svn_sqlite__reset(stmt));
 
-  if (!op_depth)
-    return SVN_NO_ERROR;
-
-  if (op_depth != relpath_depth(b->local_relpath))
-    return svn_error_createf(SVN_ERR_WC_INVALID_OPERATION_DEPTH, NULL,
-                             _("Can't revert tree change for '%s' without"
-                               " reverting parent"),
-                             path_for_error_message(b->pdh->wcroot,
-                                                    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));
+  if (op_depth > 0)
+    {
+      if (op_depth != relpath_depth(b->local_relpath))
+        return svn_error_createf(SVN_ERR_WC_INVALID_OPERATION_DEPTH, NULL,
+                                 _("Can't revert tree change for '%s' without"
+                                   " reverting parent"),
+                                 path_for_error_message(b->pdh->wcroot,
+                                                        b->local_relpath,
+                                                        scratch_pool));
 
-  /* Do the revert */
-  SVN_ERR(svn_sqlite__get_statement(&stmt, b->pdh->wcroot->sdb,
-                                    STMT_DELETE_ACTUAL_NODE));
-  SVN_ERR(svn_sqlite__bindf(stmt, "is", b->pdh->wcroot->wc_id,
-                            b->local_relpath));
-  SVN_ERR(svn_sqlite__step_done(stmt));
+      /* 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));
+      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));
-    }
-  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);
+      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));
+        }
+      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);
+          
+          SVN_ERR(svn_sqlite__get_statement(&stmt, b->pdh->wcroot->sdb,
+                                      STMT_UPDATE_OP_DEPTH_INCREASE_RECURSIVE));
+          SVN_ERR(svn_sqlite__bindf(stmt, "isi", b->pdh->wcroot->wc_id,
+                                    like_arg, op_depth));
+          SVN_ERR(svn_sqlite__step_done(stmt));
+        }
 
       SVN_ERR(svn_sqlite__get_statement(&stmt, b->pdh->wcroot->sdb,
-                                      STMT_UPDATE_OP_DEPTH_INCREASE_RECURSIVE));
-      SVN_ERR(svn_sqlite__bindf(stmt, "isi",
-                                b->pdh->wcroot->wc_id, like_arg, op_depth));
+                                        STMT_DELETE_WORKING_NODE));
+      SVN_ERR(svn_sqlite__bindf(stmt, "is", b->pdh->wcroot->wc_id,
+                                b->local_relpath));
       SVN_ERR(svn_sqlite__step_done(stmt));
     }
 
   SVN_ERR(svn_sqlite__get_statement(&stmt, b->pdh->wcroot->sdb,
-                                    STMT_DELETE_WORKING_NODE));
+                                    STMT_DELETE_ACTUAL_NODE));
   SVN_ERR(svn_sqlite__bindf(stmt, "is", b->pdh->wcroot->wc_id,
                             b->local_relpath));
   SVN_ERR(svn_sqlite__step_done(stmt));
@@ -3648,7 +3649,6 @@ op_revert_txn(void *baton, svn_sqlite__d
 svn_error_t *
 svn_wc__db_op_revert(svn_wc__db_t *db,
                      const char *local_abspath,
-                     svn_depth_t depth,
                      apr_pool_t *scratch_pool)
 {
   struct op_revert_baton b;

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=1069001&r1=1069000&r2=1069001&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Wed Feb  9 17:54:02 2011
@@ -1235,13 +1235,6 @@ svn_wc__db_op_mark_resolved(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.
- *
- * 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.
  */
 svn_error_t *
 svn_wc__db_op_revert_actual(svn_wc__db_t *db,
@@ -1250,10 +1243,19 @@ 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.
+ *
+ * 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.
+ */
 svn_error_t *
 svn_wc__db_op_revert(svn_wc__db_t *db,
                      const char *local_abspath,
-                     svn_depth_t depth,
                      apr_pool_t *scratch_pool);
 
 

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=1069001&r1=1069000&r2=1069001&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:54:02 2011
@@ -1919,7 +1919,6 @@ test_del_replace_not_present(const svn_t
 static svn_error_t *
 revert(wc_baton_t *b,
        const char *local_relpath,
-       svn_depth_t depth,
        nodes_row_t *before,
        nodes_row_t *after)
 {
@@ -1928,7 +1927,7 @@ revert(wc_baton_t *b,
 
   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);
+  err = svn_wc__db_op_revert(b->wc_ctx->db, local_abspath, b->pool);
   if (err)
     /* If db_op_revert returns an error the DB should be unchanged so
        verify and return a verification error if a change is detected
@@ -1961,7 +1960,7 @@ test_op_revert(const svn_test_opts_t *op
       { 0, "A",   "normal", 4, "A" },
       { 0 },
     };
-    SVN_ERR(revert(&b, "A/B", svn_depth_infinity, before, after));
+    SVN_ERR(revert(&b, "A/B", before, after));
   }
 
   {
@@ -1978,7 +1977,7 @@ test_op_revert(const svn_test_opts_t *op
       { 0, "A",   "normal", 4, "A" },
       { 0 },
     };
-    SVN_ERR(revert(&b, "A/B", svn_depth_infinity, before, after));
+    SVN_ERR(revert(&b, "A/B", before, after));
   }
 
   {
@@ -1997,7 +1996,7 @@ test_op_revert(const svn_test_opts_t *op
       { 0, "A/B/C",   "normal", 4, "A/B" },
       { 0 },
     };
-    SVN_ERR(revert(&b, "A/B/C", svn_depth_infinity, before, after));
+    SVN_ERR(revert(&b, "A/B/C", before, after));
   }
 
   {
@@ -2018,7 +2017,7 @@ test_op_revert(const svn_test_opts_t *op
       { 3, "A/B/C",   "base-deleted", NO_COPY_FROM },
       { 0 },
     };
-    SVN_ERR(revert(&b, "A/B", svn_depth_infinity, before, after));
+    SVN_ERR(revert(&b, "A/B", before, after));
   }
 
   {
@@ -2034,11 +2033,11 @@ test_op_revert(const svn_test_opts_t *op
       { 0 },
     };
 
-    err = revert(&b, "A/B/C", svn_depth_infinity, common, common);
+    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", svn_depth_infinity, common, common);
+    err = revert(&b, "X", common, common);
     SVN_TEST_ASSERT(err && err->apr_err == SVN_ERR_WC_INVALID_OPERATION_DEPTH);
     svn_error_clear(err);
   }



Mime
View raw message