You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by pb...@apache.org on 2010/11/15 19:50:41 UTC

svn commit: r1035404 [2/15] - in /subversion/branches/issue-3668-3669: ./ build/ build/generator/ build/generator/templates/ build/win32/ subversion/bindings/javahl/native/ subversion/bindings/javahl/src/org/apache/subversion/javahl/ subversion/binding...

Modified: subversion/branches/issue-3668-3669/subversion/libsvn_wc/upgrade.c
URL: http://svn.apache.org/viewvc/subversion/branches/issue-3668-3669/subversion/libsvn_wc/upgrade.c?rev=1035404&r1=1035403&r2=1035404&view=diff
==============================================================================
--- subversion/branches/issue-3668-3669/subversion/libsvn_wc/upgrade.c (original)
+++ subversion/branches/issue-3668-3669/subversion/libsvn_wc/upgrade.c Mon Nov 15 18:50:38 2010
@@ -631,6 +631,60 @@ bump_to_13(void *baton, svn_sqlite__db_t
   return SVN_NO_ERROR;
 }
 
+/*
+ * Read tree conflict descriptions from @a conflict_data.  Set @a *conflicts
+ * to a hash of pointers to svn_wc_conflict_description2_t objects indexed by
+ * svn_wc_conflict_description2_t.local_abspath, all newly allocated in @a
+ * pool.  @a dir_path is the path to the working copy directory whose conflicts
+ * are being read.  The conflicts read are the tree conflicts on the immediate
+ * child nodes of @a dir_path.  Do all allocations in @a pool.
+ *
+ * Note: There were some concerns about this function:
+ *
+ * ### this is BAD. the CONFLICTS structure should not be dependent upon
+ * ### DIR_PATH. each conflict should be labeled with an entry name, not
+ * ### a whole path. (and a path which happens to vary based upon invocation
+ * ### of the user client and these APIs)
+ *
+ * those assumptions were baked into former versions of the data model, so
+ * they have to stick around here.  But they have been removed from the
+ * New Way. */
+static svn_error_t *
+read_tree_conflicts(apr_hash_t **conflicts,
+                    const char *conflict_data,
+                    const char *dir_path,
+                    apr_pool_t *pool)
+{
+  const svn_skel_t *skel;
+  apr_pool_t *iterpool;
+
+  *conflicts = apr_hash_make(pool);
+
+  if (conflict_data == NULL)
+    return SVN_NO_ERROR;
+
+  skel = svn_skel__parse(conflict_data, strlen(conflict_data), pool);
+  if (skel == NULL)
+    return svn_error_create(SVN_ERR_WC_CORRUPT, NULL,
+                            _("Error parsing tree conflict skel"));
+
+  iterpool = svn_pool_create(pool);
+  for (skel = skel->children; skel != NULL; skel = skel->next)
+    {
+      const svn_wc_conflict_description2_t *conflict;
+
+      svn_pool_clear(iterpool);
+      SVN_ERR(svn_wc__deserialize_conflict(&conflict, skel, dir_path,
+                                           pool, iterpool));
+      if (conflict != NULL)
+        apr_hash_set(*conflicts, svn_dirent_basename(conflict->local_abspath,
+                                                     pool),
+                     APR_HASH_KEY_STRING, conflict);
+    }
+  svn_pool_destroy(iterpool);
+
+  return SVN_NO_ERROR;
+}
 
 /* */
 static svn_error_t *
@@ -644,8 +698,8 @@ migrate_single_tree_conflict_data(svn_sq
   apr_hash_index_t *hi;
   apr_pool_t *iterpool;
 
-  SVN_ERR(svn_wc__read_tree_conflicts(&conflicts, tree_conflict_data,
-                                      local_relpath, scratch_pool));
+  SVN_ERR(read_tree_conflicts(&conflicts, tree_conflict_data, local_relpath,
+                              scratch_pool));
 
   iterpool = svn_pool_create(scratch_pool);
   for (hi = apr_hash_first(scratch_pool, conflicts);
@@ -1362,13 +1416,11 @@ svn_wc__upgrade_sdb(int *result_format,
         *result_format = 20;
         /* FALLTHROUGH  */
 
-#if SVN_WC__VERSION >= 21
       case 20:
         SVN_ERR(svn_sqlite__with_transaction(sdb, bump_to_21, &bb,
                                              scratch_pool));
         *result_format = 21;
         /* FALLTHROUGH  */
-#endif
 
       /* ### future bumps go here.  */
 #if 0

Modified: subversion/branches/issue-3668-3669/subversion/libsvn_wc/wc-queries.sql
URL: http://svn.apache.org/viewvc/subversion/branches/issue-3668-3669/subversion/libsvn_wc/wc-queries.sql?rev=1035404&r1=1035403&r2=1035404&view=diff
==============================================================================
--- subversion/branches/issue-3668-3669/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/branches/issue-3668-3669/subversion/libsvn_wc/wc-queries.sql Mon Nov 15 18:50:38 2010
@@ -85,6 +85,11 @@ conflict_working, tree_conflict_data, pr
 FROM actual_node
 WHERE wc_id = ?1 AND local_relpath = ?2;
 
+-- STMT_SELECT_ACTUAL_TREE_CONFLICT
+SELECT conflict_data
+FROM actual_node
+WHERE wc_id = ?1 AND local_relpath = ?2 AND conflict_data IS NOT NULL;
+
 -- STMT_SELECT_NODE_CHILDREN_INFO
 /* Getting rows in an advantageous order using
      ORDER BY local_relpath, op_depth DESC
@@ -455,7 +460,8 @@ SELECT local_relpath
 FROM actual_node
 WHERE wc_id = ?1 AND parent_relpath = ?2 AND
   NOT ((prop_reject IS NULL) AND (conflict_old IS NULL)
-       AND (conflict_new IS NULL) AND (conflict_working IS NULL))
+       AND (conflict_new IS NULL) AND (conflict_working IS NULL)
+       AND (conflict_data IS NULL))
 
 -- STMT_SELECT_ACTUAL_CHILDREN_TREE_CONFLICT
 SELECT local_relpath, conflict_data
@@ -517,27 +523,29 @@ SELECT wc_id, local_relpath, ?3 AS op_de
 FROM nodes
 WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0;
 
--- STMT_INSERT_WORKING_NODE_NORMAL_FROM_BASE
+-- STMT_INSERT_WORKING_NODE_FROM_BASE_COPY
 INSERT INTO nodes (
     wc_id, local_relpath, op_depth, parent_relpath, repos_id, repos_path,
     revision, presence, depth, kind, changed_revision, changed_date,
     changed_author, checksum, properties, translated_size, last_mod_time,
     symlink_target )
 SELECT wc_id, local_relpath, ?3 AS op_depth, parent_relpath, repos_id,
-    repos_path, revision, 'normal', depth, kind, changed_revision,
+    repos_path, revision, presence, depth, kind, changed_revision,
     changed_date, changed_author, checksum, properties, translated_size,
     last_mod_time, symlink_target
 FROM nodes
 WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0;
 
-
--- STMT_INSERT_WORKING_NODE_NOT_PRESENT_FROM_BASE
+-- STMT_INSERT_WORKING_NODE_FROM_BASE_COPY_PRESENCE
 INSERT INTO nodes (
     wc_id, local_relpath, op_depth, parent_relpath, repos_id, repos_path,
-    revision, presence, kind, changed_revision, changed_date, changed_author )
-SELECT wc_id, local_relpath, ?3 as op_depth, parent_relpath, repos_id,
-       repos_path, revision, 'not-present', kind, changed_revision,
-       changed_date, changed_author
+    revision, presence, depth, kind, changed_revision, changed_date,
+    changed_author, checksum, properties, translated_size, last_mod_time,
+    symlink_target )
+SELECT wc_id, local_relpath, ?3 AS op_depth, parent_relpath, repos_id,
+    repos_path, revision, ?4 AS presence, depth, kind, changed_revision,
+    changed_date, changed_author, checksum, properties, translated_size,
+    last_mod_time, symlink_target
 FROM nodes
 WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0;
 

Modified: subversion/branches/issue-3668-3669/subversion/libsvn_wc/wc.h
URL: http://svn.apache.org/viewvc/subversion/branches/issue-3668-3669/subversion/libsvn_wc/wc.h?rev=1035404&r1=1035403&r2=1035404&view=diff
==============================================================================
--- subversion/branches/issue-3668-3669/subversion/libsvn_wc/wc.h (original)
+++ subversion/branches/issue-3668-3669/subversion/libsvn_wc/wc.h Mon Nov 15 18:50:38 2010
@@ -129,7 +129,7 @@ extern "C" {
  * Please document any further format changes here.
  */
 
-#define SVN_WC__VERSION 20
+#define SVN_WC__VERSION 21
 
 /* Formats <= this have no concept of "revert text-base/props".  */
 #define SVN_WC__NO_REVERT_FILES 4

Modified: subversion/branches/issue-3668-3669/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/branches/issue-3668-3669/subversion/libsvn_wc/wc_db.c?rev=1035404&r1=1035403&r2=1035404&view=diff
==============================================================================
--- subversion/branches/issue-3668-3669/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/branches/issue-3668-3669/subversion/libsvn_wc/wc_db.c Mon Nov 15 18:50:38 2010
@@ -55,11 +55,6 @@
 #define NOT_IMPLEMENTED() SVN__NOT_IMPLEMENTED()
 
 
-#if SVN_WC__VERSION >= 21
-  #define TREE_CONFLICTS_ON_CHILDREN
-#endif
-
-
 /*
  * Some filename constants.
  */
@@ -1875,12 +1870,8 @@ db_base_remove(void *baton, svn_sqlite__
   SVN_ERR(svn_sqlite__reset(stmt));
   if (!have_row)
     {
-#ifndef TREE_CONFLICTS_ON_CHILDREN
-      SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, STMT_DELETE_ACTUAL_NODE));
-#else
       SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
                                     STMT_DELETE_ACTUAL_NODE_WITHOUT_CONFLICT));
-#endif
       SVN_ERR(svn_sqlite__bindf(stmt, "is", brb->wc_id, brb->local_relpath));
       SVN_ERR(svn_sqlite__step_done(stmt));
     }
@@ -3213,6 +3204,40 @@ op_depth_of(apr_int64_t *op_depth,
   return SVN_NO_ERROR;
 }
 
+/* If there are any absent (excluded by authz) base nodes then the
+   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,
+                     const char *local_relpath,
+                     apr_pool_t *scratch_pool)
+{
+  svn_sqlite__stmt_t *stmt;
+  svn_boolean_t have_row;
+  const char *absent_relpath;
+
+  SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
+                                    STMT_SELECT_ABSENT_NODES));
+  SVN_ERR(svn_sqlite__bindf(stmt, "iss",
+                            pdh->wcroot->wc_id,
+                            local_relpath,
+                            construct_like_arg(local_relpath,
+                                               scratch_pool)));
+  SVN_ERR(svn_sqlite__step(&have_row, stmt));
+  if (have_row)
+    absent_relpath = svn_sqlite__column_text(stmt, 0, scratch_pool);
+  SVN_ERR(svn_sqlite__reset(stmt));
+  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,
+                                                    scratch_pool));
+
+  return SVN_NO_ERROR;
+}
+
+
 /*
  * Copy single NODES row from src_path@src_op_depth to dst_path@dst_depth.
  * Copy all rows of descendent paths in == src_op_depth to == dst_depth.
@@ -3236,30 +3261,8 @@ copy_nodes_rows(svn_wc__db_pdh_t *src_pd
 
   SVN_ERR(op_depth_of(&src_op_depth, src_pdh, src_relpath));
 
-  /* If there are any absent (excluded by authz) base nodes then the
-     copy must fail.  It's not possible to commit such a copy. */
   if (src_op_depth == 0)
-    {
-      svn_boolean_t have_row;
-      const char *local_relpath;
-
-      SVN_ERR(svn_sqlite__get_statement(&stmt, src_pdh->wcroot->sdb,
-                                        STMT_SELECT_ABSENT_NODES));
-      SVN_ERR(svn_sqlite__bindf(stmt, "iss",
-                                src_pdh->wcroot->wc_id,
-                                src_relpath,
-                                construct_like_arg(src_relpath, scratch_pool)));
-      SVN_ERR(svn_sqlite__step(&have_row, stmt));
-      if (have_row)
-        local_relpath = svn_sqlite__column_text(stmt, 0, scratch_pool);
-      SVN_ERR(svn_sqlite__reset(stmt));
-      if (have_row)
-        return svn_error_createf(SVN_ERR_AUTHZ_UNREADABLE, NULL,
-                                 _("Cannot copy '%s' excluded by server"),
-                                 path_for_error_message(src_pdh->wcroot,
-                                                        local_relpath,
-                                                        scratch_pool));
-    }
+    SVN_ERR(catch_copy_of_absent(src_pdh, src_relpath, scratch_pool));
 
   /* Root node */
   SVN_ERR(svn_sqlite__get_statement(&stmt, src_pdh->wcroot->sdb,
@@ -4117,74 +4120,6 @@ struct set_tc_baton
 };
 
 
-#ifndef TREE_CONFLICTS_ON_CHILDREN
-/* */
-static svn_error_t *
-set_tc_txn(void *baton, svn_sqlite__db_t *sdb, apr_pool_t *scratch_pool)
-{
-  struct set_tc_baton *stb = baton;
-  svn_sqlite__stmt_t *stmt;
-  svn_boolean_t have_row;
-  const char *tree_conflict_data;
-  apr_hash_t *conflicts;
-
-  /* Get the conflict information for the parent of LOCAL_ABSPATH. */
-  SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, STMT_SELECT_ACTUAL_NODE));
-  SVN_ERR(svn_sqlite__bindf(stmt, "is", stb->wc_id, stb->parent_relpath));
-  SVN_ERR(svn_sqlite__step(&have_row, stmt));
-
-  /* No ACTUAL node, no conflict info, no problem. */
-  if (!have_row)
-    tree_conflict_data = NULL;
-  else
-    tree_conflict_data = svn_sqlite__column_text(stmt, 5, scratch_pool);
-
-  SVN_ERR(svn_sqlite__reset(stmt));
-
-  /* Parse the conflict data, set the desired conflict, and then rewrite
-     the conflict data. */
-  SVN_ERR(svn_wc__read_tree_conflicts(&conflicts, tree_conflict_data,
-                                      stb->parent_abspath, scratch_pool));
-
-  apr_hash_set(conflicts, svn_dirent_basename(stb->local_abspath, NULL),
-               APR_HASH_KEY_STRING, stb->tree_conflict);
-
-  if (apr_hash_count(conflicts) == 0 && !have_row)
-    {
-      /* We're removing conflict information that doesn't even exist, so
-         don't bother rewriting it, just exit. */
-      return SVN_NO_ERROR;
-    }
-
-  SVN_ERR(svn_wc__write_tree_conflicts(&tree_conflict_data, conflicts,
-                                       scratch_pool));
-
-  if (have_row)
-    {
-      /* There is an existing ACTUAL row, so just update it. */
-      SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
-                                        STMT_UPDATE_ACTUAL_TREE_CONFLICTS));
-    }
-  else
-    {
-      /* We need to insert an ACTUAL row with the tree conflict data. */
-      SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
-                                        STMT_INSERT_ACTUAL_TREE_CONFLICTS));
-    }
-
-  SVN_ERR(svn_sqlite__bindf(stmt, "iss", stb->wc_id, stb->parent_relpath,
-                            tree_conflict_data));
-
-  if (!have_row && stb->parent_relpath[0])
-    SVN_ERR(svn_sqlite__bind_text(stmt, 4,
-                                  svn_dirent_dirname(stb->parent_relpath,
-                                                     scratch_pool)));
-
-  return svn_error_return(svn_sqlite__step_done(stmt));
-}
-
-#else
-
 /* */
 static svn_error_t *
 set_tc_txn2(void *baton, svn_sqlite__db_t *sdb, apr_pool_t *scratch_pool)
@@ -4242,7 +4177,6 @@ set_tc_txn2(void *baton, svn_sqlite__db_
 
   return SVN_NO_ERROR;
 }
-#endif
 
 svn_error_t *
 svn_wc__db_op_set_tree_conflict(svn_wc__db_t *db,
@@ -4258,25 +4192,6 @@ svn_wc__db_op_set_tree_conflict(svn_wc__
   stb.parent_abspath = svn_dirent_dirname(local_abspath, scratch_pool);
   stb.tree_conflict = tree_conflict;
 
-#ifndef TREE_CONFLICTS_ON_CHILDREN
-  SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &stb.parent_relpath, db,
-                              stb.parent_abspath, svn_sqlite__mode_readwrite,
-                              scratch_pool, scratch_pool));
-  VERIFY_USABLE_PDH(pdh);
-
-  stb.wc_id = pdh->wcroot->wc_id;
-
-  SVN_ERR(svn_sqlite__with_transaction(pdh->wcroot->sdb, set_tc_txn, &stb,
-                                       scratch_pool));
-#else
-
-
-  /* ### The above is for tree-conflicts storage in parents;
-     ### the following is for tree-conflicts in ACTUAL.conflict_data.
-     ###
-     ### They are obviously redundant, with the latter being the eventual
-     ### implementation. */
-
   SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &stb.local_relpath, db,
                               local_abspath, svn_sqlite__mode_readwrite,
                               scratch_pool, scratch_pool));
@@ -4294,7 +4209,6 @@ svn_wc__db_op_set_tree_conflict(svn_wc__
      ### 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,
                                        scratch_pool));
-#endif
 
   /* There may be some entries, and the lock info is now out of date.  */
   SVN_ERR(flush_entries(db, pdh, local_abspath, scratch_pool));
@@ -4367,40 +4281,6 @@ read_all_tree_conflicts(apr_hash_t **tre
 {
   svn_sqlite__stmt_t *stmt;
   svn_boolean_t have_row;
-#ifndef TREE_CONFLICTS_ON_CHILDREN
-  const char *tree_conflict_data;
-  const char *local_abspath;
-
-  /* Get the conflict information for the parent of LOCAL_ABSPATH. */
-  SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
-                                    STMT_SELECT_ACTUAL_NODE));
-  SVN_ERR(svn_sqlite__bindf(stmt, "is", pdh->wcroot->wc_id, local_relpath));
-  SVN_ERR(svn_sqlite__step(&have_row, stmt));
-
-  /* No ACTUAL node, no conflict info, no problem. */
-  if (!have_row)
-    {
-      *tree_conflicts = NULL;
-      SVN_ERR(svn_sqlite__reset(stmt));
-      return SVN_NO_ERROR;
-    }
-
-  tree_conflict_data = svn_sqlite__column_text(stmt, 5, scratch_pool);
-  SVN_ERR(svn_sqlite__reset(stmt));
-
-  /* No tree conflict data?  no problem. */
-  if (tree_conflict_data == NULL)
-    {
-      *tree_conflicts = NULL;
-      return SVN_NO_ERROR;
-    }
-
-  local_abspath = svn_dirent_join(pdh->wcroot->abspath, local_relpath,
-                                  scratch_pool);
-  SVN_ERR(svn_wc__read_tree_conflicts(tree_conflicts, tree_conflict_data,
-                                      local_abspath, result_pool));
-
-#else
   apr_pool_t *iterpool = svn_pool_create(scratch_pool);
 
   *tree_conflicts = apr_hash_make(result_pool);
@@ -4436,7 +4316,6 @@ read_all_tree_conflicts(apr_hash_t **tre
     }
 
   svn_pool_destroy(iterpool);
-#endif
 
   return SVN_NO_ERROR;
 }
@@ -4473,26 +4352,33 @@ read_tree_conflict(const svn_wc_conflict
                    apr_pool_t *result_pool,
                    apr_pool_t *scratch_pool)
 {
-  if (local_relpath[0])
-    {
-      const char *parent_relpath;
-      apr_hash_t *tree_conflicts;
+  svn_sqlite__stmt_t *stmt;
+  svn_boolean_t have_row;
+  const char *conflict_data;
+  const svn_skel_t *skel;
+  svn_error_t *err;
 
-      parent_relpath = svn_dirent_dirname(local_relpath, scratch_pool);
+  *tree_conflict = NULL;
 
-      SVN_ERR(read_all_tree_conflicts(&tree_conflicts, pdh, parent_relpath,
-                                      result_pool, scratch_pool));
-      if (tree_conflicts)
-        *tree_conflict = apr_hash_get(tree_conflicts,
-                                      svn_dirent_basename(local_relpath, NULL),
-                                      APR_HASH_KEY_STRING);
-      else
-        *tree_conflict = NULL;
-    }
-  else
-    *tree_conflict = NULL;
+  if (!local_relpath[0])
+    return SVN_NO_ERROR;
 
-  return SVN_NO_ERROR;
+  SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
+                                    STMT_SELECT_ACTUAL_TREE_CONFLICT));
+  SVN_ERR(svn_sqlite__bindf(stmt, "is", pdh->wcroot->wc_id, local_relpath));
+  SVN_ERR(svn_sqlite__step(&have_row, stmt));
+
+  if (!have_row)
+    return SVN_NO_ERROR;
+
+  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,
+                                     scratch_pool);
+
+  return svn_error_compose_create(err,
+                                  svn_sqlite__reset(stmt));
 }
 
 svn_error_t *
@@ -4545,12 +4431,8 @@ svn_wc__db_temp_op_remove_entry(svn_wc__
   SVN_ERR(svn_sqlite__bindf(stmt, "is", wc_id, local_relpath));
   SVN_ERR(svn_sqlite__step_done(stmt));
 
-#ifndef TREE_CONFLICTS_ON_CHILDREN
-  SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, STMT_DELETE_ACTUAL_NODE));
-#else
   SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
                                     STMT_DELETE_ACTUAL_NODE_WITHOUT_CONFLICT));
-#endif
   SVN_ERR(svn_sqlite__bindf(stmt, "is", wc_id, local_relpath));
 
   SVN_ERR(svn_sqlite__step_done(stmt));
@@ -4743,10 +4625,6 @@ db_working_actual_remove(svn_wc__db_pdh_
   SVN_ERR(svn_sqlite__bindf(stmt, "is", pdh->wcroot->wc_id, local_relpath));
   SVN_ERR(svn_sqlite__step_done(stmt));
 
-#ifndef TREE_CONFLICTS_ON_CHILDREN
-  SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
-                                    STMT_DELETE_ACTUAL_NODE));
-#else
   SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
                                     STMT_CLEAR_ACTUAL_NODE_LEAVING_CONFLICT));
   SVN_ERR(svn_sqlite__bindf(stmt, "is", pdh->wcroot->wc_id, local_relpath));
@@ -4754,7 +4632,6 @@ db_working_actual_remove(svn_wc__db_pdh_
 
   SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
                                     STMT_DELETE_ACTUAL_NODE_WITHOUT_CONFLICT));
-#endif
   SVN_ERR(svn_sqlite__bindf(stmt, "is", pdh->wcroot->wc_id, local_relpath));
   SVN_ERR(svn_sqlite__step_done(stmt));
 
@@ -5341,12 +5218,8 @@ read_info(svn_wc__db_status_t *status,
                  !svn_sqlite__column_is_null(stmt_act, 2) || /* old */
                  !svn_sqlite__column_is_null(stmt_act, 3) || /* new */
                  !svn_sqlite__column_is_null(stmt_act, 4) || /* working */
-                 !svn_sqlite__column_is_null(stmt_act, 0); /* prop_reject */
-
-#ifdef TREE_CONFLICTS_ON_CHILDREN
-              *conflicted = *conflicted ||
-                !svn_sqlite__column_is_null(stmt_act, 7); /* conflict_data */
-#endif
+                 !svn_sqlite__column_is_null(stmt_act, 0) || /* prop_reject */
+                 !svn_sqlite__column_is_null(stmt_act, 7); /* conflict_data */
 
               /* At the end of this function we check for tree conflicts */
             }
@@ -5383,17 +5256,14 @@ read_info(svn_wc__db_status_t *status,
     }
   else if (have_act)
     {
-#ifdef TREE_CONFLICTS_ON_CHILDREN
       /* A row in ACTUAL_NODE should never exist without a corresponding
          node in BASE_NODE and/or WORKING_NODE unless it flags a conflict. */
       if (svn_sqlite__column_is_null(stmt_act, 7)) /* conflict_data */
-#endif
           err = svn_error_createf(SVN_ERR_WC_CORRUPT, NULL,
                                   _("Corrupt data for '%s'"),
                                   path_for_error_message(pdh->wcroot,
                                                          local_relpath,
                                                          scratch_pool));
-#ifdef TREE_CONFLICTS_ON_CHILDREN
       /* ### What should we return?  Should we have a separate
              function for reading actual-only nodes? */
 
@@ -5448,7 +5318,6 @@ read_info(svn_wc__db_status_t *status,
         *conflicted = TRUE;
       if (lock)
         *lock = NULL;
-#endif
     }
   else
     {
@@ -5464,21 +5333,6 @@ read_info(svn_wc__db_status_t *status,
 
   SVN_ERR(svn_error_compose_create(err, svn_sqlite__reset(stmt_info)));
 
-#ifndef TREE_CONFLICTS_ON_CHILDREN
-  /* ### And finally, check for tree conflicts via parent.
-         This reuses stmt_act and throws an error in Sqlite if
-         we do it directly */
-  if (conflicted && !*conflicted)
-    {
-      const svn_wc_conflict_description2_t *cd;
-
-      SVN_ERR(read_tree_conflict(&cd, pdh, local_relpath,
-                                 scratch_pool, scratch_pool));
-
-      *conflicted = (cd != NULL);
-    }
-#endif
-
   return SVN_NO_ERROR;
 }
 
@@ -5547,9 +5401,6 @@ svn_wc__db_read_children_info(apr_hash_t
   svn_boolean_t have_row;
   const char *repos_root_url = NULL;
   apr_int64_t last_repos_id;
-#ifndef TREE_CONFLICTS_ON_CHILDREN
-  apr_hash_t *tree_conflicts;
-#endif
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(dir_abspath));
   *conflicts = apr_hash_make(result_pool);
@@ -5734,16 +5585,12 @@ svn_wc__db_read_children_info(apr_hash_t
       child->conflicted = !svn_sqlite__column_is_null(stmt, 2) ||  /* old */
                           !svn_sqlite__column_is_null(stmt, 3) ||  /* new */
                           !svn_sqlite__column_is_null(stmt, 4) ||  /* work */
-                          !svn_sqlite__column_is_null(stmt, 0);    /* prop */
-
-#ifdef TREE_CONFLICTS_ON_CHILDREN
-      child->conflicted = child->conflicted ||
-                            !svn_sqlite__column_is_null(stmt, 8);  /* tree */
+                          !svn_sqlite__column_is_null(stmt, 0) ||  /* prop */
+                          !svn_sqlite__column_is_null(stmt, 8);  /* tree */
 
       if (child->conflicted)
         apr_hash_set(*conflicts, apr_pstrdup(result_pool, name),
                      APR_HASH_KEY_STRING, "");
-#endif
 
       err = svn_sqlite__step(&have_row, stmt);
       if (err)
@@ -5752,30 +5599,6 @@ svn_wc__db_read_children_info(apr_hash_t
 
   SVN_ERR(svn_sqlite__reset(stmt));
 
-#ifndef TREE_CONFLICTS_ON_CHILDREN
-  SVN_ERR(read_all_tree_conflicts(&tree_conflicts, pdh, dir_relpath,
-                                  scratch_pool, scratch_pool));
-  if (tree_conflicts)
-    {
-      apr_hash_index_t *hi;
-
-      for (hi = apr_hash_first(scratch_pool, tree_conflicts);
-           hi;
-           hi = apr_hash_next(hi))
-        {
-          const char *name = svn__apr_hash_index_key(hi);
-          struct svn_wc__db_info_t *child
-            = apr_hash_get(*nodes, name, APR_HASH_KEY_STRING);
-
-          if (child)
-            child->conflicted = TRUE;
-
-          apr_hash_set(*conflicts, apr_pstrdup(result_pool, name),
-                       APR_HASH_KEY_STRING, "");
-        }
-    }
-#endif
-
   return SVN_NO_ERROR;
 }
 
@@ -6036,17 +5859,19 @@ svn_wc__db_global_relocate(svn_wc__db_t 
                            apr_pool_t *scratch_pool)
 {
   svn_wc__db_pdh_t *pdh;
+  const char *local_dir_relpath;
   svn_wc__db_status_t status;
   struct relocate_baton rb;
-  const char *old_repos_root_url, *stored_local_dir_abspath;
+  const char *old_repos_root_url, *stored_local_dir_relpath;
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_dir_abspath));
   /* ### assert that we were passed a directory?  */
 
-  SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &rb.local_relpath, db,
+  SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &local_dir_relpath, db,
                               local_dir_abspath, svn_sqlite__mode_readonly,
                               scratch_pool, scratch_pool));
   VERIFY_USABLE_PDH(pdh);
+  rb.local_relpath = local_dir_relpath;
 
   SVN_ERR(read_info(&status,
                     NULL, NULL,
@@ -6063,22 +5888,22 @@ svn_wc__db_global_relocate(svn_wc__db_t 
     {
       /* The parent cannot be excluded, so look at the parent and then
          adjust the relpath */
-      const char *parent_abspath = svn_dirent_dirname(local_dir_abspath,
-                                                      scratch_pool);
-      SVN_ERR(svn_wc__db_read_info(&status,
-                                   NULL, NULL,
-                                   &rb.repos_relpath, &old_repos_root_url,
-                                   &rb.repos_uuid,
-                                   NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-                                   NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-                                   NULL, NULL, NULL, NULL,
-                                   db, parent_abspath,
-                                   scratch_pool, scratch_pool));
-      stored_local_dir_abspath = local_dir_abspath;
-      local_dir_abspath = parent_abspath;
+      const char *parent_relpath = svn_relpath_dirname(local_dir_relpath,
+                                                       scratch_pool);
+      SVN_ERR(read_info(&status,
+                        NULL, NULL,
+                        &rb.repos_relpath, &old_repos_root_url,
+                        &rb.repos_uuid,
+                        NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+                        NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+                        NULL, NULL, NULL, NULL,
+                        pdh, parent_relpath,
+                        scratch_pool, scratch_pool));
+      stored_local_dir_relpath = rb.local_relpath;
+      local_dir_relpath = parent_relpath;
     }
   else
-    stored_local_dir_abspath = NULL;
+    stored_local_dir_relpath = NULL;
 
   if (!rb.repos_relpath || !old_repos_root_url || !rb.repos_uuid)
     {
@@ -6089,57 +5914,57 @@ svn_wc__db_global_relocate(svn_wc__db_t 
 
       if (status == svn_wc__db_status_deleted)
         {
-          const char *work_del_abspath;
-          SVN_ERR(svn_wc__db_scan_deletion(NULL, NULL, NULL,
-                                           &work_del_abspath,
-                                           db, local_dir_abspath,
-                                           scratch_pool, scratch_pool));
-          if (work_del_abspath)
+          const char *work_del_relpath;
+          SVN_ERR(scan_deletion(NULL, NULL, NULL, &work_del_relpath,
+                                pdh, local_dir_relpath,
+                                scratch_pool, scratch_pool));
+          if (work_del_relpath)
             {
               /* Deleted within a copy/move */
-              SVN_ERR_ASSERT(!stored_local_dir_abspath);
-              stored_local_dir_abspath = local_dir_abspath;
+              SVN_ERR_ASSERT(!stored_local_dir_relpath);
+              stored_local_dir_relpath = rb.local_relpath;
 
               /* The parent of the delete is added. */
               status = svn_wc__db_status_added;
-              local_dir_abspath = svn_dirent_dirname(work_del_abspath,
-                                                     scratch_pool);
+              local_dir_relpath = svn_relpath_dirname(work_del_relpath,
+                                                      scratch_pool);
             }
         }
 
       if (status == svn_wc__db_status_added)
         {
-          SVN_ERR(svn_wc__db_scan_addition(NULL, NULL,
-                                           &rb.repos_relpath,
-                                           &old_repos_root_url, &rb.repos_uuid,
-                                           NULL, NULL, NULL, NULL,
-                                           db, local_dir_abspath,
-                                           scratch_pool, scratch_pool));
+          SVN_ERR(scan_addition(NULL, NULL,
+                                &rb.repos_relpath, &rb.old_repos_id,
+                                NULL, NULL, NULL,
+                                pdh, local_dir_relpath,
+                                scratch_pool, scratch_pool));
         }
       else
-        SVN_ERR(svn_wc__db_scan_base_repos(&rb.repos_relpath,
-                                           &old_repos_root_url, &rb.repos_uuid,
-                                           db, local_dir_abspath,
-                                           scratch_pool, scratch_pool));
+        SVN_ERR(scan_upwards_for_repos(&rb.old_repos_id, &rb.repos_relpath,
+                                       pdh->wcroot, local_dir_relpath,
+                                       scratch_pool, scratch_pool));
+
+      SVN_ERR(fetch_repos_info(&old_repos_root_url, &rb.repos_uuid,
+                               pdh->wcroot->sdb, rb.old_repos_id,
+                               scratch_pool));
+    }
+  else
+    {
+      SVN_ERR(fetch_repos_id(&rb.old_repos_id, old_repos_root_url, rb.repos_uuid,
+                             pdh->wcroot->sdb, scratch_pool));
     }
 
   SVN_ERR_ASSERT(rb.repos_relpath && old_repos_root_url && rb.repos_uuid);
 
-  if (stored_local_dir_abspath)
+  if (stored_local_dir_relpath)
     {
-      /* Adjust to get value suitable for local_dir_abspath */
-      const char *part = svn_dirent_is_child(local_dir_abspath,
-                                             stored_local_dir_abspath,
-                                             scratch_pool);
+      const char *part = svn_relpath_is_child(local_dir_relpath,
+                                              stored_local_dir_relpath,
+                                              scratch_pool);
       rb.repos_relpath = svn_relpath_join(rb.repos_relpath, part,
                                           scratch_pool);
-      local_dir_abspath = stored_local_dir_abspath;
     }
 
-
-  SVN_ERR(fetch_repos_id(&rb.old_repos_id, old_repos_root_url, rb.repos_uuid,
-                         pdh->wcroot->sdb, scratch_pool));
-
   rb.wc_id = pdh->wcroot->wc_id;
   rb.repos_root_url = repos_root_url;
 
@@ -6791,10 +6616,12 @@ scan_addition(svn_wc__db_status_t *statu
               apr_pool_t *scratch_pool)
 {
   const char *current_relpath = local_relpath;
-  const char *child_relpath = NULL;
   const char *build_relpath = "";
   svn_wc__db_wcroot_t *wcroot = pdh->wcroot;
+#ifndef SVN_WC__OP_DEPTH
   svn_boolean_t found_info = FALSE;
+  const char *child_relpath = NULL;
+#endif
 
   /* Initialize most of the OUT parameters. Generally, we'll only be filling
      in a subset of these, so it is easier to init all up front. Note that
@@ -8059,11 +7886,7 @@ svn_wc__db_read_conflict_victims(const a
   const char *local_relpath;
   svn_sqlite__stmt_t *stmt;
   svn_boolean_t have_row;
-  apr_hash_t *found;
-  apr_array_header_t *found_keys;
-  apr_hash_t *conflict_items;
-
-  *victims = NULL;
+  apr_array_header_t *new_victims;
 
   /* The parent should be a working copy directory. */
   SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &local_relpath, db,
@@ -8074,49 +7897,27 @@ svn_wc__db_read_conflict_victims(const a
   /* ### This will be much easier once we have all conflicts in one
          field of actual*/
 
-  /* First look for text and property conflicts in ACTUAL */
+  /* Look for text, tree and property conflicts in ACTUAL */
   SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
                                     STMT_SELECT_ACTUAL_CONFLICT_VICTIMS));
   SVN_ERR(svn_sqlite__bindf(stmt, "is", pdh->wcroot->wc_id, local_relpath));
 
-  found = apr_hash_make(result_pool);
+  new_victims = apr_array_make(result_pool, 0, sizeof(const char *));
 
   SVN_ERR(svn_sqlite__step(&have_row, stmt));
   while (have_row)
     {
       const char *child_relpath = svn_sqlite__column_text(stmt, 0, NULL);
-      const char *child_name = svn_dirent_basename(child_relpath, result_pool);
 
-      apr_hash_set(found, child_name, APR_HASH_KEY_STRING, child_name);
+      APR_ARRAY_PUSH(new_victims, const char *) =
+                            svn_dirent_basename(child_relpath, result_pool);
 
       SVN_ERR(svn_sqlite__step(&have_row, stmt));
     }
 
   SVN_ERR(svn_sqlite__reset(stmt));
 
-  /* And add tree conflicts */
-  SVN_ERR(read_all_tree_conflicts(&conflict_items, pdh, local_relpath,
-                                  scratch_pool, scratch_pool));
-
-  if (conflict_items)
-    {
-      apr_hash_index_t *hi;
-
-      for(hi = apr_hash_first(scratch_pool, conflict_items);
-          hi;
-          hi = apr_hash_next(hi))
-        {
-          const char *child_name =
-              svn_dirent_basename(svn__apr_hash_index_key(hi), result_pool);
-
-          /* Using a hash avoids duplicates */
-          apr_hash_set(found, child_name, APR_HASH_KEY_STRING, child_name);
-        }
-    }
-
-  SVN_ERR(svn_hash_keys(&found_keys, found, result_pool));
-  *victims = found_keys;
-
+  *victims = new_victims;
   return SVN_NO_ERROR;
 }
 
@@ -8158,6 +7959,7 @@ svn_wc__db_read_conflicts(const apr_arra
       const char *conflict_old;
       const char *conflict_new;
       const char *conflict_working;
+      const char *conflict_data;
 
       /* ### Store in description! */
       prop_reject = svn_sqlite__column_text(stmt, 0, result_pool);
@@ -8193,44 +7995,24 @@ svn_wc__db_read_conflicts(const apr_arra
           APR_ARRAY_PUSH(cflcts, svn_wc_conflict_description2_t*) = desc;
         }
 
-#ifdef TREE_CONFLICTS_ON_CHILDREN
-      {
-        const char *conflict_data;
-
-        conflict_data = svn_sqlite__column_text(stmt, 4, scratch_pool);
-        if (conflict_data)
-          {
-            const svn_wc_conflict_description2_t *desc;
-            const svn_skel_t *skel;
-
-            skel = svn_skel__parse(conflict_data, strlen(conflict_data),
-                                   scratch_pool);
-            SVN_ERR(svn_wc__deserialize_conflict(&desc, skel,
-                            svn_dirent_dirname(local_abspath, scratch_pool),
-                            result_pool, scratch_pool));
+      conflict_data = svn_sqlite__column_text(stmt, 4, scratch_pool);
+      if (conflict_data)
+        {
+          const svn_wc_conflict_description2_t *desc;
+          const svn_skel_t *skel;
 
-            APR_ARRAY_PUSH(cflcts, const svn_wc_conflict_description2_t *) = desc;
-          }
-      }
-#endif
+          skel = svn_skel__parse(conflict_data, strlen(conflict_data),
+                                 scratch_pool);
+          SVN_ERR(svn_wc__deserialize_conflict(&desc, skel,
+                          svn_dirent_dirname(local_abspath, scratch_pool),
+                          result_pool, scratch_pool));
 
+          APR_ARRAY_PUSH(cflcts, const svn_wc_conflict_description2_t *) = desc;
+        }
     }
 
   SVN_ERR(svn_sqlite__reset(stmt));
 
-#ifndef TREE_CONFLICTS_ON_CHILDREN
-  /* ### Tree conflicts are still stored on the directory */
-  {
-    const svn_wc_conflict_description2_t *desc;
-
-    SVN_ERR(read_tree_conflict(&desc, pdh, local_relpath,
-                               result_pool, scratch_pool));
-
-    if (desc)
-      APR_ARRAY_PUSH(cflcts, const svn_wc_conflict_description2_t*) = desc;
-  }
-#endif
-
   *conflicts = cflcts;
 
   return SVN_NO_ERROR;
@@ -8949,12 +8731,45 @@ struct make_copy_baton
 
   svn_wc__db_pdh_t *pdh;
   const char *local_relpath;
-  svn_boolean_t remove_base;
-  svn_boolean_t is_root;
   apr_int64_t op_depth;
 };
 
-/* Transaction callback for svn_wc__db_temp_op_make_copy */
+/* Transaction callback for svn_wc__db_temp_op_make_copy.  This is
+   used by the update editor when deleting a base node tree would be a
+   tree-conflict because there are changes to subtrees.  This function
+   inserts a copy of the base node tree below any existing working
+   subtrees.  Given a tree:
+
+             0            1           2            3
+    /     normal          -
+    A     normal          -
+    A/B   normal          -         normal
+    A/B/C normal          -         normal
+    A/F   normal          -         normal
+    A/F/G normal          -         normal
+    A/F/H normal          -         base-deleted   normal
+    A/F/E normal          -         not-present
+    A/X   normal          -
+    A/X/Y incomplete      -
+
+    This function copies the tree for A from op_depth=0, into the
+    working op_depth of A, i.e. 1, then marks as base-deleted any
+    subtrees in that op_depth that are below higher op_depth, and
+    finally removes base-deleted nodes from higher op_depth.
+
+             0            1              2            3
+    /     normal          -
+    A     normal       normal
+    A/B   normal       base-deleted   normal
+    A/B/C normal       base-deleted   normal
+    A/F   normal       base-deleted   normal
+    A/F/G normal       base-deleted   normal
+    A/F/H normal       base-deleted                   normal
+    A/F/E normal       base-deleted   not-present
+    A/X   normal       normal
+    A/X/Y incomplete   incomplete
+
+ */
 static svn_error_t *
 make_copy_txn(void *baton,
               svn_sqlite__db_t *sdb,
@@ -8963,15 +8778,18 @@ make_copy_txn(void *baton,
   struct make_copy_baton *mcb = baton;
   svn_sqlite__stmt_t *stmt;
   svn_boolean_t have_row;
+#ifdef SVN_WC__OP_DEPTH
+  svn_boolean_t add_working_base_deleted = FALSE;
+#else
+  svn_boolean_t add_working = TRUE;
+#endif
   svn_boolean_t remove_working = FALSE;
-  svn_boolean_t check_base = TRUE;
-  svn_boolean_t add_working_normal = FALSE;
-  svn_boolean_t add_working_not_present = FALSE;
   const apr_array_header_t *children;
   apr_pool_t *iterpool = svn_pool_create(scratch_pool);
   int i;
 
-  SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, STMT_SELECT_WORKING_NODE));
+  SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
+                                    STMT_SELECT_LOWEST_WORKING_NODE));
   SVN_ERR(svn_sqlite__bindf(stmt, "is", mcb->pdh->wcroot->wc_id,
                             mcb->local_relpath));
   SVN_ERR(svn_sqlite__step(&have_row, stmt));
@@ -8988,55 +8806,19 @@ make_copy_txn(void *baton,
                      || working_status == svn_wc__db_status_not_present
                      || working_status == svn_wc__db_status_incomplete);
 
-      /* Make existing deletions of BASE_NODEs remove WORKING_NODEs */
       if (working_status == svn_wc__db_status_base_deleted)
-        {
-          remove_working = TRUE;
-          add_working_not_present = TRUE;
-        }
+        /* Make existing deletions of BASE_NODEs remove WORKING_NODEs */
+        remove_working = TRUE;
 
-      check_base = FALSE;
+#ifdef SVN_WC__OP_DEPTH
+      add_working_base_deleted = TRUE;
+#else
+      add_working = FALSE;
+#endif
     }
   else
     SVN_ERR(svn_sqlite__reset(stmt));
 
-  if (check_base)
-    {
-      svn_wc__db_status_t base_status;
-
-      SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
-                                        STMT_SELECT_BASE_NODE));
-      SVN_ERR(svn_sqlite__bindf(stmt, "is", mcb->pdh->wcroot->wc_id, 
-                                mcb->local_relpath));
-      SVN_ERR(svn_sqlite__step(&have_row, stmt));
-
-      /* If there is no BASE_NODE, we don't have to copy anything */
-      if (!have_row)
-        return svn_error_return(svn_sqlite__reset(stmt));
-
-      base_status = svn_sqlite__column_token(stmt, 2, presence_map);
-
-      SVN_ERR(svn_sqlite__reset(stmt));
-
-      switch (base_status)
-        {
-          case svn_wc__db_status_normal:
-          case svn_wc__db_status_incomplete:
-            add_working_normal = TRUE;
-            break;
-          case svn_wc__db_status_not_present:
-            add_working_not_present = TRUE;
-            break;
-          case svn_wc__db_status_excluded:
-          case svn_wc__db_status_absent:
-            /* ### Make the copy match the WC or the repository? */
-            add_working_not_present = TRUE; /* ### Match WC */
-            break;
-          default:
-            SVN_ERR_MALFUNCTION();
-        }
-    }
-
   /* Get the BASE children, as WORKING children don't need modifications */
   SVN_ERR(svn_wc__db_base_get_children(&children, mcb->db, mcb->local_abspath,
                                        scratch_pool, iterpool));
@@ -9058,8 +8840,6 @@ make_copy_txn(void *baton,
       VERIFY_USABLE_PDH(cbt.pdh);
 
       cbt.db = mcb->db;
-      cbt.remove_base = mcb->remove_base;
-      cbt.is_root = FALSE;
       cbt.op_depth = mcb->op_depth;
 
       SVN_ERR(make_copy_txn(&cbt, cbt.pdh->wcroot->sdb, iterpool));
@@ -9068,76 +8848,36 @@ make_copy_txn(void *baton,
   if (remove_working)
     {
       SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
-                                        STMT_DELETE_WORKING_NODE));
+                                        STMT_DELETE_LOWEST_WORKING_NODE));
       SVN_ERR(svn_sqlite__bindf(stmt, "is",
                                 mcb->pdh->wcroot->wc_id,
                                 mcb->local_relpath));
       SVN_ERR(svn_sqlite__step_done(stmt));
     }
 
-  if (add_working_normal)
+#ifdef SVN_WC__OP_DEPTH
+  if (add_working_base_deleted)
     {
-      /* Add a copy of the BASE_NODE to WORKING_NODE */
-      SVN_ERR(svn_sqlite__get_statement(
-                    &stmt, sdb,
-                    STMT_INSERT_WORKING_NODE_NORMAL_FROM_BASE));
-
-      SVN_ERR(svn_sqlite__bindf(stmt, "isi",
+      SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
+                             STMT_INSERT_WORKING_NODE_FROM_BASE_COPY_PRESENCE));
+      SVN_ERR(svn_sqlite__bindf(stmt, "isit",
                                 mcb->pdh->wcroot->wc_id,
                                 mcb->local_relpath,
-                                mcb->op_depth));
-
+                                mcb->op_depth,
+                                presence_map, svn_wc__db_status_base_deleted));
       SVN_ERR(svn_sqlite__step_done(stmt));
     }
-  else if (add_working_not_present)
+  else
+#else
+  if (add_working)
+#endif
     {
-      /* Add a not present WORKING_NODE */
-      SVN_ERR(svn_sqlite__get_statement(
-                &stmt, sdb,
-                STMT_INSERT_WORKING_NODE_NOT_PRESENT_FROM_BASE));
-
+      SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
+                                      STMT_INSERT_WORKING_NODE_FROM_BASE_COPY));
       SVN_ERR(svn_sqlite__bindf(stmt, "isi",
                                 mcb->pdh->wcroot->wc_id,
                                 mcb->local_relpath,
                                 mcb->op_depth));
-
-      SVN_ERR(svn_sqlite__step_done(stmt));
-    }
-
-  if (mcb->is_root && (add_working_normal || add_working_not_present))
-    {
-      const char *repos_relpath, *repos_root_url, *repos_uuid;
-      apr_int64_t repos_id;
-      /* Make sure the copy origin is set on the root even if the node
-         didn't have a local relpath */
-
-      SVN_ERR(svn_wc__db_scan_base_repos(&repos_relpath, &repos_root_url,
-                                         &repos_uuid, mcb->db,
-                                         mcb->local_abspath,
-                                         iterpool, iterpool));
-
-      SVN_ERR(fetch_repos_id(&repos_id, repos_root_url, repos_uuid, sdb,
-                             iterpool));
-
-      /* ### this is not setting the COPYFROM_REVISION column!!  */
-      /* ### The regression tests passed without this, is it necessary? */
-      SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, STMT_UPDATE_COPYFROM));
-      SVN_ERR(svn_sqlite__bindf(stmt, "isis",
-                                mcb->pdh->wcroot->wc_id,
-                                mcb->local_relpath,
-                                repos_id,
-                                repos_relpath));
-      SVN_ERR(svn_sqlite__step_done(stmt));
-    }
-
-  /* Remove the BASE_NODE if the caller asked us to do that */
-  if (mcb->remove_base)
-    {
-      SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
-                                        STMT_DELETE_BASE_NODE));
-      SVN_ERR(svn_sqlite__bindf(stmt, "is",
-                                mcb->pdh->wcroot->wc_id,
-                                mcb->local_relpath));
       SVN_ERR(svn_sqlite__step_done(stmt));
     }
 
@@ -9152,10 +8892,11 @@ make_copy_txn(void *baton,
 svn_error_t *
 svn_wc__db_temp_op_make_copy(svn_wc__db_t *db,
                              const char *local_abspath,
-                             svn_boolean_t remove_base,
                              apr_pool_t *scratch_pool)
 {
   struct make_copy_baton mcb;
+  svn_sqlite__stmt_t *stmt;
+  svn_boolean_t have_row;
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
 
@@ -9164,10 +8905,27 @@ svn_wc__db_temp_op_make_copy(svn_wc__db_
                               scratch_pool, scratch_pool));
   VERIFY_USABLE_PDH(mcb.pdh);
 
+  /* The update editor is supposed to call this function when there is
+     no working node for LOCAL_ABSPATH. */
+  SVN_ERR(svn_sqlite__get_statement(&stmt, mcb.pdh->wcroot->sdb,
+                                    STMT_SELECT_WORKING_NODE));
+  SVN_ERR(svn_sqlite__bindf(stmt, "is", mcb.pdh->wcroot->wc_id,
+                            mcb.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_PATH_UNEXPECTED_STATUS, NULL,
+                             _("Modification of '%s' already exists"),
+                             path_for_error_message(mcb.pdh->wcroot,
+                                                    mcb.local_relpath,
+                                                    scratch_pool));
+
+  /* We don't allow copies to contain absent (denied by authz) nodes;
+     the update editor is going to have to bail out. */
+  SVN_ERR(catch_copy_of_absent(mcb.pdh, mcb.local_relpath, scratch_pool));
+
   mcb.db = db;
   mcb.local_abspath = local_abspath;
-  mcb.remove_base = remove_base;
-  mcb.is_root = TRUE;
 #ifdef SVN_WC__OP_DEPTH
   mcb.op_depth = relpath_depth(mcb.local_relpath);
 #else

Modified: subversion/branches/issue-3668-3669/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/branches/issue-3668-3669/subversion/libsvn_wc/wc_db.h?rev=1035404&r1=1035403&r2=1035404&view=diff
==============================================================================
--- subversion/branches/issue-3668-3669/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/branches/issue-3668-3669/subversion/libsvn_wc/wc_db.h Mon Nov 15 18:50:38 2010
@@ -355,9 +355,6 @@ svn_wc__db_init(svn_wc__db_t *db,
 
    LOCAL_RELPATH will be allocated in RESULT_POOL. All other (temporary)
    allocations will be made in SCRATCH_POOL.
-
-   ### note: with per-dir .svn directories, these relpaths will effectively
-   ### be the basename. it gets interesting in single-db mode
 */
 svn_error_t *
 svn_wc__db_to_relpath(const char **local_relpath,
@@ -2382,15 +2379,12 @@ svn_wc__db_temp_op_start_directory_updat
                                           svn_revnum_t new_rev,
                                           apr_pool_t *scratch_pool);
 
-/* Update WORKING_NODE to make it represent a copy of the current working
-   copy. Leaving additions and copies as-is, but making a copy of all the
-   required BASE_NODE data to WORKING_NODE, to allow removing and/or
-   updating the BASE_NODE without changing the contents of the current
-   working copy */
+/* Copy the base tree at LOCAL_ABSPATH into the working tree as copy,
+   leaving any subtree additions and copies as-is.  This allows the
+   base node tree to be removed. */
 svn_error_t *
 svn_wc__db_temp_op_make_copy(svn_wc__db_t *db,
                              const char *local_abspath,
-                             svn_boolean_t remove_base,
                              apr_pool_t *scratch_pool);
 
 

Modified: subversion/branches/issue-3668-3669/subversion/libsvn_wc/workqueue.c
URL: http://svn.apache.org/viewvc/subversion/branches/issue-3668-3669/subversion/libsvn_wc/workqueue.c?rev=1035404&r1=1035403&r2=1035404&view=diff
==============================================================================
--- subversion/branches/issue-3668-3669/subversion/libsvn_wc/workqueue.c (original)
+++ subversion/branches/issue-3668-3669/subversion/libsvn_wc/workqueue.c Mon Nov 15 18:50:38 2010
@@ -2246,14 +2246,6 @@ svn_wc__wq_run(svn_wc__db_t *db,
 
       svn_pool_clear(iterpool);
 
-      /* ### right now, we expect WRI_ABSPATH to exist. this section should
-         ### disappear in single-db. also, note that db_wq_fetch() will
-         ### watch out for missing/obstructed subdirs (ie. wq is gone)  */
-      SVN_ERR(svn_wc__db_read_kind(&kind, db, wri_abspath, TRUE,
-                                   scratch_pool));
-      if (kind == svn_wc__db_kind_unknown)
-        break;
-
       SVN_ERR(svn_wc__db_wq_fetch(&id, &work_item, db, wri_abspath,
                                   iterpool, iterpool));
       if (work_item == NULL)