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/04/28 14:41:30 UTC

svn commit: r1097437 - in /subversion/trunk/subversion/libsvn_wc: adm_ops.c wc-queries.sql wc_db.c wc_db.h

Author: philip
Date: Thu Apr 28 12:41:30 2011
New Revision: 1097437

URL: http://svn.apache.org/viewvc?rev=1097437&view=rev
Log:
Conditionally hook up the new delete code to the rest of the code.
It works in some cases, but doesn't pass all the regression tests.

* subversion/libsvn_wc/wc-queries.sql
  (STMT_CREATE_DELETE_LIST, STMT_DROP_DELETE_LIST_TRIGGERS,
   STMT_SELECT_DELETE_LIST, STMT_DROP_DELETE_LIST): New.

* subversion/libsvn_wc/adm_ops.c
  (svn_wc_delete4): Add conditional code to use the new delete code.

* subversion/libsvn_wc/wc_db.c
  (svn_wc__db_op_delete): Wrap txn with triggers.
  (svn_wc__db_delete_list_notify): New.

* subversion/libsvn_wc/wc_db.h
  (svn_wc__db_op_delete): Document.
  (svn_wc__db_delete_list_notify): New.

Modified:
    subversion/trunk/subversion/libsvn_wc/adm_ops.c
    subversion/trunk/subversion/libsvn_wc/wc-queries.sql
    subversion/trunk/subversion/libsvn_wc/wc_db.c
    subversion/trunk/subversion/libsvn_wc/wc_db.h

Modified: subversion/trunk/subversion/libsvn_wc/adm_ops.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_ops.c?rev=1097437&r1=1097436&r2=1097437&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_ops.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_ops.c Thu Apr 28 12:41:30 2011
@@ -698,6 +698,13 @@ svn_wc_delete4(svn_wc_context_t *wc_ctx,
         break;
     }
 
+#ifdef SVN_NEW_DELETE
+  SVN_ERR(svn_wc__db_op_delete(db, local_abspath, pool));
+
+  if (notify_func)
+    SVN_ERR(svn_wc__db_delete_list_notify(notify_func, notify_baton,
+                                          db, local_abspath, pool));
+#else
   if (kind == svn_wc__db_kind_dir)
     {
       /* ### NODE_DATA We recurse into the subtree here, which is fine,
@@ -754,6 +761,7 @@ svn_wc_delete4(svn_wc_context_t *wc_ctx,
     (*notify_func)(notify_baton,
                    svn_wc_create_notify(local_abspath, svn_wc_notify_delete,
                                         pool), pool);
+#endif
 
   /* By the time we get here, anything that was scheduled to be added has
      become unversioned */

Modified: subversion/trunk/subversion/libsvn_wc/wc-queries.sql
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc-queries.sql?rev=1097437&r1=1097436&r2=1097437&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Thu Apr 28 12:41:30 2011
@@ -1114,6 +1114,29 @@ ORDER BY local_relpath
 DELETE FROM revert_list
 WHERE local_relpath = ?1 OR local_relpath LIKE ?2 ESCAPE '#'
 
+-- STMT_CREATE_DELETE_LIST
+DROP TABLE IF EXISTS delete_list;
+CREATE TEMPORARY TABLE delete_list (
+   local_relpath TEXT PRIMARY KEY
+   );
+DROP TRIGGER IF EXISTS trigger_delete_list_nodes;
+CREATE TEMPORARY TRIGGER trigger_delete_list_nodes
+AFTER INSERT ON nodes
+BEGIN
+   INSERT INTO delete_list(local_relpath)
+   SELECT NEW.local_relpath;
+END
+
+-- STMT_DROP_DELETE_LIST_TRIGGERS
+DROP TRIGGER IF EXISTS trigger_delete_list_nodes
+
+-- STMT_SELECT_DELETE_LIST
+SELECT local_relpath FROM delete_list
+ORDER BY local_relpath
+
+-- STMT_DROP_DELETE_LIST
+DROP TABLE delete_list
+
 
 /* ------------------------------------------------------------------------- */
 

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1097437&r1=1097436&r2=1097437&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Thu Apr 28 12:41:30 2011
@@ -5212,6 +5212,8 @@ svn_wc__db_op_delete(svn_wc__db_t *db,
   svn_wc__db_wcroot_t *wcroot;
   const char *local_relpath;
   struct op_delete_baton_t b;
+  struct with_triggers_baton_t wtb = { STMT_CREATE_DELETE_LIST,
+                                       STMT_DROP_DELETE_LIST_TRIGGERS };
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
 
@@ -5220,8 +5222,10 @@ svn_wc__db_op_delete(svn_wc__db_t *db,
   VERIFY_USABLE_WCROOT(wcroot);
 
   b.delete_depth = relpath_depth(local_relpath);
+  wtb.cb_baton = &b;
+  wtb.cb_func = op_delete_txn;
 
-  SVN_ERR(svn_wc__db_with_txn(wcroot, local_relpath, op_delete_txn, &b,
+  SVN_ERR(svn_wc__db_with_txn(wcroot, local_relpath, with_triggers, &wtb,
                               scratch_pool));
 
   SVN_ERR(flush_entries(wcroot, local_abspath, scratch_pool));
@@ -5229,6 +5233,50 @@ svn_wc__db_op_delete(svn_wc__db_t *db,
   return SVN_NO_ERROR;
 }
 
+svn_error_t *
+svn_wc__db_delete_list_notify(svn_wc_notify_func2_t notify_func,
+                              void *notify_baton,
+                              svn_wc__db_t *db,
+                              const char *local_abspath,
+                              apr_pool_t *scratch_pool)
+{
+  svn_wc__db_wcroot_t *wcroot;
+  const char *local_relpath;
+  svn_sqlite__stmt_t *stmt;
+  svn_boolean_t have_row;
+  apr_pool_t *iterpool = svn_pool_create(scratch_pool);
+
+  SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
+
+  SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath,
+                              db, local_abspath, scratch_pool, iterpool));
+  VERIFY_USABLE_WCROOT(wcroot);
+
+  SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
+                                    STMT_SELECT_DELETE_LIST));
+  SVN_ERR(svn_sqlite__step(&have_row, stmt));
+  while (have_row)
+    {
+      const char *notify_relpath = svn_sqlite__column_text(stmt, 0, NULL);
+      const char *notify_abspath = svn_dirent_join(wcroot->abspath,
+                                                   notify_relpath,
+                                                   iterpool);
+      notify_func(notify_baton,
+                  svn_wc_create_notify(notify_abspath,
+                                       svn_wc_notify_delete,
+                                       iterpool),
+                  iterpool);
+
+      SVN_ERR(svn_sqlite__step(&have_row, stmt));
+    }
+
+  SVN_ERR(svn_sqlite__reset(stmt));
+
+  SVN_ERR(svn_sqlite__exec_statements(wcroot->sdb, STMT_DROP_DELETE_LIST));
+
+  return SVN_NO_ERROR;
+}
+
 
 /* Like svn_wc__db_read_info(), but taking WCROOT+LOCAL_RELPATH instead of
    DB+LOCAL_ABSPATH, and outputting repos ids instead of URL+UUID. */

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=1097437&r1=1097436&r2=1097437&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Thu Apr 28 12:41:30 2011
@@ -1212,13 +1212,27 @@ svn_wc__db_temp_working_set_props(svn_wc
                                   apr_pool_t *scratch_pool);
 #endif
 
-/* ### KFF: This handles files, dirs, symlinks, anything else? */
-/* ### dlr: Does this support recursive dir deletes (e.g. _revert)? Document. */
+/* Delete LOCAL_ABSPATH and all children from the database.
+ *
+ * This function populates the delete list.
+ */
 svn_error_t *
 svn_wc__db_op_delete(svn_wc__db_t *db,
                      const char *local_abspath,
                      apr_pool_t *scratch_pool);
 
+/* Make delete notifications for all paths in the delete list created
+ * by deleting LOCAL_ABSPATH.
+ *
+ * This function drops the delete list.
+ */
+svn_error_t *
+svn_wc__db_delete_list_notify(svn_wc_notify_func2_t notify_func,
+                              void *notify_baton,
+                              svn_wc__db_t *db,
+                              const char *local_abspath,
+                              apr_pool_t *scratch_pool);
+
 
 /* ### KFF: Would like to know behavior when dst_path already exists
    ### and is a) a dir or b) a non-dir. */