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/01 20:49:40 UTC

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

Author: philip
Date: Mon Nov  1 19:49:40 2010
New Revision: 1029808

URL: http://svn.apache.org/viewvc?rev=1029808&view=rev
Log:
When removing one op_depth layer the underlying layers should remain.

* subversion/libsvn_wc/wc-queries.sql
  (STMT_DELETE_OP_DEPTH_NODES): New.

* subversion/libsvn_wc/wc_db.c
  (db_working_actual_remove): Only remove the single op_depth.
  (db_working_update_presence): Add comment about ACTUAL.

* subversion/tests/libsvn_wc/op-depth-test.c
  (test_deletes_of_copies): Extend.

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=1029808&r1=1029807&r2=1029808&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Mon Nov  1 19:49:40 2010
@@ -295,6 +295,10 @@ WHERE wc_id = ?1 AND local_relpath = ?2 
 DELETE FROM nodes
 WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth > 0;
 
+-- STMT_DELETE_OP_DEPTH_NODES
+DELETE FROM nodes
+WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = ?3;
+
 -- STMT_DELETE_NODES
 DELETE FROM nodes
 WHERE wc_id = ?1 AND local_relpath = ?2;

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1029808&r1=1029807&r2=1029808&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Mon Nov  1 19:49:40 2010
@@ -4575,23 +4575,31 @@ db_working_update_presence(svn_wc__db_st
   if (status == svn_wc__db_status_base_deleted)
     SVN_ERR(delete_not_present_children(pdh, local_relpath, scratch_pool));
 
+  /* ### Should the switch to not-present remove an ACTUAL row? */
+
   return SVN_NO_ERROR;
 }
 
 
 /* Delete working and actual nodes for LOCAL_ABSPATH.  When called any
-   remain working child sub-trees should be presence=not-present and will
-   be deleted. */
+   remaining working child sub-trees should be presence=not-present
+   and will be deleted. */
 static svn_error_t *
 db_working_actual_remove(svn_wc__db_pdh_t *pdh,
                          const char *local_relpath,
                          apr_pool_t *scratch_pool)
 {
   svn_sqlite__stmt_t *stmt;
+#ifdef SVN_WC__OP_DEPTH
+  apr_int64_t op_depth = relpath_depth(local_relpath);
+#else
+  apr_int64_t op_depth = 2;  /* ### temporary op_depth */
+#endif
 
   SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
-                                    STMT_DELETE_WORKING_NODES));
-  SVN_ERR(svn_sqlite__bindf(stmt, "is", pdh->wcroot->wc_id, local_relpath));
+                                    STMT_DELETE_OP_DEPTH_NODES));
+  SVN_ERR(svn_sqlite__bindf(stmt, "isi", pdh->wcroot->wc_id,
+                            local_relpath, op_depth));
   SVN_ERR(svn_sqlite__step_done(stmt));
 
   SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,

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=1029808&r1=1029807&r2=1029808&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c Mon Nov  1 19:49:40 2010
@@ -656,9 +656,63 @@ test_delete_of_copies(const svn_test_opt
                                         "deletes", opts, pool));
   SVN_ERR(svn_wc_context_create(&b.wc_ctx, NULL, pool, pool));
   SVN_ERR(add_and_commit_greek_tree(&b));
-
   SVN_ERR(wc_copy(&b, "A/B", "A/B-copied"));
-  SVN_ERR(wc_delete(&b, "A/B-copied/E"));
+
+  SVN_ERR(svn_wc_delete4(b.wc_ctx, wc_path(&b, "A/B-copied/E"),
+                         FALSE, TRUE, NULL, NULL, NULL, NULL, pool));
+  {
+    nodes_row_t rows[] = {
+      { 2, "A/B-copied/E",       "not-present",       1, "A/B/E" },
+      { 2, "A/B-copied/E/alpha", "not-present",       NO_COPY_FROM},
+      { 2, "A/B-copied/E/beta",  "not-present",       NO_COPY_FROM},
+      { 0 }
+    };
+    SVN_ERR(check_db_rows(&b, "A/B-copied/E", rows));
+  }
+
+  SVN_ERR(wc_copy(&b, "A/D/G", "A/B-copied/E"));
+  {
+    nodes_row_t rows[] = {
+      { 2, "A/B-copied/E",       "not-present",       1, "A/B/E" },
+      { 2, "A/B-copied/E/alpha", "not-present",       NO_COPY_FROM},
+      { 2, "A/B-copied/E/beta",  "not-present",       NO_COPY_FROM},
+      { 3, "A/B-copied/E",       "normal",            1, "A/D/G" },
+      { 3, "A/B-copied/E/pi",    "normal",            NO_COPY_FROM},
+      { 3, "A/B-copied/E/rho",   "normal",            NO_COPY_FROM},
+      { 3, "A/B-copied/E/tau",   "normal",            NO_COPY_FROM},
+      { 0 }
+    };
+    SVN_ERR(check_db_rows(&b, "A/B-copied/E", rows));
+  }
+
+  SVN_ERR(svn_wc_delete4(b.wc_ctx, wc_path(&b, "A/B-copied/E/rho"),
+                         FALSE, TRUE, NULL, NULL, NULL, NULL, pool));
+  {
+    nodes_row_t rows[] = {
+      { 2, "A/B-copied/E",       "not-present",       1, "A/B/E" },
+      { 2, "A/B-copied/E/alpha", "not-present",       NO_COPY_FROM},
+      { 2, "A/B-copied/E/beta",  "not-present",       NO_COPY_FROM},
+      { 3, "A/B-copied/E",       "normal",            1, "A/D/G" },
+      { 3, "A/B-copied/E/pi",    "normal",            NO_COPY_FROM},
+      { 3, "A/B-copied/E/rho",   "not-present",       NO_COPY_FROM},
+      { 3, "A/B-copied/E/tau",   "normal",            NO_COPY_FROM},
+      { 0 }
+    };
+    SVN_ERR(check_db_rows(&b, "A/B-copied/E", rows));
+  }
+
+  SVN_ERR(svn_wc_delete4(b.wc_ctx, wc_path(&b, "A/B-copied/E"),
+                         FALSE, TRUE, NULL, NULL, NULL, NULL, pool));
+  {
+    nodes_row_t rows[] = {
+      { 2, "A/B-copied/E",       "not-present",       1, "A/B/E" },
+      { 2, "A/B-copied/E/alpha", "not-present",       NO_COPY_FROM},
+      { 2, "A/B-copied/E/beta",  "not-present",       NO_COPY_FROM},
+      { 0 }
+    };
+    SVN_ERR(check_db_rows(&b, "A/B-copied/E", rows));
+  }
+
   SVN_ERR(wc_copy(&b, "A/B", "A/B-copied/E"));
 
   SVN_ERR(svn_wc_delete4(b.wc_ctx, wc_path(&b, "A/B-copied/E/F"),