Author: rhuijben
Date: Wed Jul 28 14:44:19 2010
New Revision: 980075

URL: http://svn.apache.org/viewvc?rev=980075&view=rev
Log:
For WC-NG single db: Make 'svn rm DIR' directly remove the on-disk
directory, instead of scheduling it for delete at commit time.

This patch will make a few more tests fail for single-db, but brings
the status of single-db much further towards the final 1.7 behavior.

* subversion/libsvn_wc/adm_ops.c
  (erase_unversioned_from_wc): Allow ignoring missing files and
    directories.
  (erase_from_wc): Unused when using single-db. Update caller.
  (svn_wc_delete4): Keep 'svn rm not-versioned' an error, but allow
    'svn rm missing-file'. In single-db mode don't record keep-local,
    but just delete directories and anything below when not using
    keep-local.

* subversion/libsvn_wc/entries.c
  (read_one_entry): Set keep_local to TRUE on a directory, when it is deleted
    but still exists and keep it false in all other cases.

* subversion/libsvn_wc/node.c
  (svn_wc__temp_get_keep_local): In single-db mode, always return false.

* subversion/libsvn_wc/wc_db.c
  (svn_wc__db_temp_determine_keep_local,
   svn_wc__db_temp_set_keep_local): #ifdef these functions for !SINGLE-DB

* subversion/libsvn_wc/wc_db.h
  (svn_wc__db_temp_determine_keep_local,
   svn_wc__db_temp_set_keep_local): #ifdef these functions for !SINGLE-DB

* subversion/libsvn_wc/workqueue.c
  (run_killme,
   svn_wc__wq_add_killme): #ifdef for !SINGLE-DB
  (run_deletion_postcommit): In single db mode we can handle directories
    exactly like files. Add note on switched nodes.
  (dispatch_table): Remove OP_KILLME for !SINGLE-DB

* subversion/libsvn_wc/workqueue.h
  (run_killme,
   svn_wc__wq_add_killme): #ifdef for !SINGLE-DB

Modified:
    subversion/trunk/subversion/include/private/svn_wc_private.h
    subversion/trunk/subversion/libsvn_wc/adm_ops.c
    subversion/trunk/subversion/libsvn_wc/entries.c
    subversion/trunk/subversion/libsvn_wc/node.c
    subversion/trunk/subversion/libsvn_wc/wc_db.c
    subversion/trunk/subversion/libsvn_wc/wc_db.h
    subversion/trunk/subversion/libsvn_wc/workqueue.c
    subversion/trunk/subversion/libsvn_wc/workqueue.h

Modified: subversion/trunk/subversion/include/private/svn_wc_private.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_wc_private.h?rev=980075&r1=980074&r2=980075&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_wc_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_wc_private.h Wed Jul 28 
14:44:19 2010
@@ -701,7 +701,10 @@ svn_wc__temp_mark_missing_not_present(co
                                       apr_pool_t *scratch_pool);
 
 /* Return the @a *keep_local flag for local_abspath. (This flag will
-   go away once we have a consolidated administrative area) */
+   go away once we have a consolidated administrative area. In that
+   case it will always return FALSE.) 
+
+   ### Only used by the commit processing in libsvn_client */
 svn_error_t *
 svn_wc__temp_get_keep_local(svn_boolean_t *keep_local,
                             svn_wc_context_t *wc_ctx,

Modified: subversion/trunk/subversion/libsvn_wc/adm_ops.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_ops.c?rev=980075&r1=980074&r2=980075&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_ops.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_ops.c Wed Jul 28 14:44:19 2010
@@ -527,25 +527,29 @@ svn_wc_process_committed_queue2(svn_wc_c
  * from the physical filesystem. PATH is assumed to be an unversioned file
  * or directory.
  *
+ * If ignore_enoent is TRUE, ignore missing targets.
+ *
  * If CANCEL_FUNC is non-null, invoke it with CANCEL_BATON at various
  * points, return any error immediately.
  */
 static svn_error_t *
 erase_unversioned_from_wc(const char *path,
+                          svn_boolean_t ignore_enoent,
                           svn_cancel_func_t cancel_func,
                           void *cancel_baton,
-                          apr_pool_t *pool)
+                          apr_pool_t *scratch_pool)
 {
   svn_error_t *err;
 
   /* Optimize the common case: try to delete the file */
-  err = svn_io_remove_file2(path, FALSE, pool);
+  err = svn_io_remove_file2(path, ignore_enoent, scratch_pool);
   if (err)
     {
       /* Then maybe it was a directory? */
       svn_error_clear(err);
 
-      err = svn_io_remove_dir2(path, FALSE, cancel_func, cancel_baton, pool);
+      err = svn_io_remove_dir2(path, ignore_enoent, cancel_func, cancel_baton,
+                               scratch_pool);
 
       if (err)
         {
@@ -555,20 +559,22 @@ erase_unversioned_from_wc(const char *pa
           svn_node_kind_t kind;
 
           svn_error_clear(err);
-          SVN_ERR(svn_io_check_path(path, &kind, pool));
+          SVN_ERR(svn_io_check_path(path, &kind, scratch_pool));
           if (kind == svn_node_file)
-            SVN_ERR(svn_io_remove_file2(path, FALSE, pool));
+            SVN_ERR(svn_io_remove_file2(path, ignore_enoent, scratch_pool));
           else if (kind == svn_node_dir)
-            SVN_ERR(svn_io_remove_dir2(path, FALSE,
-                                       cancel_func, cancel_baton, pool));
+            SVN_ERR(svn_io_remove_dir2(path, ignore_enoent,
+                                       cancel_func, cancel_baton,
+                                       scratch_pool));
           else if (kind == svn_node_none)
             return svn_error_createf(SVN_ERR_BAD_FILENAME, NULL,
                                      _("'%s' does not exist"),
-                                     svn_dirent_local_style(path, pool));
+                                     svn_dirent_local_style(path,
+                                                            scratch_pool));
           else
             return svn_error_createf(SVN_ERR_UNSUPPORTED_FEATURE, NULL,
                                      _("Unsupported node kind for path '%s'"),
-                                     svn_dirent_local_style(path, pool));
+                                     svn_dirent_local_style(path, 
scratch_pool));
 
         }
     }
@@ -576,6 +582,7 @@ erase_unversioned_from_wc(const char *pa
   return SVN_NO_ERROR;
 }
 
+#ifndef SVN_WC__SINGLE_DB
 /* Remove/erase LOCAL_ABSPATH from the working copy. For files this involves
  * deletion from the physical filesystem.  For directories it involves the
  * deletion from the filesystem of all unversioned children, and all
@@ -696,6 +703,7 @@ erase_from_wc(svn_wc__db_t *db,
 
           SVN_ERR(erase_unversioned_from_wc(svn_dirent_join(local_abspath,
                                                             name, iterpool),
+                                            FALSE,
                                             cancel_func, cancel_baton,
                                             iterpool));
         }
@@ -705,7 +713,7 @@ erase_from_wc(svn_wc__db_t *db,
 
   return SVN_NO_ERROR;
 }
-
+#endif
 
 svn_error_t *
 svn_wc_delete4(svn_wc_context_t *wc_ctx,
@@ -737,7 +745,7 @@ svn_wc_delete4(svn_wc_context_t *wc_ctx,
       svn_error_clear(err);
 
       if (!keep_local)
-        SVN_ERR(erase_unversioned_from_wc(local_abspath,
+        SVN_ERR(erase_unversioned_from_wc(local_abspath, FALSE,
                                           cancel_func, cancel_baton,
                                           pool));
       return SVN_NO_ERROR;
@@ -824,8 +832,10 @@ svn_wc_delete4(svn_wc_context_t *wc_ctx,
              Luckily most of this is for free once properties and pristine
              are handled in the WC-NG way. */
       SVN_ERR(svn_wc__db_temp_op_delete(wc_ctx->db, local_abspath, pool));
+#ifndef SVN_WC__SINGLE_DB
       if (keep_local)
         SVN_ERR(svn_wc__db_temp_set_keep_local(db, local_abspath, TRUE, pool));
+#endif
     }
 
   /* Report the deletion to the caller. */
@@ -852,13 +862,15 @@ svn_wc_delete4(svn_wc_context_t *wc_ctx,
      become unversioned */
   if (!keep_local)
     {
-      if (was_add)
-        SVN_ERR(erase_unversioned_from_wc(local_abspath,
-                                          cancel_func, cancel_baton,
-                                          pool));
-      else
+#ifndef SVN_WC__SINGLE_DB
+      if (!was_add)
         SVN_ERR(erase_from_wc(wc_ctx->db, local_abspath, kind,
                               cancel_func, cancel_baton, pool));
+      else
+#endif
+        SVN_ERR(erase_unversioned_from_wc(local_abspath, TRUE,
+                                          cancel_func, cancel_baton,
+                                          pool));
     }
 
   return SVN_NO_ERROR;

Modified: subversion/trunk/subversion/libsvn_wc/entries.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/entries.c?rev=980075&r1=980074&r2=980075&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/entries.c (original)
+++ subversion/trunk/subversion/libsvn_wc/entries.c Wed Jul 28 14:44:19 2010
@@ -651,6 +651,9 @@ read_one_entry(const svn_wc_entry_t **ne
   else if (status == svn_wc__db_status_deleted
            || status == svn_wc__db_status_obstructed_delete)
     {
+#ifdef SVN_WC__SINGLE_DB
+      svn_node_kind_t path_kind;
+#endif
       /* ### we don't have to worry about moves, so this is a delete. */
       entry->schedule = svn_wc_schedule_delete;
 
@@ -668,10 +671,23 @@ read_one_entry(const svn_wc_entry_t **ne
          remove working copy directories directly. So any left over
          directories after the delete operation are always kept locally.
       */
+#ifndef SVN_WC__SINGLE_DB
       if (*entry->name == '\0')
         SVN_ERR(svn_wc__db_temp_determine_keep_local(&entry->keep_local,
                                                      db, entry_abspath,
                                                      scratch_pool));
+#else
+      /* If there is still a directory on-disk we keep it, if not it is
+         already deleted. Simple, isn't it? 
+         
+         Before single-db we had to keep the administative area alive until
+         after the commit really deletes it. Setting keep alive stopped the
+         commit processing from deleting the directory. We don't delete it
+         any more, so all we have to do is provide some 'sane' value.
+       */
+      SVN_ERR(svn_io_check_path(entry_abspath, &path_kind, scratch_pool));
+      entry->keep_local = (path_kind == svn_node_dir);
+#endif
     }
   else if (status == svn_wc__db_status_added
            || status == svn_wc__db_status_obstructed_add)

Modified: subversion/trunk/subversion/libsvn_wc/node.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/node.c?rev=980075&r1=980074&r2=980075&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/node.c (original)
+++ subversion/trunk/subversion/libsvn_wc/node.c Wed Jul 28 14:44:19 2010
@@ -1210,12 +1210,14 @@ svn_wc__temp_get_keep_local(svn_boolean_
 {
   svn_boolean_t is_deleted;
 
+#ifndef SVN_WC__SINGLE_DB
   SVN_ERR(svn_wc__node_is_status_deleted(&is_deleted, wc_ctx, local_abspath,
                                          scratch_pool));
   if (is_deleted)
     SVN_ERR(svn_wc__db_temp_determine_keep_local(keep_local, wc_ctx->db,
                                                  local_abspath, scratch_pool));
   else
+#endif
     *keep_local = FALSE;
 
   return SVN_NO_ERROR;

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=980075&r1=980074&r2=980075&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Wed Jul 28 14:44:19 2010
@@ -7585,6 +7585,7 @@ svn_wc__db_temp_is_dir_deleted(svn_boole
   return svn_error_return(svn_sqlite__reset(stmt));
 }
 
+#ifndef SVN_WC__SINGLE_DB
 svn_error_t *
 svn_wc__db_temp_determine_keep_local(svn_boolean_t *keep_local,
                                      svn_wc__db_t *db,
@@ -7631,6 +7632,7 @@ svn_wc__db_temp_set_keep_local(svn_wc__d
 
   return svn_error_return(svn_sqlite__step_done(stmt));
 }
+#endif
 
 svn_error_t *
 svn_wc__db_read_conflict_victims(const apr_array_header_t **victims,

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=980075&r1=980074&r2=980075&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Wed Jul 28 14:44:19 2010
@@ -2284,6 +2284,7 @@ svn_wc__db_temp_is_dir_deleted(svn_boole
                                const char *local_abspath,
                                apr_pool_t *scratch_pool);
 
+#ifndef SVN_WC__SINGLE_DB
 /* For a deleted node, determine its keep_local flag. (This flag will
    go away once we have a consolidated administrative area) */
 svn_error_t *
@@ -2299,6 +2300,7 @@ svn_wc__db_temp_set_keep_local(svn_wc__d
                                const char *local_abspath,
                                svn_boolean_t keep_local,
                                apr_pool_t *scratch_pool);
+#endif
 
 /* Removes all references of LOCAL_ABSPATH from its working copy
    using DB. */

Modified: subversion/trunk/subversion/libsvn_wc/workqueue.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/workqueue.c?rev=980075&r1=980074&r2=980075&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/workqueue.c (original)
+++ subversion/trunk/subversion/libsvn_wc/workqueue.c Wed Jul 28 14:44:19 2010
@@ -504,7 +504,7 @@ svn_wc__wq_add_revert(svn_boolean_t *wil
 }
 
 /* ------------------------------------------------------------------------ */
-
+#ifndef SVN_WC__SINGLE_DB
 /* OP_KILLME  */
 
 /* Process the OP_KILLME work item WORK_ITEM.
@@ -627,7 +627,7 @@ svn_wc__wq_add_killme(svn_wc__db_t *db,
 
   return SVN_NO_ERROR;
 }
-
+#endif
 
 /* ------------------------------------------------------------------------ */
 
@@ -721,6 +721,7 @@ run_deletion_postcommit(svn_wc__db_t *db
       const char *repos_uuid;
       svn_revnum_t parent_revision;
 
+#ifndef SVN_WC__SINGLE_DB
       /* If we are suppose to delete "this dir", drop a 'killme' file
          into my own administrative dir as a signal for svn_wc__run_log()
          to blow away the administrative area after it is finished
@@ -752,6 +753,7 @@ run_deletion_postcommit(svn_wc__db_t *db
                                     keep_local /* adm_only */,
                                     scratch_pool));
         }
+#endif
 
       /* Get hold of repository info, if we are going to need it,
          before deleting the file, */
@@ -772,7 +774,9 @@ run_deletion_postcommit(svn_wc__db_t *db
                 db, local_abspath,
                 FALSE, FALSE, cancel_func, cancel_baton, scratch_pool));
 
-      /* If the parent entry's working rev 'lags' behind new_rev... */
+      /* If the parent entry's working rev 'lags' behind new_rev... 
+         ### Maybe we should also add a not-present node if the
+         ### deleted node was switched? */
       if (new_revision > parent_revision)
         {
           /* ...then the parent's revision is now officially a
@@ -2290,7 +2294,6 @@ svn_wc__wq_build_pristine_get_translated
 
 static const struct work_item_dispatch dispatch_table[] = {
   { OP_REVERT, run_revert },
-  { OP_KILLME, run_killme },
   { OP_LOGGY, run_loggy },
   { OP_DELETION_POSTCOMMIT, run_deletion_postcommit },
   { OP_POSTCOMMIT, run_postcommit },
@@ -2305,6 +2308,10 @@ static const struct work_item_dispatch d
   { OP_TMP_SET_PROPERTY_CONFLICT_MARKER, run_set_property_conflict_marker },
   { OP_PRISTINE_GET_TRANSLATED, run_pristine_get_translated },
 
+#ifndef SVN_WC__SINGLE_DB
+  { OP_KILLME, run_killme },
+#endif
+
 /* See props.h  */
 #ifdef SVN__SUPPORT_BASE_MERGE
   { OP_INSTALL_PROPERTIES, run_install_properties },

Modified: subversion/trunk/subversion/libsvn_wc/workqueue.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/workqueue.h?rev=980075&r1=980074&r2=980075&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/workqueue.h (original)
+++ subversion/trunk/subversion/libsvn_wc/workqueue.h Wed Jul 28 14:44:19 2010
@@ -196,6 +196,7 @@ svn_wc__wq_add_revert(svn_boolean_t *wil
                       svn_boolean_t use_commit_times,
                       apr_pool_t *scratch_pool);
 
+#ifndef SVN_WC__SINGLE_DB
 /* Handle the old "KILLME" concept -- perform the actual deletion of a
    subdir (or just its admin area) during post-commit processing of a
    deleted subdir.  */
@@ -204,6 +205,7 @@ svn_wc__wq_add_killme(svn_wc__db_t *db,
                       const char *adm_abspath,
                       svn_boolean_t adm_only,
                       apr_pool_t *scratch_pool);
+#endif
 
 
 /* ### temporary compat for mapping the old loggy into workqueue space.


Reply via email to