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/02/21 21:40:50 UTC

svn commit: r1073138 [6/9] - in /subversion/branches/ignore-mergeinfo-log: ./ build/ build/ac-macros/ build/generator/ build/generator/templates/ notes/ notes/wc-ng/ subversion/bindings/javahl/native/ subversion/bindings/javahl/src/org/apache/subversio...

Modified: subversion/branches/ignore-mergeinfo-log/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/libsvn_wc/wc_db.c?rev=1073138&r1=1073137&r2=1073138&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/libsvn_wc/wc_db.c Mon Feb 21 20:40:44 2011
@@ -242,7 +242,7 @@ insert_incomplete_children(svn_sqlite__d
 
 static svn_error_t *
 db_read_pristine_props(apr_hash_t **props,
-                       svn_wc__db_pdh_t *pdh,
+                       svn_wc__db_wcroot_t *wcroot,
                        const char *local_relpath,
                        apr_pool_t *result_pool,
                        apr_pool_t *scratch_pool);
@@ -270,7 +270,7 @@ read_info(svn_wc__db_status_t *status,
           svn_boolean_t *have_work,
           svn_boolean_t *conflicted,
           svn_wc__db_lock_t **lock,
-          svn_wc__db_pdh_t *pdh,
+          svn_wc__db_wcroot_t *wcroot,
           const char *local_relpath,
           apr_pool_t *result_pool,
           apr_pool_t *scratch_pool);
@@ -283,7 +283,7 @@ scan_addition(svn_wc__db_status_t *statu
               const char **original_repos_relpath,
               apr_int64_t *original_repos_id,
               svn_revnum_t *original_revision,
-              svn_wc__db_pdh_t *pdh,
+              svn_wc__db_wcroot_t *wcroot,
               const char *local_relpath,
               apr_pool_t *result_pool,
               apr_pool_t *scratch_pool);
@@ -292,7 +292,7 @@ static svn_error_t *
 scan_deletion(const char **base_del_relpath,
               const char **moved_to_relpath,
               const char **work_del_relpath,
-              svn_wc__db_pdh_t *pdh,
+              svn_wc__db_wcroot_t *wcroot,
               const char *local_relpath,
               apr_pool_t *result_pool,
               apr_pool_t *scratch_pool);
@@ -303,7 +303,7 @@ convert_to_working_status(svn_wc__db_sta
 
 static svn_error_t *
 wclock_owns_lock(svn_boolean_t *own_lock,
-                 svn_wc__db_pdh_t *pdh,
+                 svn_wc__db_wcroot_t *wcroot,
                  const char *local_relpath,
                  svn_boolean_t exact,
                  apr_pool_t *scratch_pool);
@@ -470,7 +470,6 @@ static svn_error_t *
 repos_location_from_columns(apr_int64_t *repos_id,
                             svn_revnum_t *revision,
                             const char **repos_relpath,
-                            svn_wc__db_pdh_t *pdh,
                             svn_sqlite__stmt_t *stmt,
                             int col_repos_id,
                             int col_revision,
@@ -554,18 +553,18 @@ get_statement_for_path(svn_sqlite__stmt_
                        int stmt_idx,
                        apr_pool_t *scratch_pool)
 {
-  svn_wc__db_pdh_t *pdh;
+  svn_wc__db_wcroot_t *wcroot;
   const char *local_relpath;
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
 
-  SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &local_relpath, db,
+  SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath, db,
                               local_abspath, svn_sqlite__mode_readwrite,
                               scratch_pool, scratch_pool));
-  VERIFY_USABLE_PDH(pdh);
+  VERIFY_USABLE_WCROOT(wcroot);
 
-  SVN_ERR(svn_sqlite__get_statement(stmt, pdh->wcroot->sdb, stmt_idx));
-  SVN_ERR(svn_sqlite__bindf(*stmt, "is", pdh->wcroot->wc_id, local_relpath));
+  SVN_ERR(svn_sqlite__get_statement(stmt, wcroot->sdb, stmt_idx));
+  SVN_ERR(svn_sqlite__bindf(*stmt, "is", wcroot->wc_id, local_relpath));
 
   return SVN_NO_ERROR;
 }
@@ -997,7 +996,7 @@ add_children_to_hash(apr_hash_t *childre
    of any status, in all op-depths in the NODES table. */
 static svn_error_t *
 gather_children(const apr_array_header_t **children,
-                svn_wc__db_pdh_t *pdh,
+                svn_wc__db_wcroot_t *wcroot,
                 const char *local_relpath,
                 apr_pool_t *result_pool,
                 apr_pool_t *scratch_pool)
@@ -1009,7 +1008,7 @@ gather_children(const apr_array_header_t
      appears to be faster to use the hash to remove duplicates than to
      use DISTINCT in the SQL query. */
   SVN_ERR(add_children_to_hash(names_hash, STMT_SELECT_NODE_CHILDREN,
-                               pdh->wcroot->sdb, pdh->wcroot->wc_id,
+                               wcroot->sdb, wcroot->wc_id,
                                local_relpath, result_pool));
 
   SVN_ERR(svn_hash_keys(&names_array, names_hash, result_pool));
@@ -1018,11 +1017,11 @@ gather_children(const apr_array_header_t
 }
 
 /* Set *CHILDREN to a new array of (const char *) names of the repository
-   children of the directory PDH:LOCAL_RELPATH - that is, the children at
+   children of the directory WCROOT:LOCAL_RELPATH - that is, the children at
    the same op-depth. */
 static svn_error_t *
 gather_repo_children(const apr_array_header_t **children,
-                     svn_wc__db_pdh_t *pdh,
+                     svn_wc__db_wcroot_t *wcroot,
                      const char *local_relpath,
                      apr_int64_t op_depth,
                      apr_pool_t *result_pool,
@@ -1033,9 +1032,9 @@ gather_repo_children(const apr_array_hea
   svn_sqlite__stmt_t *stmt;
   svn_boolean_t have_row;
 
-  SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
+  SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
                                     STMT_SELECT_OP_DEPTH_CHILDREN));
-  SVN_ERR(svn_sqlite__bindf(stmt, "isi", pdh->wcroot->wc_id, local_relpath,
+  SVN_ERR(svn_sqlite__bindf(stmt, "isi", wcroot->wc_id, local_relpath,
                             op_depth));
   SVN_ERR(svn_sqlite__step(&have_row, stmt));
   while (have_row)
@@ -1058,26 +1057,28 @@ gather_repo_children(const apr_array_hea
 /* */
 static svn_error_t *
 flush_entries(svn_wc__db_t *db,
-              svn_wc__db_pdh_t *pdh,
+              svn_wc__db_wcroot_t *wcroot,
               const char *local_abspath,
               apr_pool_t *scratch_pool)
 {
-  if (pdh->adm_access)
-    svn_wc__adm_access_set_entries(pdh->adm_access, NULL);
+  svn_wc_adm_access_t *adm_access;
+  const char *parent_abspath;
 
-  if (local_abspath
-      && strcmp(local_abspath, pdh->local_abspath) == 0
-      && strcmp(local_abspath, pdh->wcroot->abspath) != 0)
-    {
-      svn_wc__db_pdh_t *parent_pdh;
+  adm_access = apr_hash_get(wcroot->access_cache, local_abspath,
+                            APR_HASH_KEY_STRING);
 
-      SVN_ERR(svn_wc__db_pdh_navigate_to_parent(&parent_pdh, db, pdh,
-                                                svn_sqlite__mode_readonly,
-                                                scratch_pool));
+  if (adm_access)
+    svn_wc__adm_access_set_entries(adm_access, NULL);
 
-      if (parent_pdh->adm_access)
-        svn_wc__adm_access_set_entries(parent_pdh->adm_access, NULL);
-    }
+  /* We're going to be overly aggressive here and just flush the parent
+     without doing much checking.  This may hurt performance for
+     legacy API consumers, but that's not our problem. :) */
+  parent_abspath = svn_dirent_dirname(local_abspath, scratch_pool);
+  adm_access = apr_hash_get(wcroot->access_cache, parent_abspath,
+                            APR_HASH_KEY_STRING);
+
+  if (adm_access)
+    svn_wc__adm_access_set_entries(adm_access, NULL);
 
   return SVN_NO_ERROR;
 }
@@ -1289,14 +1290,14 @@ svn_wc__db_to_relpath(const char **local
                       apr_pool_t *result_pool,
                       apr_pool_t *scratch_pool)
 {
-  svn_wc__db_pdh_t *pdh;
+  svn_wc__db_wcroot_t *wcroot;
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
 
-  SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, local_relpath, db,
+  SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, local_relpath, db,
                               local_abspath, svn_sqlite__mode_readonly,
                               result_pool, scratch_pool));
-  VERIFY_USABLE_PDH(pdh);
+  VERIFY_USABLE_WCROOT(wcroot);
 
   return SVN_NO_ERROR;
 }
@@ -1310,19 +1311,19 @@ svn_wc__db_from_relpath(const char **loc
                         apr_pool_t *result_pool,
                         apr_pool_t *scratch_pool)
 {
-  svn_wc__db_pdh_t *pdh;
+  svn_wc__db_wcroot_t *wcroot;
   const char *unused_relpath;
 
 #if 0
   SVN_ERR_ASSERT(svn_relpath_is_canonical(local_abspath));
 #endif
 
-  SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &unused_relpath, db,
+  SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &unused_relpath, db,
                               wri_abspath, svn_sqlite__mode_readonly,
                               scratch_pool, scratch_pool));
-  VERIFY_USABLE_PDH(pdh);
+  VERIFY_USABLE_WCROOT(wcroot);
 
-  *local_abspath = svn_dirent_join(pdh->wcroot->abspath,
+  *local_abspath = svn_dirent_join(wcroot->abspath,
                                    local_relpath,
                                    result_pool);
   return SVN_NO_ERROR;
@@ -1335,23 +1336,23 @@ svn_wc__db_get_wcroot(const char **wcroo
                       apr_pool_t *result_pool,
                       apr_pool_t *scratch_pool)
 {
-  svn_wc__db_pdh_t *pdh;
+  svn_wc__db_wcroot_t *wcroot;
   const char *unused_relpath;
 
-  SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &unused_relpath, db,
+  SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &unused_relpath, db,
                               wri_abspath, svn_sqlite__mode_readonly,
                               scratch_pool, scratch_pool));
 
-  /* Can't use VERIFY_USABLE_PDH, as this should be usable to detect
+  /* Can't use VERIFY_USABLE_WCROOT, as this should be usable to detect
      where call upgrade */
 
-  if (pdh->wcroot == NULL)
+  if (wcroot == NULL)
     return svn_error_createf(SVN_ERR_WC_NOT_WORKING_COPY, NULL,
                              _("The node '%s' is not in a workingcopy."),
                              svn_dirent_local_style(wri_abspath,
                                                     scratch_pool));
 
-  *wcroot_abspath = apr_pstrdup(result_pool, pdh->wcroot->abspath);
+  *wcroot_abspath = apr_pstrdup(result_pool, wcroot->abspath);
 
   return SVN_NO_ERROR;
 }
@@ -1380,18 +1381,18 @@ svn_wc__db_with_sqlite_lock(svn_wc__db_t
                             void *cb_baton,
                             apr_pool_t *scratch_pool)
 {
-  svn_wc__db_pdh_t *pdh;
+  svn_wc__db_wcroot_t *wcroot;
   const char *unused_relpath;
   struct with_sqlite_lock_baton baton;
 
-  SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &unused_relpath, db,
+  SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &unused_relpath, db,
                               wri_abspath, svn_sqlite__mode_readonly,
                               scratch_pool, scratch_pool));
 
-  /* Can't use VERIFY_USABLE_PDH, as this should be usable to detect
+  /* Can't use VERIFY_USABLE_WCROOT, as this should be usable to detect
      where call upgrade */
 
-  if (pdh->wcroot == NULL || !pdh->wcroot->sdb)
+  if (wcroot == NULL || !wcroot->sdb)
     return svn_error_createf(SVN_ERR_WC_NOT_WORKING_COPY, NULL,
                              _("The node '%s' is not in a workingcopy."),
                              svn_dirent_local_style(wri_abspath,
@@ -1402,7 +1403,7 @@ svn_wc__db_with_sqlite_lock(svn_wc__db_t
   baton.lock_baton = cb_baton;
 
   return svn_error_return(
-            svn_sqlite__with_lock(pdh->wcroot->sdb,
+            svn_sqlite__with_lock(wcroot->sdb,
                                   call_sqlite_lock_cb,
                                   &baton,
                                   scratch_pool));
@@ -1426,7 +1427,7 @@ svn_wc__db_base_add_directory(svn_wc__db
                               const svn_skel_t *work_items,
                               apr_pool_t *scratch_pool)
 {
-  svn_wc__db_pdh_t *pdh;
+  svn_wc__db_wcroot_t *wcroot;
   const char *local_relpath;
   apr_int64_t repos_id;
   insert_base_baton_t ibb;
@@ -1442,19 +1443,19 @@ svn_wc__db_base_add_directory(svn_wc__db
   SVN_ERR_ASSERT(children != NULL);
 #endif
 
-  SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &local_relpath, db,
+  SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath, db,
                               local_abspath, svn_sqlite__mode_readwrite,
                               scratch_pool, scratch_pool));
-  VERIFY_USABLE_PDH(pdh);
+  VERIFY_USABLE_WCROOT(wcroot);
 
   SVN_ERR(create_repos_id(&repos_id, repos_root_url, repos_uuid,
-                          pdh->wcroot->sdb, scratch_pool));
+                          wcroot->sdb, scratch_pool));
 
   blank_ibb(&ibb);
 
   ibb.status = svn_wc__db_status_normal;
   ibb.kind = svn_wc__db_kind_dir;
-  ibb.wc_id = pdh->wcroot->wc_id;
+  ibb.wc_id = wcroot->wc_id;
   ibb.local_relpath = local_relpath;
   ibb.repos_id = repos_id;
   ibb.repos_relpath = repos_relpath;
@@ -1476,12 +1477,12 @@ svn_wc__db_base_add_directory(svn_wc__db
 
      Note: old children can stick around, even if they are no longer present
      in this directory's revision.  */
-  SVN_ERR(svn_sqlite__with_transaction(pdh->wcroot->sdb,
+  SVN_ERR(svn_sqlite__with_transaction(wcroot->sdb,
                                        insert_base_node, &ibb,
                                        scratch_pool));
 
   /* ### worry about flushing child subdirs?  */
-  SVN_ERR(flush_entries(db, pdh, local_abspath, scratch_pool));
+  SVN_ERR(flush_entries(db, wcroot, local_abspath, scratch_pool));
   return SVN_NO_ERROR;
 }
 
@@ -1504,7 +1505,7 @@ svn_wc__db_base_add_file(svn_wc__db_t *d
                          const svn_skel_t *work_items,
                          apr_pool_t *scratch_pool)
 {
-  svn_wc__db_pdh_t *pdh;
+  svn_wc__db_wcroot_t *wcroot;
   const char *local_relpath;
   apr_int64_t repos_id;
   insert_base_baton_t ibb;
@@ -1518,19 +1519,19 @@ svn_wc__db_base_add_file(svn_wc__db_t *d
   SVN_ERR_ASSERT(SVN_IS_VALID_REVNUM(changed_rev));
   SVN_ERR_ASSERT(checksum != NULL);
 
-  SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &local_relpath, db,
+  SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath, db,
                               local_abspath, svn_sqlite__mode_readwrite,
                               scratch_pool, scratch_pool));
-  VERIFY_USABLE_PDH(pdh);
+  VERIFY_USABLE_WCROOT(wcroot);
 
   SVN_ERR(create_repos_id(&repos_id, repos_root_url, repos_uuid,
-                          pdh->wcroot->sdb, scratch_pool));
+                          wcroot->sdb, scratch_pool));
 
   blank_ibb(&ibb);
 
   ibb.status = svn_wc__db_status_normal;
   ibb.kind = svn_wc__db_kind_file;
-  ibb.wc_id = pdh->wcroot->wc_id;
+  ibb.wc_id = wcroot->wc_id;
   ibb.local_relpath = local_relpath;
   ibb.repos_id = repos_id;
   ibb.repos_relpath = repos_relpath;
@@ -1552,11 +1553,11 @@ svn_wc__db_base_add_file(svn_wc__db_t *d
      ### or maybe let caller deal with that, if there is a possibility
      ### of a node kind change (rather than eat an extra lookup here).  */
 
-  SVN_ERR(svn_sqlite__with_transaction(pdh->wcroot->sdb,
+  SVN_ERR(svn_sqlite__with_transaction(wcroot->sdb,
                                        insert_base_node, &ibb,
                                        scratch_pool));
 
-  SVN_ERR(flush_entries(db, pdh, local_abspath, scratch_pool));
+  SVN_ERR(flush_entries(db, wcroot, local_abspath, scratch_pool));
   return SVN_NO_ERROR;
 }
 
@@ -1578,7 +1579,7 @@ svn_wc__db_base_add_symlink(svn_wc__db_t
                             const svn_skel_t *work_items,
                             apr_pool_t *scratch_pool)
 {
-  svn_wc__db_pdh_t *pdh;
+  svn_wc__db_wcroot_t *wcroot;
   const char *local_relpath;
   apr_int64_t repos_id;
   insert_base_baton_t ibb;
@@ -1592,19 +1593,19 @@ svn_wc__db_base_add_symlink(svn_wc__db_t
   SVN_ERR_ASSERT(SVN_IS_VALID_REVNUM(changed_rev));
   SVN_ERR_ASSERT(target != NULL);
 
-  SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &local_relpath, db,
+  SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath, db,
                               local_abspath, svn_sqlite__mode_readwrite,
                               scratch_pool, scratch_pool));
-  VERIFY_USABLE_PDH(pdh);
+  VERIFY_USABLE_WCROOT(wcroot);
 
   SVN_ERR(create_repos_id(&repos_id, repos_root_url, repos_uuid,
-                          pdh->wcroot->sdb, scratch_pool));
+                          wcroot->sdb, scratch_pool));
 
   blank_ibb(&ibb);
 
   ibb.status = svn_wc__db_status_normal;
   ibb.kind = svn_wc__db_kind_symlink;
-  ibb.wc_id = pdh->wcroot->wc_id;
+  ibb.wc_id = wcroot->wc_id;
   ibb.local_relpath = local_relpath;
   ibb.repos_id = repos_id;
   ibb.repos_relpath = repos_relpath;
@@ -1625,11 +1626,11 @@ svn_wc__db_base_add_symlink(svn_wc__db_t
      ### or maybe let caller deal with that, if there is a possibility
      ### of a node kind change (rather than eat an extra lookup here).  */
 
-  SVN_ERR(svn_sqlite__with_transaction(pdh->wcroot->sdb,
+  SVN_ERR(svn_sqlite__with_transaction(wcroot->sdb,
                                        insert_base_node, &ibb,
                                        scratch_pool));
 
-  SVN_ERR(flush_entries(db, pdh, local_abspath, scratch_pool));
+  SVN_ERR(flush_entries(db, wcroot, local_abspath, scratch_pool));
   return SVN_NO_ERROR;
 }
 
@@ -1647,7 +1648,7 @@ add_absent_excluded_not_present_node(svn
                                      const svn_skel_t *work_items,
                                      apr_pool_t *scratch_pool)
 {
-  svn_wc__db_pdh_t *pdh;
+  svn_wc__db_wcroot_t *wcroot;
   const char *local_relpath;
   apr_int64_t repos_id;
   insert_base_baton_t ibb;
@@ -1661,19 +1662,19 @@ add_absent_excluded_not_present_node(svn
                  || status == svn_wc__db_status_excluded
                  || status == svn_wc__db_status_not_present);
 
-  SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &local_relpath, db,
+  SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath, db,
                               local_abspath, svn_sqlite__mode_readwrite,
                               scratch_pool, scratch_pool));
-  VERIFY_USABLE_PDH(pdh);
+  VERIFY_USABLE_WCROOT(wcroot);
 
   SVN_ERR(create_repos_id(&repos_id, repos_root_url, repos_uuid,
-                          pdh->wcroot->sdb, scratch_pool));
+                          wcroot->sdb, scratch_pool));
 
   blank_ibb(&ibb);
 
   ibb.status = status;
   ibb.kind = kind;
-  ibb.wc_id = pdh->wcroot->wc_id;
+  ibb.wc_id = wcroot->wc_id;
   ibb.local_relpath = local_relpath;
   ibb.repos_id = repos_id;
   ibb.repos_relpath = repos_relpath;
@@ -1693,11 +1694,11 @@ add_absent_excluded_not_present_node(svn
      ### or maybe let caller deal with that, if there is a possibility
      ### of a node kind change (rather than eat an extra lookup here).  */
 
-  SVN_ERR(svn_sqlite__with_transaction(pdh->wcroot->sdb,
+  SVN_ERR(svn_sqlite__with_transaction(wcroot->sdb,
                                        insert_base_node, &ibb,
                                        scratch_pool));
 
-  SVN_ERR(flush_entries(db, pdh, local_abspath, scratch_pool));
+  SVN_ERR(flush_entries(db, wcroot, local_abspath, scratch_pool));
 
   return SVN_NO_ERROR;
 }
@@ -1783,30 +1784,30 @@ svn_wc__db_base_remove(svn_wc__db_t *db,
                        const char *local_abspath,
                        apr_pool_t *scratch_pool)
 {
-  svn_wc__db_pdh_t *pdh;
+  svn_wc__db_wcroot_t *wcroot;
   const char *local_relpath;
   struct base_remove_baton brb;
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
 
-  SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &local_relpath, db,
+  SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath, db,
                               local_abspath, svn_sqlite__mode_readwrite,
                               scratch_pool, scratch_pool));
-  VERIFY_USABLE_PDH(pdh);
+  VERIFY_USABLE_WCROOT(wcroot);
 
   brb.local_relpath = local_relpath;
-  brb.wc_id = pdh->wcroot->wc_id;
+  brb.wc_id = wcroot->wc_id;
 
-  SVN_ERR(svn_sqlite__with_transaction(pdh->wcroot->sdb,
+  SVN_ERR(svn_sqlite__with_transaction(wcroot->sdb,
                                        db_base_remove, &brb,
                                        scratch_pool));
 
-  SVN_ERR(flush_entries(db, pdh, local_abspath, scratch_pool));
+  SVN_ERR(flush_entries(db, wcroot, local_abspath, scratch_pool));
 
   return SVN_NO_ERROR;
 }
 
-/* Like svn_wc__db_base_get_info(), but taking PDH+LOCAL_RELPATH instead of
+/* Like svn_wc__db_base_get_info(), but taking WCROOT+LOCAL_RELPATH instead of
  * DB+LOCAL_ABSPATH and outputting REPOS_ID instead of URL+UUID. */
 static svn_error_t *
 base_get_info(svn_wc__db_status_t *status,
@@ -1823,7 +1824,7 @@ base_get_info(svn_wc__db_status_t *statu
               svn_filesize_t *translated_size,
               const char **target,
               svn_wc__db_lock_t **lock,
-              svn_wc__db_pdh_t *pdh,
+              svn_wc__db_wcroot_t *wcroot,
               const char *local_relpath,
               apr_pool_t *result_pool,
               apr_pool_t *scratch_pool)
@@ -1832,10 +1833,10 @@ base_get_info(svn_wc__db_status_t *statu
   svn_boolean_t have_row;
   svn_error_t *err = SVN_NO_ERROR;
 
-  SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
+  SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
                                     lock ? STMT_SELECT_BASE_NODE_WITH_LOCK
                                          : STMT_SELECT_BASE_NODE));
-  SVN_ERR(svn_sqlite__bindf(stmt, "is", pdh->wcroot->wc_id, local_relpath));
+  SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
   SVN_ERR(svn_sqlite__step(&have_row, stmt));
 
   if (have_row)
@@ -1852,7 +1853,7 @@ base_get_info(svn_wc__db_status_t *statu
           *status = svn_sqlite__column_token(stmt, 2, presence_map);
         }
       err = repos_location_from_columns(repos_id, revision, repos_relpath,
-                                        pdh, stmt, 0, 4, 1, result_pool);
+                                        stmt, 0, 4, 1, result_pool);
       SVN_ERR_ASSERT(!repos_id || *repos_id != INVALID_REPOS_ID);
       SVN_ERR_ASSERT(!repos_relpath || *repos_relpath);
       if (lock)
@@ -1906,7 +1907,7 @@ base_get_info(svn_wc__db_status_t *statu
                 err = svn_error_createf(
                         err->apr_err, err,
                         _("The node '%s' has a corrupt checksum value."),
-                        path_for_error_message(pdh->wcroot, local_relpath,
+                        path_for_error_message(wcroot, local_relpath,
                                                scratch_pool));
             }
         }
@@ -1926,7 +1927,7 @@ base_get_info(svn_wc__db_status_t *statu
     {
       err = svn_error_createf(SVN_ERR_WC_PATH_NOT_FOUND, NULL,
                               _("The node '%s' was not found."),
-                              path_for_error_message(pdh->wcroot, local_relpath,
+                              path_for_error_message(wcroot, local_relpath,
                                                      scratch_pool));
     }
 
@@ -1956,25 +1957,25 @@ svn_wc__db_base_get_info(svn_wc__db_stat
                          apr_pool_t *result_pool,
                          apr_pool_t *scratch_pool)
 {
-  svn_wc__db_pdh_t *pdh;
+  svn_wc__db_wcroot_t *wcroot;
   const char *local_relpath;
   apr_int64_t repos_id;
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
 
-  SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &local_relpath, db,
+  SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath, db,
                               local_abspath, svn_sqlite__mode_readonly,
                               scratch_pool, scratch_pool));
-  VERIFY_USABLE_PDH(pdh);
+  VERIFY_USABLE_WCROOT(wcroot);
 
   SVN_ERR(base_get_info(status, kind, revision, repos_relpath, &repos_id,
                         changed_rev, changed_date, changed_author,
                         last_mod_time, depth, checksum, translated_size,
                         target, lock,
-                        pdh, local_relpath, result_pool, scratch_pool));
+                        wcroot, local_relpath, result_pool, scratch_pool));
   SVN_ERR_ASSERT(repos_id != INVALID_REPOS_ID);
   SVN_ERR(fetch_repos_info(repos_root_url, repos_uuid,
-                           pdh->wcroot->sdb, repos_id, result_pool));
+                           wcroot->sdb, repos_id, result_pool));
 
   return SVN_NO_ERROR;
 }
@@ -2048,18 +2049,18 @@ svn_wc__db_base_get_children(const apr_a
                              apr_pool_t *result_pool,
                              apr_pool_t *scratch_pool)
 {
-  svn_wc__db_pdh_t *pdh;
+  svn_wc__db_wcroot_t *wcroot;
   const char *local_relpath;
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
 
-  SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &local_relpath, db,
+  SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath, db,
                                              local_abspath,
                                              svn_sqlite__mode_readonly,
                                              scratch_pool, scratch_pool));
-  VERIFY_USABLE_PDH(pdh);
+  VERIFY_USABLE_WCROOT(wcroot);
 
-  return gather_repo_children(children, pdh, local_relpath, 0,
+  return gather_repo_children(children, wcroot, local_relpath, 0,
                               result_pool, scratch_pool);
 }
 
@@ -2121,22 +2122,22 @@ svn_wc__db_base_clear_dav_cache_recursiv
                                           const char *local_abspath,
                                           apr_pool_t *scratch_pool)
 {
-  svn_wc__db_pdh_t *pdh;
+  svn_wc__db_wcroot_t *wcroot;
   const char *local_relpath;
   const char *like_arg;
   svn_sqlite__stmt_t *stmt;
 
-  SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &local_relpath,
+  SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath,
                                              db, local_abspath,
                                              svn_sqlite__mode_readwrite,
                                              scratch_pool, scratch_pool));
-  VERIFY_USABLE_PDH(pdh);
+  VERIFY_USABLE_WCROOT(wcroot);
 
   like_arg = construct_like_arg(local_relpath, scratch_pool);
 
-  SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
+  SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
                                     STMT_CLEAR_BASE_NODE_RECURSIVE_DAV_CACHE));
-  SVN_ERR(svn_sqlite__bindf(stmt, "iss", pdh->wcroot->wc_id, local_relpath,
+  SVN_ERR(svn_sqlite__bindf(stmt, "iss", wcroot->wc_id, local_relpath,
                             like_arg));
 
   SVN_ERR(svn_sqlite__step_done(stmt));
@@ -2147,9 +2148,9 @@ svn_wc__db_base_clear_dav_cache_recursiv
 /* Helper for svn_wc__db_op_copy to handle copying from one db to
    another */
 static svn_error_t *
-cross_db_copy(svn_wc__db_pdh_t *src_pdh,
+cross_db_copy(svn_wc__db_wcroot_t *src_wcroot,
               const char *src_relpath,
-              svn_wc__db_pdh_t *dst_pdh,
+              svn_wc__db_wcroot_t *dst_wcroot,
               const char *dst_relpath,
               svn_wc__db_status_t dst_status,
               apr_int64_t dst_op_depth,
@@ -2194,15 +2195,15 @@ cross_db_copy(svn_wc__db_pdh_t *src_pdh,
                     NULL /* have_work */,
                     NULL /* conflicted */,
                     NULL /* lock */,
-                    src_pdh, src_relpath, scratch_pool, scratch_pool));
+                    src_wcroot, src_relpath, scratch_pool, scratch_pool));
 
-  SVN_ERR(db_read_pristine_props(&props, src_pdh, src_relpath,
+  SVN_ERR(db_read_pristine_props(&props, src_wcroot, src_relpath,
                                  scratch_pool, scratch_pool));
 
   blank_iwb(&iwb);
   iwb.presence = dst_status;
   iwb.kind = kind;
-  iwb.wc_id = dst_pdh->wcroot->wc_id;
+  iwb.wc_id = dst_wcroot->wc_id;
   iwb.local_relpath = dst_relpath;
 
   iwb.props = props;
@@ -2220,11 +2221,11 @@ cross_db_copy(svn_wc__db_pdh_t *src_pdh,
   iwb.children = children;
   iwb.depth = depth;
 
-  SVN_ERR(insert_working_node(&iwb, dst_pdh->wcroot->sdb, scratch_pool));
+  SVN_ERR(insert_working_node(&iwb, dst_wcroot->sdb, scratch_pool));
 
-  SVN_ERR(svn_sqlite__get_statement(&stmt, src_pdh->wcroot->sdb,
+  SVN_ERR(svn_sqlite__get_statement(&stmt, src_wcroot->sdb,
                                     STMT_SELECT_ACTUAL_NODE));
-  SVN_ERR(svn_sqlite__bindf(stmt, "is", src_pdh->wcroot->wc_id, src_relpath));
+  SVN_ERR(svn_sqlite__bindf(stmt, "is", src_wcroot->wc_id, src_relpath));
   SVN_ERR(svn_sqlite__step(&have_row, stmt));
   if (have_row)
     {
@@ -2246,10 +2247,10 @@ cross_db_copy(svn_wc__db_pdh_t *src_pdh,
       const char *properties = svn_sqlite__column_blob(stmt, 6, &props_size,
                                                        scratch_pool);
       SVN_ERR(svn_sqlite__reset(stmt));
-      SVN_ERR(svn_sqlite__get_statement(&stmt, dst_pdh->wcroot->sdb,
+      SVN_ERR(svn_sqlite__get_statement(&stmt, dst_wcroot->sdb,
                                         STMT_INSERT_ACTUAL_NODE));
       SVN_ERR(svn_sqlite__bindf(stmt, "issbsssss",
-                                dst_pdh->wcroot->wc_id, dst_relpath,
+                                dst_wcroot->wc_id, dst_relpath,
                                 svn_relpath_dirname(dst_relpath, scratch_pool),
                                 properties, props_size,
                                 conflict_old, conflict_new, conflict_working,
@@ -2272,7 +2273,7 @@ get_info_for_copy(apr_int64_t *copyfrom_
                   svn_wc__db_status_t *status,
                   svn_wc__db_kind_t *kind,
                   svn_boolean_t *have_work,
-                  svn_wc__db_pdh_t *pdh,
+                  svn_wc__db_wcroot_t *wcroot,
                   const char *local_relpath,
                   apr_pool_t *result_pool,
                   apr_pool_t *scratch_pool)
@@ -2298,7 +2299,7 @@ get_info_for_copy(apr_int64_t *copyfrom_
                     have_work,
                     NULL /* conflicted */,
                     NULL /* lock */,
-                    pdh, local_relpath, result_pool, scratch_pool));
+                    wcroot, local_relpath, result_pool, scratch_pool));
 
   if (*status == svn_wc__db_status_excluded)
     {
@@ -2313,7 +2314,7 @@ get_info_for_copy(apr_int64_t *copyfrom_
                        scratch_pool);
       SVN_ERR(get_info_for_copy(copyfrom_id, copyfrom_relpath, copyfrom_rev,
                                 &parent_status, &parent_kind, &parent_have_work,
-                                pdh, parent_relpath,
+                                wcroot, parent_relpath,
                                 scratch_pool, scratch_pool));
       if (*copyfrom_relpath)
         *copyfrom_relpath = svn_relpath_join(*copyfrom_relpath, base_name,
@@ -2326,7 +2327,7 @@ get_info_for_copy(apr_int64_t *copyfrom_
       SVN_ERR(scan_addition(NULL, &op_root_relpath,
                             NULL, NULL, /* repos_* */
                             copyfrom_relpath, copyfrom_id, copyfrom_rev,
-                            pdh, local_relpath,
+                            wcroot, local_relpath,
                             scratch_pool, scratch_pool));
       if (*copyfrom_relpath)
         {
@@ -2342,7 +2343,8 @@ get_info_for_copy(apr_int64_t *copyfrom_
       const char *base_del_relpath, *work_del_relpath;
 
       SVN_ERR(scan_deletion(&base_del_relpath, NULL, &work_del_relpath,
-                            pdh, local_relpath, scratch_pool, scratch_pool));
+                            wcroot, local_relpath, scratch_pool,
+                            scratch_pool));
       if (work_del_relpath)
         {
           const char *op_root_relpath;
@@ -2354,7 +2356,7 @@ get_info_for_copy(apr_int64_t *copyfrom_
           SVN_ERR(scan_addition(NULL, &op_root_relpath,
                                 NULL, NULL, /* repos_* */
                                 copyfrom_relpath, copyfrom_id, copyfrom_rev,
-                                pdh, parent_del_relpath,
+                                wcroot, parent_del_relpath,
                                 scratch_pool, scratch_pool));
           *copyfrom_relpath
             = svn_relpath_join(*copyfrom_relpath,
@@ -2368,7 +2370,7 @@ get_info_for_copy(apr_int64_t *copyfrom_
                                 copyfrom_id,
                                 NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                                 NULL, NULL,
-                                pdh, base_del_relpath,
+                                wcroot, base_del_relpath,
                                 result_pool, scratch_pool));
         }
       else
@@ -2385,7 +2387,7 @@ get_info_for_copy(apr_int64_t *copyfrom_
 
 static svn_error_t *
 op_depth_of(apr_int64_t *op_depth,
-            svn_wc__db_pdh_t *pdh,
+            svn_wc__db_wcroot_t *wcroot,
             const char *local_relpath);
 
 static svn_error_t *
@@ -2393,16 +2395,16 @@ op_depth_for_copy(apr_int64_t *op_depth,
                   apr_int64_t copyfrom_repos_id,
                   const char *copyfrom_relpath,
                   svn_revnum_t copyfrom_revision,
-                  svn_wc__db_pdh_t *pdh,
+                  svn_wc__db_wcroot_t *wcroot,
                   const char *local_relpath,
                   apr_pool_t *scratch_pool);
 
 /* Like svn_wc__db_op_copy(), but with PDH+LOCAL_RELPATH instead of
  * DB+LOCAL_ABSPATH. */
 static svn_error_t *
-db_op_copy(svn_wc__db_pdh_t *src_pdh,
+db_op_copy(svn_wc__db_wcroot_t *src_wcroot,
            const char *src_relpath,
-           svn_wc__db_pdh_t *dst_pdh,
+           svn_wc__db_wcroot_t *dst_wcroot,
            const char *dst_relpath,
            const svn_skel_t *work_items,
            apr_pool_t *scratch_pool)
@@ -2417,12 +2419,12 @@ db_op_copy(svn_wc__db_pdh_t *src_pdh,
   const apr_array_header_t *children;
 
   SVN_ERR(get_info_for_copy(&copyfrom_id, &copyfrom_relpath, &copyfrom_rev,
-                            &status, &kind, &have_work,
-                            src_pdh, src_relpath, scratch_pool, scratch_pool));
+                            &status, &kind, &have_work, src_wcroot,
+                            src_relpath, scratch_pool, scratch_pool));
 
   SVN_ERR(op_depth_for_copy(&dst_op_depth, copyfrom_id,
                             copyfrom_relpath, copyfrom_rev,
-                            dst_pdh, dst_relpath, scratch_pool));
+                            dst_wcroot, dst_relpath, scratch_pool));
 
   SVN_ERR_ASSERT(kind == svn_wc__db_kind_file || kind == svn_wc__db_kind_dir);
 
@@ -2445,13 +2447,13 @@ db_op_copy(svn_wc__db_pdh_t *src_pdh,
     case svn_wc__db_status_absent:
       return svn_error_createf(SVN_ERR_AUTHZ_UNREADABLE, NULL,
                                _("Cannot copy '%s' excluded by server"),
-                               path_for_error_message(src_pdh->wcroot,
+                               path_for_error_message(src_wcroot,
                                                       src_relpath,
                                                       scratch_pool));
     default:
       return svn_error_createf(SVN_ERR_WC_PATH_UNEXPECTED_STATUS, NULL,
                                _("Cannot handle status of '%s'"),
-                               path_for_error_message(src_pdh->wcroot,
+                               path_for_error_message(src_wcroot,
                                                       src_relpath,
                                                       scratch_pool));
     }
@@ -2460,28 +2462,28 @@ db_op_copy(svn_wc__db_pdh_t *src_pdh,
     {
       apr_int64_t src_op_depth;
 
-      SVN_ERR(op_depth_of(&src_op_depth, src_pdh, src_relpath));
-      SVN_ERR(gather_repo_children(&children, src_pdh, src_relpath,
+      SVN_ERR(op_depth_of(&src_op_depth, src_wcroot, src_relpath));
+      SVN_ERR(gather_repo_children(&children, src_wcroot, src_relpath,
                                    src_op_depth, scratch_pool, scratch_pool));
     }
   else
     children = NULL;
 
-  if (src_pdh->wcroot == dst_pdh->wcroot)
+  if (src_wcroot == dst_wcroot)
     {
       svn_sqlite__stmt_t *stmt;
       const char *dst_parent_relpath = svn_relpath_dirname(dst_relpath,
                                                            scratch_pool);
 
       if (have_work)
-        SVN_ERR(svn_sqlite__get_statement(&stmt, src_pdh->wcroot->sdb,
+        SVN_ERR(svn_sqlite__get_statement(&stmt, src_wcroot->sdb,
                          STMT_INSERT_WORKING_NODE_COPY_FROM_WORKING));
       else
-        SVN_ERR(svn_sqlite__get_statement(&stmt, src_pdh->wcroot->sdb,
+        SVN_ERR(svn_sqlite__get_statement(&stmt, src_wcroot->sdb,
                           STMT_INSERT_WORKING_NODE_COPY_FROM_BASE));
 
       SVN_ERR(svn_sqlite__bindf(stmt, "issisnnnt",
-                    src_pdh->wcroot->wc_id, src_relpath,
+                    src_wcroot->wc_id, src_relpath,
                     dst_relpath,
                     dst_op_depth,
                     dst_parent_relpath,
@@ -2496,10 +2498,9 @@ db_op_copy(svn_wc__db_pdh_t *src_pdh,
       SVN_ERR(svn_sqlite__step_done(stmt));
 
       /* ### Copying changelist is OK for a move but what about a copy? */
-      SVN_ERR(svn_sqlite__get_statement(&stmt, src_pdh->wcroot->sdb,
+      SVN_ERR(svn_sqlite__get_statement(&stmt, src_wcroot->sdb,
                                   STMT_INSERT_ACTUAL_NODE_FROM_ACTUAL_NODE));
-      SVN_ERR(svn_sqlite__bindf(stmt, "isss",
-                                src_pdh->wcroot->wc_id, src_relpath,
+      SVN_ERR(svn_sqlite__bindf(stmt, "isss", src_wcroot->wc_id, src_relpath,
                                 dst_relpath, dst_parent_relpath));
       SVN_ERR(svn_sqlite__step_done(stmt));
 
@@ -2508,8 +2509,8 @@ db_op_copy(svn_wc__db_pdh_t *src_pdh,
          (The only time we'd want a different depth is during a recursive
          simple add, but we never insert children here during a simple add.) */
       if (kind == svn_wc__db_kind_dir)
-        SVN_ERR(insert_incomplete_children(dst_pdh->wcroot->sdb,
-                                           dst_pdh->wcroot->wc_id,
+        SVN_ERR(insert_incomplete_children(dst_wcroot->sdb,
+                                           dst_wcroot->wc_id,
                                            dst_relpath,
                                            INVALID_REPOS_ID /* inherit repos_id */,
                                            NULL /* inherit repos_path */,
@@ -2520,14 +2521,13 @@ db_op_copy(svn_wc__db_pdh_t *src_pdh,
     }
   else
     {
-      SVN_ERR(cross_db_copy(src_pdh, src_relpath,
-                            dst_pdh, dst_relpath, dst_status, dst_op_depth,
-                            kind, children,
-                            copyfrom_id, copyfrom_relpath, copyfrom_rev,
-                            scratch_pool));
+      SVN_ERR(cross_db_copy(src_wcroot, src_relpath, dst_wcroot,
+                            dst_relpath, dst_status, dst_op_depth, kind,
+                            children, copyfrom_id, copyfrom_relpath,
+                            copyfrom_rev, scratch_pool));
     }
 
-  SVN_ERR(add_work_items(dst_pdh->wcroot->sdb, work_items, scratch_pool));
+  SVN_ERR(add_work_items(dst_wcroot->sdb, work_items, scratch_pool));
 
   return SVN_NO_ERROR;
 }
@@ -2540,43 +2540,44 @@ svn_wc__db_op_copy(svn_wc__db_t *db,
                    const svn_skel_t *work_items,
                    apr_pool_t *scratch_pool)
 {
-  svn_wc__db_pdh_t *src_pdh, *dst_pdh;
+  svn_wc__db_wcroot_t *src_wcroot;
+  svn_wc__db_wcroot_t *dst_wcroot;
   const char *src_relpath, *dst_relpath;
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(src_abspath));
   SVN_ERR_ASSERT(svn_dirent_is_absolute(dst_abspath));
 
-  SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&src_pdh, &src_relpath, db,
+  SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&src_wcroot, &src_relpath, db,
                                              src_abspath,
                                              svn_sqlite__mode_readwrite,
                                              scratch_pool, scratch_pool));
-  VERIFY_USABLE_PDH(src_pdh);
+  VERIFY_USABLE_WCROOT(src_wcroot);
 
-  SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&dst_pdh, &dst_relpath, db,
+  SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&dst_wcroot, &dst_relpath, db,
                                              dst_abspath,
                                              svn_sqlite__mode_readwrite,
                                              scratch_pool, scratch_pool));
-  VERIFY_USABLE_PDH(dst_pdh);
+  VERIFY_USABLE_WCROOT(dst_wcroot);
 
   /* ### This should all happen in one transaction. */
-  SVN_ERR(db_op_copy(src_pdh, src_relpath, dst_pdh, dst_relpath,
-                     work_items, scratch_pool));
+  SVN_ERR(db_op_copy(src_wcroot, src_relpath, dst_wcroot,
+                     dst_relpath, work_items, scratch_pool));
 
   return SVN_NO_ERROR;
 }
 
-/* Set *OP_DEPTH to the highest op depth of PDH:LOCAL_RELPATH. */
+/* Set *OP_DEPTH to the highest op depth of WCROOT:LOCAL_RELPATH. */
 static svn_error_t *
 op_depth_of(apr_int64_t *op_depth,
-            svn_wc__db_pdh_t *pdh,
+            svn_wc__db_wcroot_t *wcroot,
             const char *local_relpath)
 {
   svn_sqlite__stmt_t *stmt;
   svn_boolean_t have_row;
 
-  SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
+  SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
                                     STMT_SELECT_NODE_INFO));
-  SVN_ERR(svn_sqlite__bindf(stmt, "is", pdh->wcroot->wc_id, local_relpath));
+  SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
   SVN_ERR(svn_sqlite__step(&have_row, stmt));
   SVN_ERR_ASSERT(have_row);
   *op_depth = svn_sqlite__column_int64(stmt, 0);
@@ -2588,7 +2589,7 @@ op_depth_of(apr_int64_t *op_depth,
    copy must fail as it's not possible to commit such a copy.  Return
    an error if there are any absent nodes. */
 static svn_error_t *
-catch_copy_of_absent(svn_wc__db_pdh_t *pdh,
+catch_copy_of_absent(svn_wc__db_wcroot_t *wcroot,
                      const char *local_relpath,
                      apr_pool_t *scratch_pool)
 {
@@ -2596,10 +2597,10 @@ catch_copy_of_absent(svn_wc__db_pdh_t *p
   svn_boolean_t have_row;
   const char *absent_relpath;
 
-  SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
+  SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
                                     STMT_SELECT_ABSENT_NODES));
   SVN_ERR(svn_sqlite__bindf(stmt, "iss",
-                            pdh->wcroot->wc_id,
+                            wcroot->wc_id,
                             local_relpath,
                             construct_like_arg(local_relpath,
                                                scratch_pool)));
@@ -2610,8 +2611,7 @@ catch_copy_of_absent(svn_wc__db_pdh_t *p
   if (have_row)
     return svn_error_createf(SVN_ERR_AUTHZ_UNREADABLE, NULL,
                              _("Cannot copy '%s' excluded by server"),
-                             path_for_error_message(pdh->wcroot,
-                                                    absent_relpath,
+                             path_for_error_message(wcroot, absent_relpath,
                                                     scratch_pool));
 
   return SVN_NO_ERROR;
@@ -2629,7 +2629,7 @@ op_depth_for_copy(apr_int64_t *op_depth,
                   apr_int64_t copyfrom_repos_id,
                   const char *copyfrom_relpath,
                   svn_revnum_t copyfrom_revision,
-                  svn_wc__db_pdh_t *pdh,
+                  svn_wc__db_wcroot_t *wcroot,
                   const char *local_relpath,
                   apr_pool_t *scratch_pool)
 {
@@ -2642,9 +2642,9 @@ op_depth_for_copy(apr_int64_t *op_depth,
   if (!copyfrom_relpath)
     return SVN_NO_ERROR;
 
-  SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
+  SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
                                     STMT_SELECT_WORKING_NODE));
-  SVN_ERR(svn_sqlite__bindf(stmt, "is", pdh->wcroot->wc_id, local_relpath));
+  SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
   SVN_ERR(svn_sqlite__step(&have_row, stmt));
   if (have_row)
     {
@@ -2660,15 +2660,17 @@ op_depth_for_copy(apr_int64_t *op_depth,
   SVN_ERR(svn_sqlite__reset(stmt));
 
   svn_relpath_split(&parent_relpath, &name, local_relpath, scratch_pool);
-  SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
+  SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
                                     STMT_SELECT_WORKING_NODE));
-  SVN_ERR(svn_sqlite__bindf(stmt, "is", pdh->wcroot->wc_id, parent_relpath));
+  SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, parent_relpath));
   SVN_ERR(svn_sqlite__step(&have_row, stmt));
   if (have_row)
     {
       svn_wc__db_status_t status = svn_sqlite__column_token(stmt, 1,
                                                             presence_map);
-      SVN_ERR(convert_to_working_status(&status, status));
+      svn_error_t *err = convert_to_working_status(&status, status);
+      if (err)
+        SVN_ERR(svn_error_compose_create(err, svn_sqlite__reset(stmt)));
       if (status == svn_wc__db_status_added)
         {
           apr_int64_t parent_copyfrom_repos_id
@@ -2708,7 +2710,7 @@ svn_wc__db_op_copy_dir(svn_wc__db_t *db,
                        const svn_skel_t *work_items,
                        apr_pool_t *scratch_pool)
 {
-  svn_wc__db_pdh_t *pdh;
+  svn_wc__db_wcroot_t *wcroot;
   const char *local_relpath;
   insert_working_baton_t iwb;
 
@@ -2721,16 +2723,16 @@ svn_wc__db_op_copy_dir(svn_wc__db_t *db,
 #endif
   SVN_ERR_ASSERT(conflict == NULL);  /* ### can't handle yet  */
 
-  SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &local_relpath, db,
+  SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath, db,
                               local_abspath, svn_sqlite__mode_readwrite,
                               scratch_pool, scratch_pool));
-  VERIFY_USABLE_PDH(pdh);
+  VERIFY_USABLE_WCROOT(wcroot);
 
   blank_iwb(&iwb);
 
   iwb.presence = svn_wc__db_status_normal;
   iwb.kind = svn_wc__db_kind_dir;
-  iwb.wc_id = pdh->wcroot->wc_id;
+  iwb.wc_id = wcroot->wc_id;
   iwb.local_relpath = local_relpath;
 
   iwb.props = props;
@@ -2743,7 +2745,7 @@ svn_wc__db_op_copy_dir(svn_wc__db_t *db,
     {
       SVN_ERR(create_repos_id(&iwb.original_repos_id,
                               original_root_url, original_uuid,
-                              pdh->wcroot->sdb, scratch_pool));
+                              wcroot->sdb, scratch_pool));
       iwb.original_repos_relpath = original_repos_relpath;
       iwb.original_revnum = original_revision;
     }
@@ -2751,17 +2753,16 @@ svn_wc__db_op_copy_dir(svn_wc__db_t *db,
   /* ### Should we do this inside the transaction? */
   SVN_ERR(op_depth_for_copy(&iwb.op_depth, iwb.original_repos_id,
                             original_repos_relpath, original_revision,
-                            pdh, local_relpath, scratch_pool));
+                            wcroot, local_relpath, scratch_pool));
 
   iwb.children = children;
   iwb.depth = depth;
 
   iwb.work_items = work_items;
 
-  SVN_ERR(svn_sqlite__with_transaction(pdh->wcroot->sdb,
-                                       insert_working_node, &iwb,
+  SVN_ERR(svn_sqlite__with_transaction(wcroot->sdb, insert_working_node, &iwb,
                                        scratch_pool));
-  SVN_ERR(flush_entries(db, pdh, local_abspath, scratch_pool));
+  SVN_ERR(flush_entries(db, wcroot, local_abspath, scratch_pool));
 
   return SVN_NO_ERROR;
 }
@@ -2783,7 +2784,7 @@ svn_wc__db_op_copy_file(svn_wc__db_t *db
                         const svn_skel_t *work_items,
                         apr_pool_t *scratch_pool)
 {
-  svn_wc__db_pdh_t *pdh;
+  svn_wc__db_wcroot_t *wcroot;
   const char *local_relpath;
   insert_working_baton_t iwb;
 
@@ -2798,16 +2799,16 @@ svn_wc__db_op_copy_file(svn_wc__db_t *db
                      && original_revision != SVN_INVALID_REVNUM));
   SVN_ERR_ASSERT(conflict == NULL);  /* ### can't handle yet  */
 
-  SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &local_relpath, db,
+  SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath, db,
                               local_abspath, svn_sqlite__mode_readwrite,
                               scratch_pool, scratch_pool));
-  VERIFY_USABLE_PDH(pdh);
+  VERIFY_USABLE_WCROOT(wcroot);
 
   blank_iwb(&iwb);
 
   iwb.presence = svn_wc__db_status_normal;
   iwb.kind = svn_wc__db_kind_file;
-  iwb.wc_id = pdh->wcroot->wc_id;
+  iwb.wc_id = wcroot->wc_id;
   iwb.local_relpath = local_relpath;
 
   iwb.props = props;
@@ -2820,7 +2821,7 @@ svn_wc__db_op_copy_file(svn_wc__db_t *db
     {
       SVN_ERR(create_repos_id(&iwb.original_repos_id,
                               original_root_url, original_uuid,
-                              pdh->wcroot->sdb, scratch_pool));
+                              wcroot->sdb, scratch_pool));
       iwb.original_repos_relpath = original_repos_relpath;
       iwb.original_revnum = original_revision;
     }
@@ -2828,16 +2829,15 @@ svn_wc__db_op_copy_file(svn_wc__db_t *db
   /* ### Should we do this inside the transaction? */
   SVN_ERR(op_depth_for_copy(&iwb.op_depth, iwb.original_repos_id,
                             original_repos_relpath, original_revision,
-                            pdh, local_relpath, scratch_pool));
+                            wcroot, local_relpath, scratch_pool));
 
   iwb.checksum = checksum;
 
   iwb.work_items = work_items;
 
-  SVN_ERR(svn_sqlite__with_transaction(pdh->wcroot->sdb,
-                                       insert_working_node, &iwb,
+  SVN_ERR(svn_sqlite__with_transaction(wcroot->sdb, insert_working_node, &iwb,
                                        scratch_pool));
-  SVN_ERR(flush_entries(db, pdh, local_abspath, scratch_pool));
+  SVN_ERR(flush_entries(db, wcroot, local_abspath, scratch_pool));
 
   return SVN_NO_ERROR;
 }
@@ -2859,7 +2859,7 @@ svn_wc__db_op_copy_symlink(svn_wc__db_t 
                            const svn_skel_t *work_items,
                            apr_pool_t *scratch_pool)
 {
-  svn_wc__db_pdh_t *pdh;
+  svn_wc__db_wcroot_t *wcroot;
   const char *local_relpath;
   insert_working_baton_t iwb;
 
@@ -2870,16 +2870,16 @@ svn_wc__db_op_copy_symlink(svn_wc__db_t 
   SVN_ERR_ASSERT(target != NULL);
   SVN_ERR_ASSERT(conflict == NULL);  /* ### can't handle yet  */
 
-  SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &local_relpath, db,
+  SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath, db,
                               local_abspath, svn_sqlite__mode_readwrite,
                               scratch_pool, scratch_pool));
-  VERIFY_USABLE_PDH(pdh);
+  VERIFY_USABLE_WCROOT(wcroot);
 
   blank_iwb(&iwb);
 
   iwb.presence = svn_wc__db_status_normal;
   iwb.kind = svn_wc__db_kind_symlink;
-  iwb.wc_id = pdh->wcroot->wc_id;
+  iwb.wc_id = wcroot->wc_id;
   iwb.local_relpath = local_relpath;
 
   iwb.props = props;
@@ -2892,7 +2892,7 @@ svn_wc__db_op_copy_symlink(svn_wc__db_t 
     {
       SVN_ERR(create_repos_id(&iwb.original_repos_id,
                               original_root_url, original_uuid,
-                              pdh->wcroot->sdb, scratch_pool));
+                              wcroot->sdb, scratch_pool));
       iwb.original_repos_relpath = original_repos_relpath;
       iwb.original_revnum = original_revision;
     }
@@ -2900,16 +2900,16 @@ svn_wc__db_op_copy_symlink(svn_wc__db_t 
   /* ### Should we do this inside the transaction? */
   SVN_ERR(op_depth_for_copy(&iwb.op_depth, iwb.original_repos_id,
                             original_repos_relpath, original_revision,
-                            pdh, local_relpath, scratch_pool));
+                            wcroot, local_relpath, scratch_pool));
 
   iwb.target = target;
 
   iwb.work_items = work_items;
 
-  SVN_ERR(svn_sqlite__with_transaction(pdh->wcroot->sdb,
+  SVN_ERR(svn_sqlite__with_transaction(wcroot->sdb,
                                        insert_working_node, &iwb,
                                        scratch_pool));
-  SVN_ERR(flush_entries(db, pdh, local_abspath, scratch_pool));
+  SVN_ERR(flush_entries(db, wcroot, local_abspath, scratch_pool));
 
   return SVN_NO_ERROR;
 }
@@ -2921,31 +2921,31 @@ svn_wc__db_op_add_directory(svn_wc__db_t
                             const svn_skel_t *work_items,
                             apr_pool_t *scratch_pool)
 {
-  svn_wc__db_pdh_t *pdh;
+  svn_wc__db_wcroot_t *wcroot;
   const char *local_relpath;
   insert_working_baton_t iwb;
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
 
-  SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &local_relpath, db,
+  SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath, db,
                               local_abspath, svn_sqlite__mode_readwrite,
                               scratch_pool, scratch_pool));
-  VERIFY_USABLE_PDH(pdh);
+  VERIFY_USABLE_WCROOT(wcroot);
 
   blank_iwb(&iwb);
 
   iwb.presence = svn_wc__db_status_normal;
   iwb.kind = svn_wc__db_kind_dir;
-  iwb.wc_id = pdh->wcroot->wc_id;
+  iwb.wc_id = wcroot->wc_id;
   iwb.local_relpath = local_relpath;
   iwb.op_depth = relpath_depth(local_relpath);
 
   iwb.work_items = work_items;
 
-  SVN_ERR(svn_sqlite__with_transaction(pdh->wcroot->sdb,
+  SVN_ERR(svn_sqlite__with_transaction(wcroot->sdb,
                                        insert_working_node, &iwb,
                                        scratch_pool));
-  SVN_ERR(flush_entries(db, pdh, local_abspath, scratch_pool));
+  SVN_ERR(flush_entries(db, wcroot, local_abspath, scratch_pool));
 
   return SVN_NO_ERROR;
 }
@@ -2957,31 +2957,31 @@ svn_wc__db_op_add_file(svn_wc__db_t *db,
                        const svn_skel_t *work_items,
                        apr_pool_t *scratch_pool)
 {
-  svn_wc__db_pdh_t *pdh;
+  svn_wc__db_wcroot_t *wcroot;
   const char *local_relpath;
   insert_working_baton_t iwb;
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
 
-  SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &local_relpath, db,
+  SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath, db,
                               local_abspath, svn_sqlite__mode_readwrite,
                               scratch_pool, scratch_pool));
-  VERIFY_USABLE_PDH(pdh);
+  VERIFY_USABLE_WCROOT(wcroot);
 
   blank_iwb(&iwb);
 
   iwb.presence = svn_wc__db_status_normal;
   iwb.kind = svn_wc__db_kind_file;
-  iwb.wc_id = pdh->wcroot->wc_id;
+  iwb.wc_id = wcroot->wc_id;
   iwb.local_relpath = local_relpath;
   iwb.op_depth = relpath_depth(local_relpath);
 
   iwb.work_items = work_items;
 
-  SVN_ERR(svn_sqlite__with_transaction(pdh->wcroot->sdb,
+  SVN_ERR(svn_sqlite__with_transaction(wcroot->sdb,
                                        insert_working_node, &iwb,
                                        scratch_pool));
-  SVN_ERR(flush_entries(db, pdh, local_abspath, scratch_pool));
+  SVN_ERR(flush_entries(db, wcroot, local_abspath, scratch_pool));
 
   return SVN_NO_ERROR;
 }
@@ -2994,23 +2994,23 @@ svn_wc__db_op_add_symlink(svn_wc__db_t *
                           const svn_skel_t *work_items,
                           apr_pool_t *scratch_pool)
 {
-  svn_wc__db_pdh_t *pdh;
+  svn_wc__db_wcroot_t *wcroot;
   const char *local_relpath;
   insert_working_baton_t iwb;
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
   SVN_ERR_ASSERT(target != NULL);
 
-  SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &local_relpath, db,
+  SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath, db,
                               local_abspath, svn_sqlite__mode_readwrite,
                               scratch_pool, scratch_pool));
-  VERIFY_USABLE_PDH(pdh);
+  VERIFY_USABLE_WCROOT(wcroot);
 
   blank_iwb(&iwb);
 
   iwb.presence = svn_wc__db_status_normal;
   iwb.kind = svn_wc__db_kind_symlink;
-  iwb.wc_id = pdh->wcroot->wc_id;
+  iwb.wc_id = wcroot->wc_id;
   iwb.local_relpath = local_relpath;
   iwb.op_depth = relpath_depth(local_relpath);
 
@@ -3018,10 +3018,10 @@ svn_wc__db_op_add_symlink(svn_wc__db_t *
 
   iwb.work_items = work_items;
 
-  SVN_ERR(svn_sqlite__with_transaction(pdh->wcroot->sdb,
+  SVN_ERR(svn_sqlite__with_transaction(wcroot->sdb,
                                        insert_working_node, &iwb,
                                        scratch_pool));
-  SVN_ERR(flush_entries(db, pdh, local_abspath, scratch_pool));
+  SVN_ERR(flush_entries(db, wcroot, local_abspath, scratch_pool));
 
   return SVN_NO_ERROR;
 }
@@ -3031,7 +3031,7 @@ struct set_props_baton
 {
   apr_hash_t *props;
 
-  svn_wc__db_pdh_t *pdh;
+  svn_wc__db_wcroot_t *wcroot;
   const char *local_relpath;
 
   const svn_skel_t *conflict;
@@ -3091,7 +3091,8 @@ set_props_txn(void *baton, svn_sqlite__d
   /* Check if the props are modified. If no changes, then wipe out the
      ACTUAL props.  PRISTINE_PROPS==NULL means that any
      ACTUAL props are okay as provided, so go ahead and set them.  */
-  SVN_ERR(db_read_pristine_props(&pristine_props, spb->pdh, spb->local_relpath,
+  SVN_ERR(db_read_pristine_props(&pristine_props, spb->wcroot,
+                                 spb->local_relpath,
                                  scratch_pool, scratch_pool));
   if (spb->props && pristine_props)
     {
@@ -3103,7 +3104,7 @@ set_props_txn(void *baton, svn_sqlite__d
         spb->props = NULL;
     }
 
-  SVN_ERR(set_actual_props(spb->pdh->wcroot->wc_id, spb->local_relpath,
+  SVN_ERR(set_actual_props(spb->wcroot->wc_id, spb->local_relpath,
                            spb->props, db, scratch_pool));
 
   return SVN_NO_ERROR;
@@ -3118,22 +3119,22 @@ svn_wc__db_op_set_props(svn_wc__db_t *db
                         apr_pool_t *scratch_pool)
 {
   struct set_props_baton spb;
-  svn_wc__db_pdh_t *pdh;
+  svn_wc__db_wcroot_t *wcroot;
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
 
-  SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &spb.local_relpath, db,
-                              local_abspath, svn_sqlite__mode_readwrite,
+  SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &spb.local_relpath,
+                              db, local_abspath, svn_sqlite__mode_readwrite,
                               scratch_pool, scratch_pool));
-  VERIFY_USABLE_PDH(pdh);
+  VERIFY_USABLE_WCROOT(wcroot);
 
   spb.props = props;
-  spb.pdh = pdh;
+  spb.wcroot = wcroot;
   spb.conflict = conflict;
   spb.work_items = work_items;
 
   return svn_error_return(
-            svn_sqlite__with_transaction(pdh->wcroot->sdb,
+            svn_sqlite__with_transaction(wcroot->sdb,
                                          set_props_txn,
                                          &spb,
                                          scratch_pool));
@@ -3301,25 +3302,25 @@ svn_wc__db_op_set_changelist(svn_wc__db_
                              const char *changelist,
                              apr_pool_t *scratch_pool)
 {
-  svn_wc__db_pdh_t *pdh;
+  svn_wc__db_wcroot_t *wcroot;
   struct set_changelist_baton scb;
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
 
-  SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &scb.local_relpath, db,
-                              local_abspath, svn_sqlite__mode_readwrite,
+  SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &scb.local_relpath,
+                              db, local_abspath, svn_sqlite__mode_readwrite,
                               scratch_pool, scratch_pool));
-  VERIFY_USABLE_PDH(pdh);
+  VERIFY_USABLE_WCROOT(wcroot);
 
-  scb.wc_id = pdh->wcroot->wc_id;
+  scb.wc_id = wcroot->wc_id;
   scb.changelist = changelist;
 
-  SVN_ERR(svn_sqlite__with_transaction(pdh->wcroot->sdb, set_changelist_txn,
+  SVN_ERR(svn_sqlite__with_transaction(wcroot->sdb, set_changelist_txn,
                                        &scb, scratch_pool));
 
   /* No need to flush the parent entries; changelists were not stored in the
      stub */
-  SVN_ERR(flush_entries(db, pdh, NULL, scratch_pool));
+  SVN_ERR(flush_entries(db, wcroot, local_abspath, scratch_pool));
 
   return SVN_NO_ERROR;
 }
@@ -3344,7 +3345,7 @@ svn_wc__db_op_mark_resolved(svn_wc__db_t
                             svn_boolean_t resolved_tree,
                             apr_pool_t *scratch_pool)
 {
-  svn_wc__db_pdh_t *pdh;
+  svn_wc__db_wcroot_t *wcroot;
   const char *local_relpath;
   svn_sqlite__stmt_t *stmt;
 
@@ -3353,10 +3354,10 @@ svn_wc__db_op_mark_resolved(svn_wc__db_t
   /* ### we're not ready to handy RESOLVED_TREE just yet.  */
   SVN_ERR_ASSERT(!resolved_tree);
 
-  SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &local_relpath, db,
+  SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath, db,
                               local_abspath, svn_sqlite__mode_readwrite,
                               scratch_pool, scratch_pool));
-  VERIFY_USABLE_PDH(pdh);
+  VERIFY_USABLE_WCROOT(wcroot);
 
   /* ### these two statements are not transacted together. is this a
      ### problem? I suspect a failure simply leaves the other in a
@@ -3365,23 +3366,21 @@ svn_wc__db_op_mark_resolved(svn_wc__db_t
 
   if (resolved_text)
     {
-      SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
+      SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
                                         STMT_CLEAR_TEXT_CONFLICT));
-      SVN_ERR(svn_sqlite__bindf(stmt, "is",
-                                pdh->wcroot->wc_id, local_relpath));
+      SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
       SVN_ERR(svn_sqlite__step_done(stmt));
     }
   if (resolved_props)
     {
-      SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
+      SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
                                         STMT_CLEAR_PROPS_CONFLICT));
-      SVN_ERR(svn_sqlite__bindf(stmt, "is",
-                                pdh->wcroot->wc_id, local_relpath));
+      SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
       SVN_ERR(svn_sqlite__step_done(stmt));
     }
 
   /* Some entries have cached the above values. Kapow!!  */
-  SVN_ERR(flush_entries(db, pdh, local_abspath, scratch_pool));
+  SVN_ERR(flush_entries(db, wcroot, local_abspath, scratch_pool));
 
   return SVN_NO_ERROR;
 }
@@ -3462,7 +3461,7 @@ svn_wc__db_op_set_tree_conflict(svn_wc__
                                 const svn_wc_conflict_description2_t *tree_conflict,
                                 apr_pool_t *scratch_pool)
 {
-  svn_wc__db_pdh_t *pdh;
+  svn_wc__db_wcroot_t *wcroot;
   struct set_tc_baton stb;
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
@@ -3470,26 +3469,26 @@ svn_wc__db_op_set_tree_conflict(svn_wc__
   stb.parent_abspath = svn_dirent_dirname(local_abspath, scratch_pool);
   stb.tree_conflict = tree_conflict;
 
-  SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &stb.local_relpath, db,
-                              local_abspath, svn_sqlite__mode_readwrite,
+  SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &stb.local_relpath,
+                              db, local_abspath, svn_sqlite__mode_readwrite,
                               scratch_pool, scratch_pool));
-  VERIFY_USABLE_PDH(pdh);
+  VERIFY_USABLE_WCROOT(wcroot);
 
-  stb.wc_id = pdh->wcroot->wc_id;
+  stb.wc_id = wcroot->wc_id;
 
   /* ### does this work correctly? */
   stb.parent_relpath = svn_relpath_dirname(stb.local_relpath, scratch_pool);
 
   /* Should probably be in the same txn as above, but since we can't
-     guarantee that pdh->wcroot->sdb is the same for both, and since
+     guarantee that wcroot->sdb is the same for both, and since
      the above implementation is going away, we'll fudge a bit here.
 
-     ### Or can we guarantee pdh->wcroot->sdb is the same, given single db? */
-  SVN_ERR(svn_sqlite__with_transaction(pdh->wcroot->sdb, set_tc_txn2, &stb,
+     ### Or can we guarantee wcroot->sdb is the same, given single db? */
+  SVN_ERR(svn_sqlite__with_transaction(wcroot->sdb, set_tc_txn2, &stb,
                                        scratch_pool));
 
   /* There may be some entries, and the lock info is now out of date.  */
-  SVN_ERR(flush_entries(db, pdh, local_abspath, scratch_pool));
+  SVN_ERR(flush_entries(db, wcroot, local_abspath, scratch_pool));
 
   return SVN_NO_ERROR;
 }
@@ -3500,21 +3499,21 @@ svn_wc__db_op_revert_actual(svn_wc__db_t
                             const char *local_abspath,
                             apr_pool_t *scratch_pool)
 {
-  svn_wc__db_pdh_t *pdh;
+  svn_wc__db_wcroot_t *wcroot;
   const char *local_relpath;
   svn_sqlite__stmt_t *stmt;
   int affected_rows;
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
 
-  SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &local_relpath, db,
+  SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath, db,
                               local_abspath, svn_sqlite__mode_readwrite,
                               scratch_pool, scratch_pool));
-  VERIFY_USABLE_PDH(pdh);
+  VERIFY_USABLE_WCROOT(wcroot);
 
-  SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
+  SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
                                     STMT_DELETE_ACTUAL_NODE));
-  SVN_ERR(svn_sqlite__bindf(stmt, "is", pdh->wcroot->wc_id, local_relpath));
+  SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
   SVN_ERR(svn_sqlite__update(&affected_rows, stmt));
 
   if (affected_rows == 0)
@@ -3522,16 +3521,196 @@ svn_wc__db_op_revert_actual(svn_wc__db_t
       /* Failed to delete the row.
          Presumably because there was a changelist set on it */
 
-      SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
+      SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
                                  STMT_CLEAR_ACTUAL_NODE_LEAVING_CHANGELIST));
-      SVN_ERR(svn_sqlite__bindf(stmt, "is", pdh->wcroot->wc_id, local_relpath));
+      SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
       SVN_ERR(svn_sqlite__step_done(stmt));
       /* We're not interested here if there was an affected row or not:
          If there isn't by now, then there simply was no row to begin with */
     }
 
   /* Some entries have cached the above values. Kapow!!  */
-  SVN_ERR(flush_entries(db, pdh, local_abspath, scratch_pool));
+  SVN_ERR(flush_entries(db, wcroot, local_abspath, scratch_pool));
+
+  return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+remove_children(svn_wc__db_wcroot_t *wcroot,
+                const char *local_relpath,
+                svn_wc__db_status_t status,
+                apr_int64_t op_depth,
+                apr_pool_t *scratch_pool);
+
+struct op_revert_baton {
+  svn_wc__db_wcroot_t *wcroot;
+  const char *local_relpath;
+};
+
+static svn_error_t *
+op_revert_txn(void *baton, svn_sqlite__db_t *sdb, apr_pool_t *scratch_pool)
+{
+  struct op_revert_baton *b = baton;
+  svn_sqlite__stmt_t *stmt;
+  svn_boolean_t have_row;
+  apr_int64_t op_depth;
+  int affected_rows;
+
+  /* ### Similar structure to op_revert_recursive_txn, should they be
+         combined? */
+
+  SVN_ERR(svn_sqlite__get_statement(&stmt, b->wcroot->sdb,
+                                    STMT_DELETE_ACTUAL_NODE));
+  SVN_ERR(svn_sqlite__bindf(stmt, "is", b->wcroot->wc_id,
+                            b->local_relpath));
+  SVN_ERR(svn_sqlite__update(&affected_rows, stmt));
+
+  SVN_ERR(svn_sqlite__get_statement(&stmt, b->wcroot->sdb,
+                                    STMT_SELECT_NODE_INFO));
+  SVN_ERR(svn_sqlite__bindf(stmt, "is", b->wcroot->wc_id,
+                            b->local_relpath));
+  SVN_ERR(svn_sqlite__step(&have_row, stmt));
+  if (!have_row)
+    {
+      SVN_ERR(svn_sqlite__reset(stmt));
+      if (affected_rows)
+        {
+          /* Can't do non-recursive actual-only revert if actual-only
+             children exist */
+          SVN_ERR(svn_sqlite__get_statement(&stmt, b->wcroot->sdb,
+                                            STMT_SELECT_ACTUAL_CHILDREN));
+          SVN_ERR(svn_sqlite__bindf(stmt, "is", b->wcroot->wc_id,
+                                    b->local_relpath));
+          SVN_ERR(svn_sqlite__step(&have_row, stmt));
+          SVN_ERR(svn_sqlite__reset(stmt));
+          if (have_row)
+            return svn_error_createf(SVN_ERR_WC_INVALID_OPERATION_DEPTH, NULL,
+                                     _("Can't revert '%s' without"
+                                       " reverting children"),
+                                     path_for_error_message(b->wcroot,
+                                                            b->local_relpath,
+                                                            scratch_pool));
+          return SVN_NO_ERROR;
+        }
+
+      return svn_error_createf(SVN_ERR_WC_PATH_NOT_FOUND, NULL,
+                               _("The node '%s' was not found."),
+                               path_for_error_message(b->wcroot,
+                                                      b->local_relpath,
+                                                      scratch_pool));
+    }
+
+  op_depth = svn_sqlite__column_int64(stmt, 0);
+  SVN_ERR(svn_sqlite__reset(stmt));
+
+  if (op_depth > 0)
+    {
+      if (op_depth != relpath_depth(b->local_relpath))
+        return svn_error_createf(SVN_ERR_WC_INVALID_OPERATION_DEPTH, NULL,
+                                 _("Can't revert '%s' without"
+                                   " reverting parent"),
+                                 path_for_error_message(b->wcroot,
+                                                        b->local_relpath,
+                                                        scratch_pool));
+
+      /* Can't do non-recursive revert if children exist */
+      SVN_ERR(svn_sqlite__get_statement(&stmt, b->wcroot->sdb,
+                                        STMT_SELECT_GE_OP_DEPTH_CHILDREN));
+      SVN_ERR(svn_sqlite__bindf(stmt, "isi", b->wcroot->wc_id,
+                                b->local_relpath, op_depth));
+      SVN_ERR(svn_sqlite__step(&have_row, stmt));
+      SVN_ERR(svn_sqlite__reset(stmt));
+      if (have_row)
+        return svn_error_createf(SVN_ERR_WC_INVALID_OPERATION_DEPTH, NULL,
+                                 _("Can't revert '%s' without"
+                                   " reverting children"),
+                                 path_for_error_message(b->wcroot,
+                                                        b->local_relpath,
+                                                        scratch_pool));
+
+      /* Rewrite the op-depth of all deleted children making the
+         direct children into roots of deletes. */
+      SVN_ERR(svn_sqlite__get_statement(&stmt, b->wcroot->sdb,
+                                     STMT_UPDATE_OP_DEPTH_INCREASE_RECURSIVE));
+      SVN_ERR(svn_sqlite__bindf(stmt, "isi", b->wcroot->wc_id,
+                                construct_like_arg(b->local_relpath,
+                                                   scratch_pool),
+                                op_depth));
+      SVN_ERR(svn_sqlite__step_done(stmt));
+
+      SVN_ERR(svn_sqlite__get_statement(&stmt, b->wcroot->sdb,
+                                        STMT_DELETE_WORKING_NODE));
+      SVN_ERR(svn_sqlite__bindf(stmt, "is", b->wcroot->wc_id,
+                                b->local_relpath));
+      SVN_ERR(svn_sqlite__step_done(stmt));
+    }
+
+  return SVN_NO_ERROR;
+}
+
+
+static svn_error_t *
+op_revert_recursive_txn(void *baton,
+                        svn_sqlite__db_t *sdb,
+                        apr_pool_t *scratch_pool)
+{
+  struct op_revert_baton *b = baton;
+  svn_sqlite__stmt_t *stmt;
+  svn_boolean_t have_row;
+  apr_int64_t op_depth;
+  int affected_rows;
+
+  /* ### Similar structure to op_revert_txn, should they be
+         combined? */
+
+  SVN_ERR(svn_sqlite__get_statement(&stmt, b->wcroot->sdb,
+                                    STMT_DELETE_ACTUAL_NODE_RECURSIVE));
+  SVN_ERR(svn_sqlite__bindf(stmt, "iss", b->wcroot->wc_id,
+                            b->local_relpath,
+                            construct_like_arg(b->local_relpath,
+                                               scratch_pool)));
+  SVN_ERR(svn_sqlite__step(&affected_rows, stmt));
+
+  SVN_ERR(svn_sqlite__get_statement(&stmt, b->wcroot->sdb,
+                                    STMT_SELECT_NODE_INFO));
+  SVN_ERR(svn_sqlite__bindf(stmt, "is", b->wcroot->wc_id,
+                            b->local_relpath));
+  SVN_ERR(svn_sqlite__step(&have_row, stmt));
+  if (!have_row)
+    {
+      SVN_ERR(svn_sqlite__reset(stmt));
+      if (affected_rows)
+        return SVN_NO_ERROR;  /* actual-only revert */
+
+      return svn_error_createf(SVN_ERR_WC_PATH_NOT_FOUND, NULL,
+                               _("The node '%s' was not found."),
+                               path_for_error_message(b->wcroot,
+                                                      b->local_relpath,
+                                                      scratch_pool));
+    }
+
+  op_depth = svn_sqlite__column_int64(stmt, 0);
+  SVN_ERR(svn_sqlite__reset(stmt));
+
+  if (op_depth > 0 && op_depth != relpath_depth(b->local_relpath))
+    return svn_error_createf(SVN_ERR_WC_INVALID_OPERATION_DEPTH, NULL,
+                             _("Can't revert '%s' without"
+                               " reverting parent"),
+                             path_for_error_message(b->wcroot,
+                                                    b->local_relpath,
+                                                    scratch_pool));
+
+  if (!op_depth)
+    op_depth = 1; /* Don't delete BASE nodes */
+
+  SVN_ERR(svn_sqlite__get_statement(&stmt, b->wcroot->sdb,
+                                    STMT_DELETE_NODES_RECURSIVE));
+  SVN_ERR(svn_sqlite__bindf(stmt, "issi", b->wcroot->wc_id,
+                            b->local_relpath,
+                            construct_like_arg(b->local_relpath,
+                                               scratch_pool),
+                            op_depth));
+  SVN_ERR(svn_sqlite__step_done(stmt));
 
   return SVN_NO_ERROR;
 }
@@ -3542,9 +3721,35 @@ svn_wc__db_op_revert(svn_wc__db_t *db,
                      svn_depth_t depth,
                      apr_pool_t *scratch_pool)
 {
+  struct op_revert_baton b;
+  svn_sqlite__transaction_callback_t txn_func;
+
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
 
-  NOT_IMPLEMENTED();
+  switch (depth)
+    {
+    case svn_depth_empty:
+      txn_func = op_revert_txn;
+      break;
+    case svn_depth_infinity:
+      txn_func = op_revert_recursive_txn;
+      break;
+    default:
+      return svn_error_createf(SVN_ERR_UNSUPPORTED_FEATURE, NULL,
+                               _("Unsupported depth for revert of '%s'"),
+                               svn_dirent_local_style(local_abspath,
+                                                      scratch_pool));
+    }
+
+  SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&b.wcroot, &b.local_relpath,
+                              db, local_abspath, svn_sqlite__mode_readwrite,
+                              scratch_pool, scratch_pool));
+  VERIFY_USABLE_WCROOT(b.wcroot);
+
+  SVN_ERR(svn_sqlite__with_transaction(b.wcroot->sdb, txn_func,
+                                       &b, scratch_pool));
+
+  return SVN_NO_ERROR;
 }
 
 
@@ -3553,7 +3758,7 @@ svn_wc__db_op_revert(svn_wc__db_t *db,
  * produced by svn_wc__write_tree_conflicts(). */
 static svn_error_t *
 read_all_tree_conflicts(apr_hash_t **tree_conflicts,
-                        svn_wc__db_pdh_t *pdh,
+                        svn_wc__db_wcroot_t *wcroot,
                         const char *local_relpath,
                         apr_pool_t *result_pool,
                         apr_pool_t *scratch_pool)
@@ -3565,9 +3770,9 @@ read_all_tree_conflicts(apr_hash_t **tre
   *tree_conflicts = apr_hash_make(result_pool);
 
   /* Get the conflict information for children of LOCAL_ABSPATH. */
-  SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
+  SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
                                STMT_SELECT_ACTUAL_CHILDREN_TREE_CONFLICT));
-  SVN_ERR(svn_sqlite__bindf(stmt, "is", pdh->wcroot->wc_id, local_relpath));
+  SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
   SVN_ERR(svn_sqlite__step(&have_row, stmt));
   while (have_row)
     {
@@ -3584,8 +3789,7 @@ read_all_tree_conflicts(apr_hash_t **tre
 
       conflict_data = svn_sqlite__column_text(stmt, 1, NULL);
       skel = svn_skel__parse(conflict_data, strlen(conflict_data), iterpool);
-      SVN_ERR(svn_wc__deserialize_conflict(&conflict, skel,
-                                           pdh->wcroot->abspath,
+      SVN_ERR(svn_wc__deserialize_conflict(&conflict, skel, wcroot->abspath,
                                            result_pool, iterpool));
 
       apr_hash_set(*tree_conflicts, child_basename, APR_HASH_KEY_STRING,
@@ -3606,27 +3810,27 @@ svn_wc__db_op_read_all_tree_conflicts(ap
                                       apr_pool_t *result_pool,
                                       apr_pool_t *scratch_pool)
 {
-  svn_wc__db_pdh_t *pdh;
+  svn_wc__db_wcroot_t *wcroot;
   const char *local_relpath;
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
 
-  SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &local_relpath, db,
+  SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath, db,
                               local_abspath, svn_sqlite__mode_readwrite,
                               scratch_pool, scratch_pool));
-  VERIFY_USABLE_PDH(pdh);
+  VERIFY_USABLE_WCROOT(wcroot);
 
-  SVN_ERR(read_all_tree_conflicts(tree_conflicts, pdh, local_relpath,
+  SVN_ERR(read_all_tree_conflicts(tree_conflicts, wcroot, local_relpath,
                                   result_pool, scratch_pool));
 
   return SVN_NO_ERROR;
 }
 
-/* Like svn_wc__db_op_read_tree_conflict(), but with PDH+LOCAL_RELPATH
+/* Like svn_wc__db_op_read_tree_conflict(), but with WCROOT+LOCAL_RELPATH
  * instead of DB+LOCAL_ABSPATH. */
 static svn_error_t *
 read_tree_conflict(const svn_wc_conflict_description2_t **tree_conflict,
-                   svn_wc__db_pdh_t *pdh,
+                   svn_wc__db_wcroot_t *wcroot,
                    const char *local_relpath,
                    apr_pool_t *result_pool,
                    apr_pool_t *scratch_pool)
@@ -3642,9 +3846,9 @@ read_tree_conflict(const svn_wc_conflict
   if (!local_relpath[0])
     return SVN_NO_ERROR;
 
-  SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
+  SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
                                     STMT_SELECT_ACTUAL_TREE_CONFLICT));
-  SVN_ERR(svn_sqlite__bindf(stmt, "is", pdh->wcroot->wc_id, local_relpath));
+  SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
   SVN_ERR(svn_sqlite__step(&have_row, stmt));
 
   if (!have_row)
@@ -3653,7 +3857,7 @@ read_tree_conflict(const svn_wc_conflict
   conflict_data = svn_sqlite__column_text(stmt, 0, NULL);
   skel = svn_skel__parse(conflict_data, strlen(conflict_data), scratch_pool);
   err = svn_wc__deserialize_conflict(tree_conflict, skel,
-                                     pdh->wcroot->abspath, result_pool,
+                                     wcroot->abspath, result_pool,
                                      scratch_pool);
 
   return svn_error_compose_create(err,
@@ -3668,16 +3872,16 @@ svn_wc__db_op_read_tree_conflict(
                      apr_pool_t *result_pool,
                      apr_pool_t *scratch_pool)
 {
-  svn_wc__db_pdh_t *pdh;
+  svn_wc__db_wcroot_t *wcroot;
   const char *local_relpath;
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
 
-  SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &local_relpath, db,
+  SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath, db,
                               local_abspath, svn_sqlite__mode_readonly,
                               scratch_pool, scratch_pool));
 
-  SVN_ERR(read_tree_conflict(tree_conflict, pdh, local_relpath,
+  SVN_ERR(read_tree_conflict(tree_conflict, wcroot, local_relpath,
                              result_pool, scratch_pool));
 
   return SVN_NO_ERROR;
@@ -3688,31 +3892,26 @@ svn_wc__db_temp_op_remove_entry(svn_wc__
                                 const char *local_abspath,
                                 apr_pool_t *scratch_pool)
 {
-  svn_wc__db_pdh_t *pdh;
+  svn_wc__db_wcroot_t *wcroot;
   svn_sqlite__stmt_t *stmt;
-  svn_sqlite__db_t *sdb;
-  apr_int64_t wc_id;
   const char *local_relpath;
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
 
-  SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &local_relpath, db,
+  SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath, db,
                               local_abspath, svn_sqlite__mode_readwrite,
                               scratch_pool, scratch_pool));
-  VERIFY_USABLE_PDH(pdh);
-
-  SVN_ERR(flush_entries(db, pdh, local_abspath, scratch_pool));
+  VERIFY_USABLE_WCROOT(wcroot);
 
-  sdb = pdh->wcroot->sdb;
-  wc_id = pdh->wcroot->wc_id;
+  SVN_ERR(flush_entries(db, wcroot, local_abspath, scratch_pool));
 
-  SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, STMT_DELETE_NODES));
-  SVN_ERR(svn_sqlite__bindf(stmt, "is", wc_id, local_relpath));
+  SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb, STMT_DELETE_NODES));
+  SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
   SVN_ERR(svn_sqlite__step_done(stmt));
 
-  SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
+  SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
                                     STMT_DELETE_ACTUAL_NODE_WITHOUT_CONFLICT));
-  SVN_ERR(svn_sqlite__bindf(stmt, "is", wc_id, local_relpath));
+  SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
 
   SVN_ERR(svn_sqlite__step_done(stmt));
 
@@ -3725,22 +3924,22 @@ svn_wc__db_temp_op_remove_working(svn_wc
                                   const char *local_abspath,
                                   apr_pool_t *scratch_pool)
 {
-  svn_wc__db_pdh_t *pdh;
+  svn_wc__db_wcroot_t *wcroot;
   svn_sqlite__stmt_t *stmt;
   const char *local_relpath;
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
 
-  SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &local_relpath, db,
+  SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath, db,
                               local_abspath, svn_sqlite__mode_readwrite,
                               scratch_pool, scratch_pool));
-  VERIFY_USABLE_PDH(pdh);
+  VERIFY_USABLE_WCROOT(wcroot);
 
-  SVN_ERR(flush_entries(db, pdh, local_abspath, scratch_pool));
+  SVN_ERR(flush_entries(db, wcroot, local_abspath, scratch_pool));
 
-  SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
+  SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
                                     STMT_DELETE_WORKING_NODE));
-  SVN_ERR(svn_sqlite__bindf(stmt, "is", pdh->wcroot->wc_id, local_relpath));
+  SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
   SVN_ERR(svn_sqlite__step_done(stmt));
 
   return SVN_NO_ERROR;
@@ -3750,7 +3949,7 @@ svn_wc__db_temp_op_remove_working(svn_wc
 static svn_error_t *
 update_depth_values(svn_wc__db_t *db,
                     const char *local_abspath,
-                    svn_wc__db_pdh_t *pdh,
+                    svn_wc__db_wcroot_t *wcroot,
                     const char *local_relpath,
                     svn_depth_t depth,
                     apr_pool_t *scratch_pool)
@@ -3759,22 +3958,22 @@ update_depth_values(svn_wc__db_t *db,
   svn_sqlite__stmt_t *stmt;
 
   /* Flush any entries before we start monkeying the database.  */
-  SVN_ERR(flush_entries(db, pdh, local_abspath, scratch_pool));
+  SVN_ERR(flush_entries(db, wcroot, local_abspath, scratch_pool));
 
-  SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
+  SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
                                     excluded
                                       ? STMT_UPDATE_NODE_BASE_EXCLUDED
                                       : STMT_UPDATE_NODE_BASE_DEPTH));
-  SVN_ERR(svn_sqlite__bindf(stmt, "is", pdh->wcroot->wc_id, local_relpath));
+  SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
   if (!excluded)
     SVN_ERR(svn_sqlite__bind_text(stmt, 3, svn_depth_to_word(depth)));
   SVN_ERR(svn_sqlite__step_done(stmt));
 
-  SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
+  SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
                                     excluded
                                       ? STMT_UPDATE_NODE_WORKING_EXCLUDED
                                       : STMT_UPDATE_NODE_WORKING_DEPTH));
-  SVN_ERR(svn_sqlite__bindf(stmt, "is", pdh->wcroot->wc_id, local_relpath));
+  SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
   if (!excluded)
     SVN_ERR(svn_sqlite__bind_text(stmt, 3, svn_depth_to_word(depth)));
   SVN_ERR(svn_sqlite__step_done(stmt));
@@ -3789,21 +3988,21 @@ svn_wc__db_temp_op_set_dir_depth(svn_wc_
                                  svn_depth_t depth,
                                   apr_pool_t *scratch_pool)
 {
-  svn_wc__db_pdh_t *pdh;
+  svn_wc__db_wcroot_t *wcroot;
   const char *local_relpath;
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
   SVN_ERR_ASSERT(depth >= svn_depth_empty && depth <= svn_depth_infinity);
 
-  SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &local_relpath, db,
+  SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath, db,
                               local_abspath, svn_sqlite__mode_readwrite,
                               scratch_pool, scratch_pool));
-  VERIFY_USABLE_PDH(pdh);
+  VERIFY_USABLE_WCROOT(wcroot);
 
   /* ### We set depth on working and base to match entry behavior.
          Maybe these should be separated later? */
 
-  SVN_ERR(update_depth_values(db, local_abspath, pdh, local_relpath, depth,
+  SVN_ERR(update_depth_values(db, local_abspath, wcroot, local_relpath, depth,
                               scratch_pool));
 
   return SVN_NO_ERROR;
@@ -3815,7 +4014,7 @@ svn_wc__db_temp_op_set_dir_depth(svn_wc_
 
    ### Do we need to handle incomplete here? */
 static svn_error_t *
-remove_children(svn_wc__db_pdh_t *pdh,
+remove_children(svn_wc__db_wcroot_t *wcroot,
                 const char *local_relpath,
                 svn_wc__db_status_t status,
                 apr_int64_t op_depth,
@@ -3823,9 +4022,9 @@ remove_children(svn_wc__db_pdh_t *pdh,
 {
   svn_sqlite__stmt_t *stmt;
 
-  SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
+  SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
                                     STMT_DELETE_CHILD_NODES_RECURSIVE));
-  SVN_ERR(svn_sqlite__bindf(stmt, "isit", pdh->wcroot->wc_id,
+  SVN_ERR(svn_sqlite__bindf(stmt, "isit", wcroot->wc_id,
                             construct_like_arg(local_relpath,
                                                scratch_pool),
                             op_depth, presence_map, status));
@@ -3835,7 +4034,7 @@ remove_children(svn_wc__db_pdh_t *pdh,
 }
 
 static svn_error_t *
-db_working_actual_remove(svn_wc__db_pdh_t *pdh,
+db_working_actual_remove(svn_wc__db_wcroot_t *wcroot,
                          const char *local_relpath,
                          apr_pool_t *scratch_pool);
 
@@ -3843,7 +4042,7 @@ static svn_error_t *
 info_below_working(svn_boolean_t *have_base,
                    svn_boolean_t *have_work,
                    svn_wc__db_status_t *status,
-                   svn_wc__db_pdh_t *pdh,
+                   svn_wc__db_wcroot_t *wcroot,
                    const char *local_relpath,
                    apr_pool_t *scratch_pool);
 
@@ -3851,15 +4050,15 @@ info_below_working(svn_boolean_t *have_b
 static svn_error_t *
 db_working_update_presence(apr_int64_t op_depth,
                            svn_wc__db_status_t status,
-                           svn_wc__db_pdh_t *pdh,
+                           svn_wc__db_wcroot_t *wcroot,
                            const char *local_relpath,
                            apr_pool_t *scratch_pool)
 {
   svn_sqlite__stmt_t *stmt;
 
-  SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
+  SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
                                     STMT_UPDATE_NODE_WORKING_PRESENCE));
-  SVN_ERR(svn_sqlite__bindf(stmt, "ist", pdh->wcroot->wc_id, local_relpath,
+  SVN_ERR(svn_sqlite__bindf(stmt, "ist", wcroot->wc_id, local_relpath,
                             presence_map, status));
   SVN_ERR(svn_sqlite__step_done(stmt));
 
@@ -3873,14 +4072,14 @@ db_working_update_presence(apr_int64_t o
 
       /* Children of the copy will be marked deleted in the layer
          above. */
-      SVN_ERR(remove_children(pdh, local_relpath,
+      SVN_ERR(remove_children(wcroot, local_relpath,
                               svn_wc__db_status_base_deleted, op_depth + 1,
                               scratch_pool));
 
       /* Children of the copy that overlay a lower level become
          base_deleted, otherwise they get removed. */
-      SVN_ERR(gather_repo_children(&children, pdh, local_relpath, op_depth,
-                                   scratch_pool, scratch_pool));
+      SVN_ERR(gather_repo_children(&children, wcroot, local_relpath,
+                                   op_depth, scratch_pool, scratch_pool));
       iterpool = svn_pool_create(scratch_pool);
       for (i = 0; i < children->nelts; ++i)
         {
@@ -3893,24 +4092,25 @@ db_working_update_presence(apr_int64_t o
 
           child_relpath = svn_relpath_join(local_relpath, name, iterpool);
           SVN_ERR(info_below_working(&below_base, &below_work, &below_status,
-                                     pdh, child_relpath, iterpool));
+                                     wcroot, child_relpath, iterpool));

[... 2773 lines stripped ...]