Author: rhuijben
Date: Tue Jun 15 13:38:12 2010
New Revision: 954880

URL: http://svn.apache.org/viewvc?rev=954880&view=rev
Log:
Use two wc-db operations instead of an entries call to implement a
commit-time conversion of a missing node to a not present
node. Also prepare this piece of code for complete removal by moving
the public api to deprecated.c and adding a #ifdef SINGLE_DB
implementation which just returns the 'not missing' error.

* subversion/libsvn_wc/deprecated.c
  (svn_wc_mark_missing_deleted): Move from entries.c to here. Add
    future error stub.

* subversion/libsvn_wc/entries.c
  (svn_wc__entry_modify_stub): Remove call from assertion.
  (svn_wc__temp_mark_missing_not_present): Use wc_db apis.
  (svn_wc_mark_missing_deleted): Move to deprecated.c

Modified:
    subversion/trunk/subversion/libsvn_wc/deprecated.c
    subversion/trunk/subversion/libsvn_wc/entries.c

Modified: subversion/trunk/subversion/libsvn_wc/deprecated.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/deprecated.c?rev=954880&r1=954879&r2=954880&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/deprecated.c (original)
+++ subversion/trunk/subversion/libsvn_wc/deprecated.c Tue Jun 15 13:38:12 2010
@@ -1963,6 +1963,35 @@ svn_wc_walk_entries(const char *path,
                               pool);
 }
 
+svn_error_t *
+svn_wc_mark_missing_deleted(const char *path,
+                            svn_wc_adm_access_t *parent,
+                            apr_pool_t *pool)
+{
+#if SINGLE_DB
+  /* With a single DB a node will never be missing */
+  return svn_error_createf(SVN_ERR_WC_PATH_FOUND, NULL,
+                           _("Unexpectedly found '%s': "
+                             "path is marked 'missing'"),
+                           svn_dirent_local_style(path, scratch_pool));
+#else
+  const char *local_abspath;
+  svn_wc_context_t *wc_ctx;
+
+  SVN_ERR(svn_wc__context_create_with_db(&wc_ctx, NULL,
+                                         svn_wc__adm_get_db(parent), pool));
+
+  SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, pool));
+
+  SVN_ERR(svn_wc__temp_mark_missing_not_present(local_abspath, wc_ctx, pool));
+
+  SVN_ERR(svn_wc_context_destroy(wc_ctx));
+
+  return SVN_NO_ERROR;
+#endif
+}
+
+
 /*** From props.c ***/
 svn_error_t *
 svn_wc_parse_externals_description2(apr_array_header_t **externals_p,

Modified: subversion/trunk/subversion/libsvn_wc/entries.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/entries.c?rev=954880&r1=954879&r2=954880&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/entries.c (original)
+++ subversion/trunk/subversion/libsvn_wc/entries.c Tue Jun 15 13:38:12 2010
@@ -3315,29 +3315,39 @@ svn_wc__temp_mark_missing_not_present(co
 {
   svn_wc__db_status_t status;
   svn_wc__db_kind_t kind;
+  const char *repos_relpath, *repos_root_url, *repos_uuid;
+  svn_revnum_t revision;
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
-  SVN_ERR(svn_wc__db_read_info(&status, &kind,
+  SVN_ERR(svn_wc__db_read_info(&status, &kind, &revision, &repos_relpath,
+                               &repos_root_url, &repos_uuid, NULL, NULL,
                                NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                                NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-                               NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-                               NULL,
+                               NULL, NULL,
                                wc_ctx->db, local_abspath,
                                scratch_pool, scratch_pool));
   if (kind == svn_wc__db_kind_dir
       && status == svn_wc__db_status_obstructed_delete)
     {
-      svn_wc_entry_t tmp_entry;
-
-      tmp_entry.deleted = TRUE;
-      tmp_entry.schedule = svn_wc_schedule_normal;
+      if (!repos_relpath)
+        SVN_ERR(svn_wc__db_scan_base_repos(&repos_relpath, &repos_root_url,
+                                           &repos_uuid,
+                                           wc_ctx->db, local_abspath,
+                                           scratch_pool, scratch_pool));
+
+      SVN_ERR(svn_wc__db_temp_op_remove_entry(wc_ctx->db, local_abspath,
+                                              scratch_pool));
+
+      if (!SVN_IS_VALID_REVNUM(revision))
+        revision = 0; /* Just make one up */
+
+      SVN_ERR(svn_wc__db_base_add_absent_node(wc_ctx->db, local_abspath,
+                                              repos_relpath, repos_root_url,
+                                              repos_uuid, revision,
+                                              svn_wc__db_kind_dir,
+                                              svn_wc__db_status_not_present,
+                                              NULL, NULL, scratch_pool));
 
-      SVN_ERR(svn_wc__entry_modify_stub(wc_ctx->db, local_abspath,
-                                        &tmp_entry,
-                                        (SVN_WC__ENTRY_MODIFY_DELETED
-                                         | SVN_WC__ENTRY_MODIFY_SCHEDULE
-                                         | SVN_WC__ENTRY_MODIFY_FORCE),
-                                        scratch_pool));
       return SVN_NO_ERROR;
     }
 
@@ -3346,23 +3356,3 @@ svn_wc__temp_mark_missing_not_present(co
                              "path is marked 'missing'"),
                            svn_dirent_local_style(local_abspath, 
scratch_pool));
 }
-
-svn_error_t *
-svn_wc_mark_missing_deleted(const char *path,
-                            svn_wc_adm_access_t *parent,
-                            apr_pool_t *pool)
-{
-  const char *local_abspath;
-  svn_wc_context_t *wc_ctx;
-
-  SVN_ERR(svn_wc__context_create_with_db(&wc_ctx, NULL,
-                                         svn_wc__adm_get_db(parent), pool));
-
-  SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, pool));
-
-  SVN_ERR(svn_wc__temp_mark_missing_not_present(local_abspath, wc_ctx, pool));
-
-  SVN_ERR(svn_wc_context_destroy(wc_ctx));
-
-  return SVN_NO_ERROR;
-}


Reply via email to