You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2011/03/17 00:07:01 UTC

svn commit: r1082339 - /subversion/trunk/subversion/libsvn_wc/wc_db.c

Author: hwright
Date: Wed Mar 16 23:07:01 2011
New Revision: 1082339

URL: http://svn.apache.org/viewvc?rev=1082339&view=rev
Log:
Convert another read transaction to use a wc_db txn.

* subversion/libsvn_wc/wc_db.c
  (relocate_baton_t): Remove wc_id and local_relpath members.
  (relocate_txn): Use the provided wcroot and relpath.
  (svn_wc__db_global_relocate): Use the wc_db txn in place of an sqlite one.

Modified:
    subversion/trunk/subversion/libsvn_wc/wc_db.c

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1082339&r1=1082338&r2=1082339&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Wed Mar 16 23:07:01 2011
@@ -5798,8 +5798,6 @@ svn_wc__db_read_children(const apr_array
 
 struct relocate_baton_t
 {
-  apr_int64_t wc_id;
-  const char *local_relpath;
   const char *repos_relpath;
   const char *repos_root_url;
   const char *repos_uuid;
@@ -5810,7 +5808,10 @@ struct relocate_baton_t
 
 /* */
 static svn_error_t *
-relocate_txn(void *baton, svn_sqlite__db_t *sdb, apr_pool_t *scratch_pool)
+relocate_txn(void *baton,
+             svn_wc__db_wcroot_t *wcroot,
+             const char *local_relpath,
+             apr_pool_t *scratch_pool)
 {
   struct relocate_baton_t *rb = baton;
   const char *like_arg;
@@ -5826,17 +5827,15 @@ relocate_txn(void *baton, svn_sqlite__db
 
   /* Get the repos_id for the new repository. */
   SVN_ERR(create_repos_id(&new_repos_id, rb->repos_root_url, rb->repos_uuid,
-                          sdb, scratch_pool));
+                          wcroot->sdb, scratch_pool));
 
-  like_arg = construct_like_arg(rb->local_relpath, scratch_pool);
+  like_arg = construct_like_arg(local_relpath, scratch_pool);
 
   /* Set the (base and working) repos_ids and clear the dav_caches */
-  SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
+  SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
                                     STMT_RECURSIVE_UPDATE_NODE_REPO));
-  SVN_ERR(svn_sqlite__bindf(stmt, "issii",
-                            rb->wc_id, rb->local_relpath,
-                            like_arg, rb->old_repos_id,
-                            new_repos_id));
+  SVN_ERR(svn_sqlite__bindf(stmt, "issii", wcroot->wc_id, local_relpath,
+                            like_arg, rb->old_repos_id, new_repos_id));
   SVN_ERR(svn_sqlite__step_done(stmt));
 
   if (rb->have_base_node)
@@ -5844,7 +5843,7 @@ relocate_txn(void *baton, svn_sqlite__db
       /* Update any locks for the root or its children. */
       like_arg = construct_like_arg(rb->repos_relpath, scratch_pool);
 
-      SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
+      SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
                                         STMT_UPDATE_LOCK_REPOS_ID));
       SVN_ERR(svn_sqlite__bindf(stmt, "issi", rb->old_repos_id,
                                 rb->repos_relpath, like_arg, new_repos_id));
@@ -5862,6 +5861,7 @@ svn_wc__db_global_relocate(svn_wc__db_t 
                            apr_pool_t *scratch_pool)
 {
   svn_wc__db_wcroot_t *wcroot;
+  const char *local_relpath;
   const char *local_dir_relpath;
   svn_wc__db_status_t status;
   struct relocate_baton_t rb;
@@ -5874,7 +5874,7 @@ svn_wc__db_global_relocate(svn_wc__db_t 
                               db, local_dir_abspath, svn_sqlite__mode_readonly,
                               scratch_pool, scratch_pool));
   VERIFY_USABLE_WCROOT(wcroot);
-  rb.local_relpath = local_dir_relpath;
+  local_relpath = local_dir_relpath;
 
   SVN_ERR(read_info(&status,
                     NULL, NULL,
@@ -5883,7 +5883,7 @@ svn_wc__db_global_relocate(svn_wc__db_t 
                     NULL, NULL, NULL, NULL, NULL,
                     &rb.have_base_node,
                     NULL, NULL, NULL,
-                    wcroot, rb.local_relpath,
+                    wcroot, local_relpath,
                     scratch_pool, scratch_pool));
 
   if (status == svn_wc__db_status_excluded)
@@ -5900,7 +5900,7 @@ svn_wc__db_global_relocate(svn_wc__db_t 
                         NULL, NULL, NULL,
                         wcroot, parent_relpath,
                         scratch_pool, scratch_pool));
-      stored_local_dir_relpath = rb.local_relpath;
+      stored_local_dir_relpath = local_relpath;
       local_dir_relpath = parent_relpath;
     }
   else
@@ -5923,7 +5923,7 @@ svn_wc__db_global_relocate(svn_wc__db_t 
             {
               /* Deleted within a copy/move */
               SVN_ERR_ASSERT(!stored_local_dir_relpath);
-              stored_local_dir_relpath = rb.local_relpath;
+              stored_local_dir_relpath = local_relpath;
 
               /* The parent of the delete is added. */
               status = svn_wc__db_status_added;
@@ -5959,10 +5959,10 @@ svn_wc__db_global_relocate(svn_wc__db_t 
                                           scratch_pool);
     }
 
-  rb.wc_id = wcroot->wc_id;
   rb.repos_root_url = repos_root_url;
 
-  SVN_ERR(svn_sqlite__with_lock(wcroot->sdb, relocate_txn, &rb, scratch_pool));
+  SVN_ERR(svn_wc__db_with_txn(wcroot, local_relpath, relocate_txn, &rb,
+                              scratch_pool));
 
   return SVN_NO_ERROR;
 }