subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1100375 - in /subversion/trunk/subversion: libsvn_client/copy.c libsvn_wc/adm_files.c libsvn_wc/node.c libsvn_wc/wc_db.c libsvn_wc/wc_db.h
Date Fri, 06 May 2011 21:08:17 GMT
Author: rhuijben
Date: Fri May  6 21:08:16 2011
New Revision: 1100375

URL: http://svn.apache.org/viewvc?rev=1100375&view=rev
Log:
Remove one of the ugliest wc_db temp apis, that still survived from the
multi-db time: svn_wc__db_temp_forget_directory.

* subversion/libsvn_client/copy.c
  (repos_to_wc_copy_single): Only use svn_wc__rename_wc when renaming a working
    copy; not as an alias for svn_io_file_rename.

* subversion/libsvn_wc/adm_files.c
  (svn_wc__adm_destroy): Use svn_wc__db_drop_root if we are asked to
    destroy the root.

* subversion/libsvn_wc/node.c
  (svn_wc__rename_wc): Check if it is really operating on a wcroot and
    then use svn_wc__db_drop_root() to close the handles.

* subversion/libsvn_wc/wc_db.c
  (svn_wc__db_op_remove_node): Remove call; this was only necessary in the
    multi-db world.
  (svn_wc__db_temp_forget_directory): Remove function.

* subversion/libsvn_wc/wc_db.h
  (svn_wc__db_temp_forget_directory): Remove function.

Modified:
    subversion/trunk/subversion/libsvn_client/copy.c
    subversion/trunk/subversion/libsvn_wc/adm_files.c
    subversion/trunk/subversion/libsvn_wc/node.c
    subversion/trunk/subversion/libsvn_wc/wc_db.c
    subversion/trunk/subversion/libsvn_wc/wc_db.h

Modified: subversion/trunk/subversion/libsvn_client/copy.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/copy.c?rev=1100375&r1=1100374&r2=1100375&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/copy.c (original)
+++ subversion/trunk/subversion/libsvn_client/copy.c Fri May  6 21:08:16 2011
@@ -1549,6 +1549,9 @@ repos_to_wc_copy_single(svn_client__copy
                                                        ctx->cancel_func,
                                                        ctx->cancel_baton,
                                                        pool));
+
+          /* Move the temporary disk tree into place. */
+          SVN_ERR(svn_io_file_rename(tmp_abspath, dst_abspath, pool));
         }
       else
         {
@@ -1556,17 +1559,15 @@ repos_to_wc_copy_single(svn_client__copy
              a copy from a foreign repos, but we don't yet have the
              WC APIs to do that, so we will just move the whole WC into
              place as a disjoint, nested WC. */
-        }
 
-      /* Move the temporary disk tree into place. */
-      SVN_ERR(svn_wc__rename_wc(ctx->wc_ctx, tmp_abspath, dst_abspath, pool));
+          /* Move the working copy to where it is expected. */
+          SVN_ERR(svn_wc__rename_wc(ctx->wc_ctx, tmp_abspath, dst_abspath,
+                                    pool));
 
-      if (! same_repositories)
-        {
           svn_io_sleep_for_timestamps(dst_abspath, pool);
 
-          return svn_error_createf
-            (SVN_ERR_UNSUPPORTED_FEATURE, NULL,
+          return svn_error_createf(
+             SVN_ERR_UNSUPPORTED_FEATURE, NULL,
              _("Source URL '%s' is from foreign repository; "
                "leaving it as a disjoint WC"), pair->src_abspath_or_url);
         }

Modified: subversion/trunk/subversion/libsvn_wc/adm_files.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_files.c?rev=1100375&r1=1100374&r2=1100375&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_files.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_files.c Fri May  6 21:08:16 2011
@@ -554,17 +554,18 @@ svn_wc__adm_destroy(svn_wc__db_t *db,
                                 scratch_pool, scratch_pool));
 
   /* Well, the coast is clear for blowing away the administrative
-     directory, which also removes the lock */
-  SVN_ERR(svn_wc__db_temp_forget_directory(db, dir_abspath, scratch_pool));
+     directory, which also removes remaining locks */
 
-  /* ### We should check if we are the only user of this DB, or
-         perhaps call svn_wc__db_drop_root? */
+  /* Now close the DB, and we can delete the working copy */
   if (strcmp(adm_abspath, dir_abspath) == 0)
-    SVN_ERR(svn_io_remove_dir2(svn_wc__adm_child(adm_abspath, NULL,
-                                                 scratch_pool),
-                               FALSE,
-                               cancel_func, cancel_baton,
-                               scratch_pool));
+    {
+      SVN_ERR(svn_wc__db_drop_root(db, adm_abspath, scratch_pool));
+      SVN_ERR(svn_io_remove_dir2(svn_wc__adm_child(adm_abspath, NULL,
+                                                   scratch_pool),
+                                 FALSE,
+                                 cancel_func, cancel_baton,
+                                 scratch_pool));
+    }
 
   return SVN_NO_ERROR;
 }

Modified: subversion/trunk/subversion/libsvn_wc/node.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/node.c?rev=1100375&r1=1100374&r2=1100375&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/node.c (original)
+++ subversion/trunk/subversion/libsvn_wc/node.c Fri May  6 21:08:16 2011
@@ -1618,11 +1618,22 @@ svn_wc__rename_wc(svn_wc_context_t *wc_c
                   const char *dst_abspath,
                   apr_pool_t *scratch_pool)
 {
-  SVN_ERR(svn_wc__db_temp_forget_directory(wc_ctx->db,
-                                           from_abspath,
-                                           scratch_pool));
+  const char *wcroot_abspath;
+  SVN_ERR(svn_wc__db_get_wcroot(&wcroot_abspath, wc_ctx->db, from_abspath,
+                                scratch_pool, scratch_pool));
 
-  SVN_ERR(svn_io_file_rename(from_abspath, dst_abspath, scratch_pool));
+  if (! strcmp(from_abspath, wcroot_abspath))
+    {
+      SVN_ERR(svn_wc__db_drop_root(wc_ctx->db, wcroot_abspath, scratch_pool));
+
+      SVN_ERR(svn_io_file_rename(from_abspath, dst_abspath, scratch_pool));
+    }
+  else
+    return svn_error_createf(
+                    SVN_ERR_WC_PATH_UNEXPECTED_STATUS, NULL,
+                    _("'%s' is not the root of the working copy '%s'"),
+                    svn_dirent_local_style(from_abspath, scratch_pool),
+                    svn_dirent_local_style(wcroot_abspath, scratch_pool));
 
   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=1100375&r1=1100374&r2=1100375&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Fri May  6 21:08:16 2011
@@ -4943,7 +4943,6 @@ svn_wc__db_op_remove_node(svn_wc__db_t *
 
   /* ### Flush everything below this node in all ways */
   SVN_ERR(flush_entries(wcroot, local_abspath, scratch_pool));
-  SVN_ERR(svn_wc__db_temp_forget_directory(db, local_abspath, scratch_pool));
 
   return SVN_NO_ERROR;
 }
@@ -9060,55 +9059,6 @@ svn_wc__db_temp_get_format(int *format,
   return SVN_NO_ERROR;
 }
 
-
-/* ### temporary API. remove before release.  */
-svn_error_t *
-svn_wc__db_temp_forget_directory(svn_wc__db_t *db,
-                                 const char *local_dir_abspath,
-                                 apr_pool_t *scratch_pool)
-{
-  apr_hash_t *roots = apr_hash_make(scratch_pool);
-  apr_hash_index_t *hi;
-  apr_pool_t *iterpool = svn_pool_create(scratch_pool);
-
-  for (hi = apr_hash_first(scratch_pool, db->dir_data);
-       hi;
-       hi = apr_hash_next(hi))
-    {
-      svn_wc__db_wcroot_t *wcroot = svn__apr_hash_index_val(hi);
-      const char *local_abspath = svn__apr_hash_index_key(hi);
-      svn_error_t *err;
-
-      if (!svn_dirent_is_ancestor(local_dir_abspath, local_abspath))
-        continue;
-
-      svn_pool_clear(iterpool);
-
-      err = svn_wc__db_wclock_release(db, local_abspath, iterpool);
-      if (err
-          && (err->apr_err == SVN_ERR_WC_NOT_WORKING_COPY
-              || err->apr_err == SVN_ERR_WC_NOT_LOCKED))
-        {
-          svn_error_clear(err);
-        }
-      else
-        SVN_ERR(err);
-
-      apr_hash_set(db->dir_data, local_abspath, APR_HASH_KEY_STRING, NULL);
-
-      if (wcroot->sdb &&
-          svn_dirent_is_ancestor(local_dir_abspath, wcroot->abspath))
-        {
-          apr_hash_set(roots, wcroot->abspath, APR_HASH_KEY_STRING, wcroot);
-        }
-    }
-  svn_pool_destroy(iterpool);
-
-  return svn_error_return(svn_wc__db_close_many_wcroots(roots, db->state_pool,
-                                                        scratch_pool));
-}
-
-
 /* ### temporary API. remove before release.  */
 svn_wc_adm_access_t *
 svn_wc__db_temp_get_access(svn_wc__db_t *db,

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=1100375&r1=1100374&r2=1100375&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Fri May  6 21:08:16 2011
@@ -2504,23 +2504,6 @@ svn_wc__db_wclock_owns_lock(svn_boolean_
   @{
 */
 
-/* Removes all knowledge about @a local_dir_abspath from @a db. closing
-   file handles and removing cached information from @a db.
-
-   This function should only called right before blowing away
-   a directory as it removes cached data from the wc_db without releasing
-   memory.
-
-   After this function is called, a new working copy can be created at
-   @a local_dir_abspath.
-
-   Perform temporary allocations in @a scratch_pool.
-*/
-svn_error_t *
-svn_wc__db_temp_forget_directory(svn_wc__db_t *db,
-                                 const char *local_dir_abspath,
-                                 apr_pool_t *scratch_pool);
-
 /* Removes all references to LOCAL_ABSPATH from DB, while optionally leaving
    tree conflicts and/or a not present node.
 



Mime
View raw message