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 2012/05/21 15:31:27 UTC

svn commit: r1341011 - in /subversion/branches/ev2-export: ./ build/ subversion/include/private/ subversion/libsvn_client/ subversion/libsvn_fs_fs/ subversion/libsvn_subr/ subversion/libsvn_wc/ subversion/tests/cmdline/ tools/dev/benchmarks/large_dirs/

Author: hwright
Date: Mon May 21 13:31:24 2012
New Revision: 1341011

URL: http://svn.apache.org/viewvc?rev=1341011&view=rev
Log:
On the ev2-export branch:
Bring up-to-date with trunk.

Modified:
    subversion/branches/ev2-export/   (props changed)
    subversion/branches/ev2-export/build/transform_sql.py
    subversion/branches/ev2-export/subversion/include/private/svn_subr_private.h
    subversion/branches/ev2-export/subversion/include/private/svn_wc_private.h
    subversion/branches/ev2-export/subversion/libsvn_client/commit.c
    subversion/branches/ev2-export/subversion/libsvn_client/commit_util.c
    subversion/branches/ev2-export/subversion/libsvn_client/delete.c
    subversion/branches/ev2-export/subversion/libsvn_client/merge.c
    subversion/branches/ev2-export/subversion/libsvn_client/status.c
    subversion/branches/ev2-export/subversion/libsvn_fs_fs/dag.c
    subversion/branches/ev2-export/subversion/libsvn_fs_fs/fs_fs.c
    subversion/branches/ev2-export/subversion/libsvn_fs_fs/fs_fs.h
    subversion/branches/ev2-export/subversion/libsvn_fs_fs/temp_serializer.c
    subversion/branches/ev2-export/subversion/libsvn_subr/hash.c
    subversion/branches/ev2-export/subversion/libsvn_subr/internal_statements.sql
    subversion/branches/ev2-export/subversion/libsvn_subr/io.c
    subversion/branches/ev2-export/subversion/libsvn_subr/path.c
    subversion/branches/ev2-export/subversion/libsvn_subr/skel.c
    subversion/branches/ev2-export/subversion/libsvn_subr/sqlite.c
    subversion/branches/ev2-export/subversion/libsvn_subr/win32_crashrpt.c
    subversion/branches/ev2-export/subversion/libsvn_wc/adm_files.c
    subversion/branches/ev2-export/subversion/libsvn_wc/node.c
    subversion/branches/ev2-export/subversion/libsvn_wc/wc-queries.sql
    subversion/branches/ev2-export/subversion/libsvn_wc/wc_db.c
    subversion/branches/ev2-export/subversion/libsvn_wc/wc_db_wcroot.c
    subversion/branches/ev2-export/subversion/tests/cmdline/stat_tests.py
    subversion/branches/ev2-export/tools/dev/benchmarks/large_dirs/create_bigdir.sh

Propchange: subversion/branches/ev2-export/
------------------------------------------------------------------------------
  Merged /subversion/trunk:r1340499-1341009

Modified: subversion/branches/ev2-export/build/transform_sql.py
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/build/transform_sql.py?rev=1341011&r1=1341010&r2=1341011&view=diff
==============================================================================
--- subversion/branches/ev2-export/build/transform_sql.py (original)
+++ subversion/branches/ev2-export/build/transform_sql.py Mon May 21 13:31:24 2012
@@ -105,7 +105,7 @@ class Processor(object):
 
       # '/'+1 == '0'
       line = re.sub(r'IS_STRICT_DESCENDANT_OF[(]([A-Za-z_.]+), ([?][0-9]+)[)]',
-                    r"((\1) > (\2) || '/' AND (\1) < (\2) || '0') ",
+                    r"((\2) != '' AND ((\1) > (\2) || '/') AND ((\1) < (\2) || '0')) ",
                     line)
 
       if line.strip():

Modified: subversion/branches/ev2-export/subversion/include/private/svn_subr_private.h
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/include/private/svn_subr_private.h?rev=1341011&r1=1341010&r2=1341011&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/include/private/svn_subr_private.h (original)
+++ subversion/branches/ev2-export/subversion/include/private/svn_subr_private.h Mon May 21 13:31:24 2012
@@ -291,15 +291,6 @@ svn_hash__get_bool(apr_hash_t *hash,
 apr_hash_t *
 svn_hash__make(apr_pool_t *pool);
 
-/** Returns a hash table, allocated in @a pool, that is faster to modify
- * and access then the ones returned by @ref svn_hash__make. The element
- * order does not match any APR default and is platform dependent.
- *
- * @since New in 1.8.
- */
-apr_hash_t *
-svn_hash__make_fast(apr_pool_t *pool);
-
 /** @} */
 
 /** @} */

Modified: subversion/branches/ev2-export/subversion/include/private/svn_wc_private.h
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/include/private/svn_wc_private.h?rev=1341011&r1=1341010&r2=1341011&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/include/private/svn_wc_private.h (original)
+++ subversion/branches/ev2-export/subversion/include/private/svn_wc_private.h Mon May 21 13:31:24 2012
@@ -1058,7 +1058,6 @@ svn_wc__node_get_commit_status(svn_boole
                                svn_revnum_t *revision,
                                svn_revnum_t *original_revision,
                                const char **original_repos_relpath,
-                               svn_boolean_t *update_root,
                                svn_wc_context_t *wc_ctx,
                                const char *local_abspath,
                                apr_pool_t *result_pool,

Modified: subversion/branches/ev2-export/subversion/libsvn_client/commit.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_client/commit.c?rev=1341011&r1=1341010&r2=1341011&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_client/commit.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_client/commit.c Mon May 21 13:31:24 2012
@@ -1180,7 +1180,10 @@ append_externals_as_explicit_targets(apr
 {
   int rel_targets_nelts_fixed;
   int i;
-  apr_pool_t *iterpool = svn_pool_create(scratch_pool);
+  apr_pool_t *iterpool;
+
+  if (! (include_file_externals || include_dir_externals))
+    return SVN_NO_ERROR;
 
   /* Easy part of applying DEPTH to externals. */
   if (depth == svn_depth_empty)
@@ -1208,12 +1211,11 @@ append_externals_as_explicit_targets(apr
        * ### not at all. No other effect. So not doing that for now. */
      }
 
-  if (! (include_file_externals || include_dir_externals))
-    return SVN_NO_ERROR;
-
   /* Iterate *and* grow REL_TARGETS at the same time. */
   rel_targets_nelts_fixed = rel_targets->nelts;
 
+  iterpool = svn_pool_create(scratch_pool);
+
   for (i = 0; i < rel_targets_nelts_fixed; i++)
     {
       int j;

Modified: subversion/branches/ev2-export/subversion/libsvn_client/commit_util.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_client/commit_util.c?rev=1341011&r1=1341010&r2=1341011&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_client/commit_util.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_client/commit_util.c Mon May 21 13:31:24 2012
@@ -571,7 +571,6 @@ harvest_status_callback(void *status_bat
   svn_boolean_t is_deleted;
   svn_boolean_t is_replaced;
   svn_boolean_t is_op_root;
-  svn_boolean_t is_update_root;
   svn_revnum_t original_rev;
   const char *original_relpath;
   svn_boolean_t copy_mode;
@@ -711,24 +710,13 @@ harvest_status_callback(void *status_bat
                                          &is_op_root,
                                          &node_rev,
                                          &original_rev, &original_relpath,
-                                         &is_update_root,
                                          wc_ctx, local_abspath,
                                          scratch_pool, scratch_pool));
 
-  /* Handle file externals.
-   * (IS_UPDATE_ROOT is more generally defined, but at the moment this
-   * condition matches only file externals.)
-   *
-   * Don't copy files that svn:externals brought into the WC. So in copy_mode,
-   * even explicit targets are skipped.
-   *
-   * Hande file externals only when passed as explicit target. Note that
+  /* Hande file externals only when passed as explicit target. Note that
    * svn_client_commit6() passes all committable externals in as explicit
-   * targets iff they count.
-   */
-  if (is_update_root
-      && status->kind == svn_node_file
-      && (copy_mode || ! is_harvest_root))
+   * targets iff they count. */
+  if (status->file_external && !is_harvest_root)
     {
       return SVN_NO_ERROR;
     }
@@ -871,9 +859,11 @@ harvest_status_callback(void *status_bat
                               result_pool, scratch_pool));
     }
 
-    /* Fetch lock tokens for descendants of deleted nodes. */
+    /* Fetch lock tokens for descendants of deleted BASE nodes. */
   if (matches_changelists
       && (state_flags & SVN_CLIENT_COMMIT_ITEM_DELETE)
+      && !copy_mode
+      && SVN_IS_VALID_REVNUM(node_rev) /* && BASE-kind = dir */
       && baton->lock_tokens)
     {
       apr_hash_t *local_relpath_tokens;

Modified: subversion/branches/ev2-export/subversion/libsvn_client/delete.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_client/delete.c?rev=1341011&r1=1341010&r2=1341011&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_client/delete.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_client/delete.c Mon May 21 13:31:24 2012
@@ -457,16 +457,19 @@ svn_client_delete4(const apr_array_heade
       /* Delete the targets from each working copy in turn. */
       for (hi = apr_hash_first(pool, wcroots); hi; hi = apr_hash_next(hi))
         {
-          const char *wcroot_abspath = svn__apr_hash_index_key(hi);
+          const char *root_abspath;
           const apr_array_header_t *targets = svn__apr_hash_index_val(hi);
 
           svn_pool_clear(iterpool);
 
+          SVN_ERR(svn_dirent_condense_targets(&root_abspath, NULL, targets,
+                                              FALSE, iterpool, iterpool));
+
           SVN_WC__CALL_WITH_WRITE_LOCK(
             svn_client__wc_delete_many(targets, force, FALSE, keep_local,
                                        ctx->notify_func2, ctx->notify_baton2,
                                        ctx, iterpool),
-            ctx->wc_ctx, wcroot_abspath, TRUE /* lock_anchor */,
+            ctx->wc_ctx, root_abspath, TRUE /* lock_anchor */,
             iterpool);
         }
       svn_pool_destroy(iterpool);

Modified: subversion/branches/ev2-export/subversion/libsvn_client/merge.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_client/merge.c?rev=1341011&r1=1341010&r2=1341011&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_client/merge.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_client/merge.c Mon May 21 13:31:24 2012
@@ -5621,36 +5621,20 @@ struct pre_merge_status_baton_t
   apr_pool_t *pool;
 };
 
-/* A svn_client_status_func_t callback used by get_mergeinfo_paths to gather
-   all switched, absent, and missing subtrees under a merge target. */
+/* A svn_wc_status_func4_t callback used by get_mergeinfo_paths to gather
+   all switched, depth filtered and missing subtrees under a merge target.
+
+   Note that this doesn't see server and user excluded trees. */
 static svn_error_t *
 pre_merge_status_cb(void *baton,
                     const char *local_abspath,
                     const svn_wc_status3_t *status,
-                    apr_pool_t *pool)
+                    apr_pool_t *scratch_pool)
 {
   struct pre_merge_status_baton_t *pmsb = baton;
   const char *dup_abspath = NULL;
 
-  /* ### Probably needed: Calculate file external status */
-  svn_boolean_t is_file_external = FALSE;
-
-  /* ### This block can go once we bumped to the EXTERNALS store */
-  if (status->versioned
-      && status->switched
-      && status->kind == svn_node_file)
-    {
-      svn_node_kind_t external_kind;
-
-      SVN_ERR(svn_wc__read_external_info(&external_kind, NULL, NULL, NULL,
-                                         NULL,
-                                         pmsb->wc_ctx, local_abspath,
-                                         local_abspath, TRUE, pool, pool));
-
-      is_file_external = (external_kind == svn_node_file);
-    }
-
-  if (status->switched && !is_file_external)
+  if (status->switched && !status->file_external)
     {
       if (!dup_abspath)
         dup_abspath = apr_pstrdup(pmsb->pool, local_abspath);
@@ -5684,7 +5668,7 @@ pre_merge_status_cb(void *baton,
       if (!dup_abspath)
         dup_abspath = apr_pstrdup(pmsb->pool, local_abspath);
 
-      for (hi = apr_hash_first(pool, pmsb->missing_subtrees);
+      for (hi = apr_hash_first(scratch_pool, pmsb->missing_subtrees);
            hi;
            hi = apr_hash_next(hi))
         {
@@ -5891,11 +5875,13 @@ get_mergeinfo_paths(apr_array_header_t *
   pre_merge_status_baton.pool = scratch_pool;
   SVN_ERR(svn_wc_walk_status(ctx->wc_ctx,
                              target->abspath,
-                             depth, TRUE, TRUE, TRUE, NULL,
-                             pre_merge_status_cb,
-                             &pre_merge_status_baton,
-                             ctx->cancel_func,
-                             ctx->cancel_baton,
+                             depth,
+                             TRUE /* get_all */,
+                             FALSE /* no_ignore */,
+                             TRUE /* ignore_text_mods */,
+                             NULL /* ingore_patterns */,
+                             pre_merge_status_cb, &pre_merge_status_baton,
+                             ctx->cancel_func, ctx->cancel_baton,
                              scratch_pool));
 
   /* Issue #2915: Raise an error describing the roots of any missing

Modified: subversion/branches/ev2-export/subversion/libsvn_client/status.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_client/status.c?rev=1341011&r1=1341010&r2=1341011&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_client/status.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_client/status.c Mon May 21 13:31:24 2012
@@ -636,7 +636,6 @@ svn_client__create_status(svn_client_sta
   if (status->file_external)
     {
       (*cst)->switched = FALSE;
-      (*cst)->node_status = (*cst)->text_status;
     }
 
   (*cst)->lock = status->lock;

Modified: subversion/branches/ev2-export/subversion/libsvn_fs_fs/dag.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_fs_fs/dag.c?rev=1341011&r1=1341010&r2=1341011&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_fs_fs/dag.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_fs_fs/dag.c Mon May 21 13:31:24 2012
@@ -778,11 +778,9 @@ svn_fs_fs__dag_delete(dag_node_t *parent
 
   subpool = svn_pool_create(pool);
 
-  /* Get a dirent hash for this directory. */
-  SVN_ERR(svn_fs_fs__rep_contents_dir(&entries, fs, parent_noderev, subpool));
-
-  /* Find name in the ENTRIES hash. */
-  dirent = apr_hash_get(entries, name, APR_HASH_KEY_STRING);
+  /* Search this directory for a dirent with that NAME. */
+  SVN_ERR(svn_fs_fs__rep_contents_dir_entry(&dirent, fs, parent_noderev,
+                                            name, subpool, subpool));
 
   /* If we never found ID in ENTRIES (perhaps because there are no
      ENTRIES, perhaps because ID just isn't in the existing ENTRIES

Modified: subversion/branches/ev2-export/subversion/libsvn_fs_fs/fs_fs.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_fs_fs/fs_fs.c?rev=1341011&r1=1341010&r2=1341011&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_fs_fs/fs_fs.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_fs_fs/fs_fs.c Mon May 21 13:31:24 2012
@@ -4851,20 +4851,30 @@ fetch_all_changes(apr_hash_t *changed_pa
         {
           apr_hash_index_t *hi;
 
+          /* a potential child path must contain at least 2 more chars
+             (the path separator plus at least one char for the name)
+          */
+          apr_ssize_t min_child_len = strlen(change->path) + 2;
+
+          /* CAUTION: This is the inner loop of an O(n^2) algorithm.
+             The number of changes to process may be >> 1000.
+             Therefore, keep the inner loop as tight as possible.
+          */
           for (hi = apr_hash_first(iterpool, changed_paths);
                hi;
                hi = apr_hash_next(hi))
             {
               /* KEY is the path. */
-              const char *path = svn__apr_hash_index_key(hi);
-              apr_ssize_t klen = svn__apr_hash_index_klen(hi);
-
-              /* If we come across our own path, ignore it. */
-              if (strcmp(change->path, path) == 0)
-                continue;
-
-              /* If we come across a child of our path, remove it. */
-              if (svn_dirent_is_child(change->path, path, iterpool))
+              const void *path;
+              apr_ssize_t klen;
+              apr_hash_this(hi, &path, &klen, NULL);
+
+              /* If we come across a child of our path, remove it.
+                 Call svn_dirent_is_child only if there is a chance that
+                 this is actually a sub-path.
+               */
+              if (   klen >= min_child_len
+                  && svn_dirent_is_child(change->path, path, iterpool))
                 apr_hash_set(changed_paths, path, klen, NULL);
             }
         }

Modified: subversion/branches/ev2-export/subversion/libsvn_fs_fs/fs_fs.h
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_fs_fs/fs_fs.h?rev=1341011&r1=1341010&r2=1341011&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_fs_fs/fs_fs.h (original)
+++ subversion/branches/ev2-export/subversion/libsvn_fs_fs/fs_fs.h Mon May 21 13:31:24 2012
@@ -131,8 +131,9 @@ svn_error_t *svn_fs_fs__rep_contents_dir
                                          apr_pool_t *pool);
 
 /* Set *DIRENT to the entry identified by NAME in the directory given
-   by NODEREV in filesystem FS.  The returned object is allocated in
-   RESULT_POOL; SCRATCH_POOL used for temporary allocations. */
+   by NODEREV in filesystem FS.  If no such entry exits, *DIRENT will
+   be NULL. The returned object is allocated in RESULT_POOL; SCRATCH_POOL
+   used for temporary allocations. */
 svn_error_t *
 svn_fs_fs__rep_contents_dir_entry(svn_fs_dirent_t **dirent,
                                   svn_fs_t *fs,

Modified: subversion/branches/ev2-export/subversion/libsvn_fs_fs/temp_serializer.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_fs_fs/temp_serializer.c?rev=1341011&r1=1341010&r2=1341011&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_fs_fs/temp_serializer.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_fs_fs/temp_serializer.c Mon May 21 13:31:24 2012
@@ -932,7 +932,7 @@ svn_fs_fs__extract_dir_entry(void **out,
           svn_temp_deserializer__ptr(entries, (const void *const *)&entries[pos]);
 
       /* Entries have been serialized one-by-one, each time including all
-       * nestes structures and strings. Therefore, they occupy a single
+       * nested structures and strings. Therefore, they occupy a single
        * block of memory whose end-offset is either the beginning of the
        * next entry or the end of the buffer
        */

Modified: subversion/branches/ev2-export/subversion/libsvn_subr/hash.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_subr/hash.c?rev=1341011&r1=1341010&r2=1341011&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_subr/hash.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_subr/hash.c Mon May 21 13:31:24 2012
@@ -563,12 +563,22 @@ svn_hash__get_bool(apr_hash_t *hash, con
 
 
 
-/*** Optimized hash functions ***/
+/*** Optimized hash function ***/
 
 /* Optimized version of apr_hashfunc_default. It assumes that the CPU has
  * 32-bit multiplications with high throughput of at least 1 operation
  * every 3 cycles. Latency is not an issue. Another optimization is a
- * mildly unrolled main loop.
+ * mildly unrolled main loop and breaking the dependency chain within the
+ * loop.
+ *
+ * Note that most CPUs including Intel Atom, VIA Nano, ARM feature the
+ * assumed pipelined multiplication circuitry. They can do one MUL every
+ * or every other cycle.
+ *
+ * The performance is ultimately limited by the fact that most CPUs can
+ * do only one LOAD and only one BRANCH operation per cycle. The best we
+ * can do is to process one character per cycle - provided the processor
+ * is wide enough to do 1 LOAD, COMPARE, BRANCH, MUL and ADD per cycle.
  */
 static unsigned int
 hashfunc_compatible(const char *char_key, apr_ssize_t *klen)
@@ -614,77 +624,8 @@ hashfunc_compatible(const char *char_key
     return hash;
 }
 
-/* Used to detect NUL chars 
- */
-#define LOWER_7BITS_SET 0x7f7f7f7f
-#define BIT_7_SET       0x80808080
-
-/* Read 4 bytes at P. LE / BE interpretation is platform-dependent
- */
-#if SVN_UNALIGNED_ACCESS_IS_OK
-#  define READ_CHUNK(p) *(const apr_uint32_t *)(p)
-#else
-#  define READ_CHUNK(p) \
-     (   (apr_uint32_t)p[0]        \
-      + ((apr_uint32_t)p[1] << 8)  \
-      + ((apr_uint32_t)p[2] << 16) \
-      + ((apr_uint32_t)p[3] << 24))
-#endif
-
-/* Similar to the previous but operates on 4 bytes at once instead of the
- * classic unroll. This is particularly fast when unaligned access is
- * supported.
- */
-static unsigned int
-hashfunc_fast(const char *char_key, apr_ssize_t *klen)
-{
-    unsigned int hash = 0;
-    const unsigned char *key = (const unsigned char *)char_key;
-    const unsigned char *p;
-    apr_ssize_t i;
-    apr_uint32_t chunk, test;
-
-    if (*klen == APR_HASH_KEY_STRING)
-      {
-        for (p = key; ; p += sizeof(chunk))
-          {
-            /* This is a variant of the well-known strlen test: */
-            chunk = READ_CHUNK(p);
-            test = chunk | ((chunk & LOWER_7BITS_SET) + LOWER_7BITS_SET);
-            if ((test & BIT_7_SET) != BIT_7_SET)
-              break;
-
-            hash = (hash + chunk) * 0xd1f3da69;
-          }
-        for (; *p; p++)
-            hash = hash * 33 + *p;
-
-        *klen = p - key;
-      }
-    else
-      {
-        for ( p = key, i = *klen
-            ; i >= sizeof(chunk)
-            ; i -= sizeof(chunk), p += sizeof(chunk))
-          {
-            chunk = READ_CHUNK(p);
-            hash = (hash + chunk) * 0xd1f3da69;
-          }
-        for (; i; i--, p++)
-            hash = hash * 33 + *p;
-      }
-
-    return hash;
-}
-
 apr_hash_t *
 svn_hash__make(apr_pool_t *pool)
 {
   return apr_hash_make_custom(pool, hashfunc_compatible);
 }
-
-apr_hash_t *
-svn_hash__make_fast(apr_pool_t *pool)
-{
-  return apr_hash_make_custom(pool, hashfunc_fast);
-}

Modified: subversion/branches/ev2-export/subversion/libsvn_subr/internal_statements.sql
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_subr/internal_statements.sql?rev=1341011&r1=1341010&r2=1341011&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_subr/internal_statements.sql (original)
+++ subversion/branches/ev2-export/subversion/libsvn_subr/internal_statements.sql Mon May 21 13:31:24 2012
@@ -21,5 +21,27 @@
  * ====================================================================
  */
 
--- STMT_DUMMY_SELECT_FOR_BACKUP
-SELECT * FROM SQLITE_MASTER;
+-- STMT_INTERNAL_SAVEPOINT_SVN
+SAVEPOINT svn
+
+-- STMT_INTERNAL_RELEASE_SAVEPOINT_SVN
+RELEASE SAVEPOINT svn
+
+-- STMT_INTERNAL_ROLLBACK_TO_SAVEPOINT_SVN
+ROLLBACK TO SAVEPOINT svn
+
+-- STMT_INTERNAL_BEGIN_TRANSACTION
+BEGIN TRANSACTION
+
+-- STMT_INTERNAL_BEGIN_IMMEDIATE_TRANSACTION
+BEGIN IMMEDIATE TRANSACTION
+
+-- STMT_INTERNAL_COMMIT_TRANSACTION
+COMMIT TRANSACTION
+
+-- STMT_INTERNAL_ROLLBACK_TRANSACTION
+ROLLBACK TRANSACTION
+
+/* Dummmy statement to determine the number of internal statements */
+-- STMT_INTERNAL_LAST
+;

Modified: subversion/branches/ev2-export/subversion/libsvn_subr/io.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_subr/io.c?rev=1341011&r1=1341010&r2=1341011&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_subr/io.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_subr/io.c Mon May 21 13:31:24 2012
@@ -65,7 +65,6 @@
 
 #include "private/svn_atomic.h"
 #include "private/svn_io_private.h"
-#include "private/svn_subr_private.h"
 
 #define SVN_SLEEP_ENV_VAR "SVN_I_LOVE_CORRUPTED_WORKING_COPIES_SO_DISABLE_SLEEP_FOR_TIMESTAMPS"
 
@@ -229,6 +228,10 @@ entry_name_to_utf8(const char **name_p,
                    const char *parent,
                    apr_pool_t *pool)
 {
+#if defined(WIN32) || defined(DARWIN)
+  *name_p = apr_pstrdup(pool, name);
+  return SVN_NO_ERROR;
+#else
   svn_error_t *err = svn_path_cstring_to_utf8(name_p, name, pool);
   if (err && err->apr_err == APR_EINVAL)
     {
@@ -238,6 +241,7 @@ entry_name_to_utf8(const char **name_p,
                                svn_dirent_local_style(parent, pool));
     }
   return err;
+#endif
 }
 
 
@@ -2390,7 +2394,7 @@ svn_io_get_dirents3(apr_hash_t **dirents
   if (!only_check_type)
     flags |= APR_FINFO_SIZE | APR_FINFO_MTIME;
 
-  *dirents = svn_hash__make(result_pool);
+  *dirents = apr_hash_make(result_pool);
 
   SVN_ERR(svn_io_dir_open(&this_dir, path, scratch_pool));
 

Modified: subversion/branches/ev2-export/subversion/libsvn_subr/path.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_subr/path.c?rev=1341011&r1=1341010&r2=1341011&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_subr/path.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_subr/path.c Mon May 21 13:31:24 2012
@@ -1102,15 +1102,19 @@ svn_path_cstring_from_utf8(const char **
                            const char *path_utf8,
                            apr_pool_t *pool)
 {
+#if !defined(WIN32) && !defined(DARWIN)
   svn_boolean_t path_is_utf8;
   SVN_ERR(get_path_encoding(&path_is_utf8, pool));
   if (path_is_utf8)
+#endif
     {
       *path_apr = apr_pstrdup(pool, path_utf8);
       return SVN_NO_ERROR;
     }
+#if !defined(WIN32) && !defined(DARWIN)
   else
     return svn_utf_cstring_from_utf8(path_apr, path_utf8, pool);
+#endif
 }
 
 
@@ -1119,15 +1123,19 @@ svn_path_cstring_to_utf8(const char **pa
                          const char *path_apr,
                          apr_pool_t *pool)
 {
+#if !defined(WIN32) && !defined(DARWIN)
   svn_boolean_t path_is_utf8;
   SVN_ERR(get_path_encoding(&path_is_utf8, pool));
   if (path_is_utf8)
+#endif
     {
       *path_utf8 = apr_pstrdup(pool, path_apr);
       return SVN_NO_ERROR;
     }
+#if !defined(WIN32) && !defined(DARWIN)
   else
     return svn_utf_cstring_to_utf8(path_utf8, path_apr, pool);
+#endif
 }
 
 

Modified: subversion/branches/ev2-export/subversion/libsvn_subr/skel.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_subr/skel.c?rev=1341011&r1=1341010&r2=1341011&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_subr/skel.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_subr/skel.c Mon May 21 13:31:24 2012
@@ -25,7 +25,6 @@
 #include "svn_error.h"
 #include "private/svn_skel.h"
 #include "private/svn_string_private.h"
-#include "private/svn_subr_private.h"
 
 
 /* Parsing skeletons.  */
@@ -681,7 +680,7 @@ svn_skel__parse_proplist(apr_hash_t **pr
     return skel_err("proplist");
 
   /* Create the returned structure */
-  proplist = svn_hash__make(pool);
+  proplist = apr_hash_make(pool);
   for (elt = skel->children; elt; elt = elt->next->next)
     {
       svn_string_t *value = svn_string_ncreate(elt->next->data,

Modified: subversion/branches/ev2-export/subversion/libsvn_subr/sqlite.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_subr/sqlite.c?rev=1341011&r1=1341010&r2=1341011&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_subr/sqlite.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_subr/sqlite.c Mon May 21 13:31:24 2012
@@ -84,7 +84,6 @@ struct svn_sqlite__db_t
   int nbr_statements;
   svn_sqlite__stmt_t **prepared_stmts;
   apr_pool_t *state_pool;
-  unsigned savepoint_nr;
 };
 
 struct svn_sqlite__stmt_t
@@ -204,6 +203,29 @@ svn_sqlite__get_statement(svn_sqlite__st
   return SVN_NO_ERROR;
 }
 
+/* Like svn_sqlite__get_statement but gets an internal statement.
+
+   All internal statements that use this api are executed with step_done(),
+   so we don't need the fallback reset handling here or in the pool cleanup */
+static svn_error_t *
+get_internal_statement(svn_sqlite__stmt_t **stmt, svn_sqlite__db_t *db,
+                       int stmt_idx)
+{
+  /* The internal statements are stored after the registered statements */
+  int prep_idx = db->nbr_statements + stmt_idx;
+  SVN_ERR_ASSERT(stmt_idx < STMT_INTERNAL_LAST);
+
+  if (db->prepared_stmts[prep_idx] == NULL)
+    SVN_ERR(prepare_statement(&db->prepared_stmts[prep_idx], db,
+                              internal_statements[stmt_idx],
+                              db->state_pool));
+
+  *stmt = db->prepared_stmts[prep_idx];
+
+  return SVN_NO_ERROR;
+}
+
+
 static svn_error_t *
 step_with_expectation(svn_sqlite__stmt_t* stmt,
                       svn_boolean_t expecting_row)
@@ -742,6 +764,15 @@ close_apr(void *data)
                         svn_sqlite__finalize(db->prepared_stmts[i]), err);
         }
     }
+  /* And finalize any used internal statements */
+  for (; i < db->nbr_statements + STMT_INTERNAL_LAST; i++)
+    {
+      if (db->prepared_stmts[i])
+        {
+          err = svn_error_compose_create(
+                        svn_sqlite__finalize(db->prepared_stmts[i]), err);
+        }
+    }
 
   result = sqlite3_close(db->db3);
 
@@ -844,11 +875,19 @@ svn_sqlite__open(svn_sqlite__db_t **db, 
           statements++;
           (*db)->nbr_statements++;
         }
-      (*db)->prepared_stmts = apr_pcalloc(result_pool, (*db)->nbr_statements
+
+      (*db)->prepared_stmts = apr_pcalloc(
+                                  result_pool,
+                                  ((*db)->nbr_statements + STMT_INTERNAL_LAST)
                                                 * sizeof(svn_sqlite__stmt_t *));
     }
   else
-    (*db)->nbr_statements = 0;
+    {
+      (*db)->nbr_statements = 0;
+      (*db)->prepared_stmts = apr_pcalloc(result_pool,
+                                          (0 + STMT_INTERNAL_LAST)
+                                                * sizeof(svn_sqlite__stmt_t *));
+    }
 
   (*db)->state_pool = result_pool;
   apr_pool_cleanup_register(result_pool, *db, close_apr, apr_pool_cleanup_null);
@@ -897,6 +936,7 @@ with_transaction(svn_sqlite__db_t *db,
                  void *cb_baton,
                  apr_pool_t *scratch_pool /* NULL allowed */)
 {
+  svn_sqlite__stmt_t *stmt;
   svn_error_t *err;
 
   err = cb_func(cb_baton, db, scratch_pool);
@@ -904,7 +944,12 @@ with_transaction(svn_sqlite__db_t *db,
   /* Commit or rollback the sqlite transaction. */
   if (err)
     {
-      svn_error_t *err2 = exec_sql(db, "ROLLBACK TRANSACTION;");
+      svn_error_t *err2;
+
+      err2 = get_internal_statement(&stmt, db,
+                                    STMT_INTERNAL_ROLLBACK_TRANSACTION);
+      if (!err2)
+        err2 = svn_sqlite__step_done(stmt);
 
       if (err2 && err2->apr_err == SVN_ERR_SQLITE_BUSY)
         {
@@ -929,7 +974,7 @@ with_transaction(svn_sqlite__db_t *db,
 
           err2 = reset_all_statements(db, err2);
           err2 = svn_error_compose_create(
-                      exec_sql(db, "ROLLBACK TRANSACTION;"),
+                      svn_sqlite__step_done(stmt),
                       err2);
         }
 
@@ -937,7 +982,8 @@ with_transaction(svn_sqlite__db_t *db,
                                       err2);
     }
 
-  return svn_error_trace(exec_sql(db, "COMMIT TRANSACTION;"));
+  SVN_ERR(get_internal_statement(&stmt, db, STMT_INTERNAL_COMMIT_TRANSACTION));
+  return svn_error_trace(svn_sqlite__step_done(stmt));
 }
 
 svn_error_t *
@@ -946,7 +992,10 @@ svn_sqlite__with_transaction(svn_sqlite_
                              void *cb_baton,
                              apr_pool_t *scratch_pool /* NULL allowed */)
 {
-  SVN_ERR(exec_sql(db, "BEGIN TRANSACTION;"));
+  svn_sqlite__stmt_t *stmt;
+  SVN_ERR(get_internal_statement(&stmt, db,
+                                 STMT_INTERNAL_BEGIN_TRANSACTION));
+  SVN_ERR(svn_sqlite__step_done(stmt));
   return svn_error_trace(with_transaction(db, cb_func, cb_baton,
                                           scratch_pool));
 }
@@ -958,7 +1007,10 @@ svn_sqlite__with_immediate_transaction(
   void *cb_baton,
   apr_pool_t *scratch_pool /* NULL allowed */)
 {
-  SVN_ERR(exec_sql(db, "BEGIN IMMEDIATE TRANSACTION;"));
+  svn_sqlite__stmt_t *stmt;
+  SVN_ERR(get_internal_statement(&stmt, db,
+                                 STMT_INTERNAL_BEGIN_IMMEDIATE_TRANSACTION));
+  SVN_ERR(svn_sqlite__step_done(stmt));
   return svn_error_trace(with_transaction(db, cb_func, cb_baton,
                                           scratch_pool));
 }
@@ -970,20 +1022,21 @@ svn_sqlite__with_lock(svn_sqlite__db_t *
                       apr_pool_t *scratch_pool)
 {
   svn_error_t *err;
-  int savepoint = db->savepoint_nr++;
-  /* This buffer is plenty big to hold the SAVEPOINT and RELEASE commands. */
-  char buf[32];
+  svn_sqlite__stmt_t *stmt;
 
-  snprintf(buf, sizeof(buf), "SAVEPOINT s%u", savepoint);
-  SVN_ERR(exec_sql(db, buf));
+  SVN_ERR(get_internal_statement(&stmt, db, STMT_INTERNAL_SAVEPOINT_SVN));
+  SVN_ERR(svn_sqlite__step_done(stmt));
   err = cb_func(cb_baton, db, scratch_pool);
 
   if (err)
     {
       svn_error_t *err2;
 
-      snprintf(buf, sizeof(buf), "ROLLBACK TO s%u", savepoint);
-      err2 = exec_sql(db, buf);
+      err2 = get_internal_statement(&stmt, db,
+                                    STMT_INTERNAL_ROLLBACK_TO_SAVEPOINT_SVN);
+
+      if (!err2)
+        err2 = svn_sqlite__step_done(stmt);
 
       if (err2 && err2->apr_err == SVN_ERR_SQLITE_BUSY)
         {
@@ -994,17 +1047,23 @@ svn_sqlite__with_lock(svn_sqlite__db_t *
                  further details */
 
           err2 = reset_all_statements(db, err2);
-          err2 = svn_error_compose_create(exec_sql(db, buf), err2);
+          err2 = svn_error_compose_create(svn_sqlite__step_done(stmt), err2);
         }
 
-      snprintf(buf, sizeof(buf), "RELEASE   s%u", savepoint);
-      err2 = svn_error_compose_create(exec_sql(db, buf), err2);
+      err = svn_error_compose_create(err, err2);
+      err2 = get_internal_statement(&stmt, db,
+                                    STMT_INTERNAL_RELEASE_SAVEPOINT_SVN);
+
+      if (!err2)
+        err2 = svn_sqlite__step_done(stmt);
 
       return svn_error_trace(svn_error_compose_create(err, err2));
     }
 
-  snprintf(buf, sizeof(buf), "RELEASE   s%u", savepoint);
-  return svn_error_trace(exec_sql(db, buf));
+  SVN_ERR(get_internal_statement(&stmt, db,
+                                 STMT_INTERNAL_RELEASE_SAVEPOINT_SVN));
+
+  return svn_error_trace(svn_sqlite__step_done(stmt));
 }
 
 svn_error_t *
@@ -1015,7 +1074,7 @@ svn_sqlite__hotcopy(const char *src_path
   svn_sqlite__db_t *src_db;
 
   SVN_ERR(svn_sqlite__open(&src_db, src_path, svn_sqlite__mode_readonly,
-                           internal_statements, 0, NULL,
+                           NULL, 0, NULL,
                            scratch_pool, scratch_pool));
 
   {

Modified: subversion/branches/ev2-export/subversion/libsvn_subr/win32_crashrpt.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_subr/win32_crashrpt.c?rev=1341011&r1=1341010&r2=1341011&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_subr/win32_crashrpt.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_subr/win32_crashrpt.c Mon May 21 13:31:24 2012
@@ -300,7 +300,7 @@ format_basic_type(char *buf, DWORD basic
 static void
 format_value(char *value_str, DWORD64 mod_base, DWORD type, void *value_addr)
 {
-  DWORD tag;
+  DWORD tag = 0;
   int ptr = 0;
   HANDLE proc = GetCurrentProcess();
 
@@ -335,7 +335,7 @@ format_value(char *value_str, DWORD64 mo
                         type_name, *(DWORD *)value_addr);
               else
                 sprintf(value_str, "(%s **) 0x%08x",
-                        type_name, (DWORD *)value_addr);
+                        type_name, *(DWORD *)value_addr);
 
               free(type_name);
             }
@@ -354,17 +354,14 @@ format_value(char *value_str, DWORD64 mo
             {
               sprintf(value_str, "0x%08x \"%s\"",
                       *(DWORD *)value_addr, (char *)*(DWORD*)value_addr);
-              break;
             }
-          if (ptr >= 1)
+          else if (ptr >= 1)
             {
               sprintf(value_str, "0x%08x", *(DWORD *)value_addr);
-              break;
             }
-          if (SymGetTypeInfo_(proc, mod_base, type, TI_GET_BASETYPE, &bt))
+          else if (SymGetTypeInfo_(proc, mod_base, type, TI_GET_BASETYPE, &bt))
             {
               format_basic_type(value_str, bt, length, value_addr);
-              break;
             }
         }
         break;
@@ -375,7 +372,7 @@ format_value(char *value_str, DWORD64 mo
           sprintf(value_str, "0x%08x", *(DWORD *)value_addr);
           break;
       default:
-          sprintf(value_str, "[unhandled tag: 0x%08x]", tag);
+          sprintf(value_str, "[unhandled tag: %d]", tag);
           break;
     }
 }

Modified: subversion/branches/ev2-export/subversion/libsvn_wc/adm_files.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_wc/adm_files.c?rev=1341011&r1=1341010&r2=1341011&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_wc/adm_files.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_wc/adm_files.c Mon May 21 13:31:24 2012
@@ -56,7 +56,7 @@ static const char default_adm_dir_name[]
 
 /* The name that is actually used for the WC admin directory.  The
    commonest case where this won't be the default is in Windows
-   ASP.NET development environments, which choke on ".svn". */
+   ASP.NET development environments, which used to choke on ".svn". */
 static const char *adm_dir_name = default_adm_dir_name;
 
 
@@ -108,43 +108,19 @@ svn_wc_set_adm_dir(const char *name, apr
 }
 
 
-static const char *
-simple_extend(const char *adm_path,  /* ### adm_abspath?  */
-              svn_boolean_t use_tmp,
-              const char *subdir,
-              const char *child,
-              const char *extension,
-              apr_pool_t *result_pool)
-{
-  if (subdir)
-    child = svn_dirent_join(subdir, child, result_pool);
-  if (extension)
-    child = apr_pstrcat(result_pool, child, extension, (char *)NULL);
-
-  if (use_tmp)
-    return svn_dirent_join_many(result_pool,
-                                adm_path,
-                                adm_dir_name,
-                                SVN_WC__ADM_TMP,
-                                child,
-                                NULL);
-
+const char *
+svn_wc__adm_child(const char *path,
+                  const char *child,
+                  apr_pool_t *result_pool)
+{
   return svn_dirent_join_many(result_pool,
-                              adm_path,
+                              path,
                               adm_dir_name,
                               child,
                               NULL);
 }
 
 
-const char *svn_wc__adm_child(const char *path,
-                              const char *child,
-                              apr_pool_t *result_pool)
-{
-  return simple_extend(path, FALSE, NULL, child, NULL, result_pool);
-}
-
-
 svn_boolean_t
 svn_wc__adm_area_exists(const char *adm_abspath,
                         apr_pool_t *pool)
@@ -173,12 +149,11 @@ svn_wc__adm_area_exists(const char *adm_
 static svn_error_t *
 make_adm_subdir(const char *path,
                 const char *subdir,
-                svn_boolean_t tmp,
                 apr_pool_t *pool)
 {
   const char *fullpath;
 
-  fullpath = simple_extend(path, tmp, NULL, subdir, NULL, pool);
+  fullpath = svn_wc__adm_child(path, subdir, pool);
 
   return svn_io_dir_make(fullpath, APR_OS_DEFAULT, pool);
 }
@@ -360,7 +335,7 @@ static svn_error_t *
 init_adm_tmp_area(const char *path, apr_pool_t *pool)
 {
   /* SVN_WC__ADM_TMP */
-  SVN_ERR(make_adm_subdir(path, SVN_WC__ADM_TMP, FALSE, pool));
+  SVN_ERR(make_adm_subdir(path, SVN_WC__ADM_TMP, pool));
 
   return SVN_NO_ERROR;
 }
@@ -387,7 +362,7 @@ init_adm(svn_wc__db_t *db,
   /** Make subdirectories. ***/
 
   /* SVN_WC__ADM_PRISTINE */
-  SVN_ERR(make_adm_subdir(local_abspath, SVN_WC__ADM_PRISTINE, FALSE, pool));
+  SVN_ERR(make_adm_subdir(local_abspath, SVN_WC__ADM_PRISTINE, pool));
 
   /* ### want to add another directory? do a format bump to ensure that
      ### all existing working copies get the new directories. or maybe

Modified: subversion/branches/ev2-export/subversion/libsvn_wc/node.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_wc/node.c?rev=1341011&r1=1341010&r2=1341011&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_wc/node.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_wc/node.c Mon May 21 13:31:24 2012
@@ -1513,7 +1513,6 @@ svn_wc__node_get_commit_status(svn_boole
                                svn_revnum_t *revision,
                                svn_revnum_t *original_revision,
                                const char **original_repos_relpath,
-                               svn_boolean_t *update_root,
                                svn_wc_context_t *wc_ctx,
                                const char *local_abspath,
                                apr_pool_t *result_pool,
@@ -1556,19 +1555,18 @@ svn_wc__node_get_commit_status(svn_boole
     }
 
   /* Retrieve some information from BASE which is needed for replacing
-     and/or deleting BASE nodes. (We don't need lock here) */
+     and/or deleting BASE nodes. */
   if (have_base
-      && ((revision && !SVN_IS_VALID_REVNUM(*revision))
-          || (update_root && status == svn_wc__db_status_normal)))
+      && !have_more_work
+      && op_root
+      && (revision && !SVN_IS_VALID_REVNUM(*revision)))
     {
       SVN_ERR(svn_wc__db_base_get_info(NULL, NULL, revision, NULL, NULL, NULL,
                                        NULL, NULL, NULL, NULL, NULL, NULL,
-                                       NULL, NULL, update_root,
+                                       NULL, NULL, NULL,
                                        wc_ctx->db, local_abspath,
                                        scratch_pool, scratch_pool));
     }
-  else if (update_root)
-    *update_root = FALSE;
 
   return SVN_NO_ERROR;
 }

Modified: subversion/branches/ev2-export/subversion/libsvn_wc/wc-queries.sql
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_wc/wc-queries.sql?rev=1341011&r1=1341010&r2=1341011&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/branches/ev2-export/subversion/libsvn_wc/wc-queries.sql Mon May 21 13:31:24 2012
@@ -178,19 +178,19 @@ UNION
 SELECT 1 FROM ACTUAL_NODE
 WHERE wc_id = ?1 AND parent_relpath = ?2
 
+/* Delete the nodes shadowed by local_relpath. Not valid for the wc-root */
 -- STMT_DELETE_SHADOWED_RECURSIVE
 DELETE FROM nodes
 WHERE wc_id = ?1
-  AND (local_relpath = ?2
-       OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
+  AND IS_STRICT_DESCENDANT_OF(local_relpath, ?2)
   AND (op_depth < ?3
        OR (op_depth = ?3 AND presence = 'base-deleted'))
 
+/* Get not-present descendants of a copied node. Not valid for the wc-root */
 -- STMT_SELECT_NOT_PRESENT_DESCENDANTS
 SELECT local_relpath FROM nodes
 WHERE wc_id = ?1 AND op_depth = ?3
-  AND (parent_relpath = ?2
-       OR IS_STRICT_DESCENDANT_OF(parent_relpath, ?2))
+  AND IS_STRICT_DESCENDANT_OF(local_relpath, ?2)
   AND presence == 'not-present'
 
 -- STMT_COMMIT_DESCENDANT_TO_BASE
@@ -259,15 +259,14 @@ INSERT OR REPLACE INTO lock
  lock_date)
 VALUES (?1, ?2, ?3, ?4, ?5, ?6)
 
+/* Not valid for the working copy root */
 -- STMT_SELECT_BASE_NODE_LOCK_TOKENS_RECURSIVE
 SELECT nodes.repos_id, nodes.repos_path, lock_token
 FROM nodes
 LEFT JOIN lock ON nodes.repos_id = lock.repos_id
   AND nodes.repos_path = lock.repos_relpath
 WHERE wc_id = ?1 AND op_depth = 0
-  AND (?2 = ''
-       OR local_relpath = ?2
-       OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
+  AND IS_STRICT_DESCENDANT_OF(local_relpath, ?2)
 
 -- STMT_INSERT_WCROOT
 INSERT INTO wcroot (local_abspath)
@@ -601,23 +600,29 @@ WHERE wc_id = ?1 AND local_relpath = ?2
 DELETE FROM nodes
 WHERE wc_id = ?1 AND local_relpath = ?2
 
--- STMT_DELETE_NODES_RECURSIVE
+/* Will not delete recursive when run on the wcroot */
+-- STMT_DELETE_NODES_ABOVE_DEPTH_RECURSIVE
 DELETE FROM nodes
 WHERE wc_id = ?1
-  AND (?2 = ''
-       OR local_relpath = ?2
+  AND (local_relpath = ?2
        OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
   AND op_depth >= ?3
 
+/* WC-Root query for STMT_DELETE_NODES_ABOVE_DEPTH_RECURSIVE */
+-- STMT_DELETE_ALL_NODES_ABOVE_DEPTH
+DELETE FROM nodes
+WHERE wc_id = ?1
+  AND op_depth >= ?2
+
 -- STMT_DELETE_ACTUAL_NODE
 DELETE FROM actual_node
 WHERE wc_id = ?1 AND local_relpath = ?2
 
+/* Will not delete recursive when run on the wcroot */
 -- STMT_DELETE_ACTUAL_NODE_RECURSIVE
 DELETE FROM actual_node
 WHERE wc_id = ?1
-  AND (?2 = ''
-       OR local_relpath = ?2
+  AND (local_relpath = ?2
        OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
 
 -- STMT_DELETE_ACTUAL_NODE_WITHOUT_CONFLICT
@@ -634,11 +639,11 @@ WHERE wc_id = ?1
                       WHERE c.wc_id = ?1 AND c.local_relpath = ?2
                         AND c.kind = 'file'))
 
+/* Not valid for the wc-root */
 -- STMT_DELETE_ACTUAL_NODE_LEAVING_CHANGELIST_RECURSIVE
 DELETE FROM actual_node
 WHERE wc_id = ?1
-  AND (?2 = ''
-       OR local_relpath = ?2
+  AND (local_relpath = ?2
        OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
   AND (changelist IS NULL
        OR NOT EXISTS (SELECT 1 FROM nodes_current c
@@ -646,6 +651,15 @@ WHERE wc_id = ?1
                         AND c.local_relpath = actual_node.local_relpath
                         AND c.kind = 'file'))
 
+-- STMT_DELETE_ALL_ACTUAL_NODE_LEAVING_CHANGELIST
+DELETE FROM actual_node
+WHERE wc_id = ?1
+  AND (changelist IS NULL
+       OR NOT EXISTS (SELECT 1 FROM nodes_current c
+                      WHERE c.wc_id = ?1 
+                        AND c.local_relpath = actual_node.local_relpath
+                        AND c.kind = 'file'))
+
 -- STMT_CLEAR_ACTUAL_NODE_LEAVING_CHANGELIST
 UPDATE actual_node
 SET properties = NULL,
@@ -660,6 +674,7 @@ SET properties = NULL,
     right_checksum = NULL
 WHERE wc_id = ?1 AND local_relpath = ?2
 
+/* Not valid for the wc-root */
 -- STMT_CLEAR_ACTUAL_NODE_LEAVING_CHANGELIST_RECURSIVE
 UPDATE actual_node
 SET properties = NULL,
@@ -673,10 +688,23 @@ SET properties = NULL,
     left_checksum = NULL,
     right_checksum = NULL
 WHERE wc_id = ?1
-  AND (?2 = ''
-       OR local_relpath = ?2
+  AND (local_relpath = ?2
        OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
 
+-- STMT_CLEAR_ALL_ACTUAL_NODE_LEAVING_CHANGELIST
+UPDATE actual_node
+SET properties = NULL,
+    text_mod = NULL,
+    tree_conflict_data = NULL,
+    conflict_old = NULL,
+    conflict_new = NULL,
+    conflict_working = NULL,
+    prop_reject = NULL,
+    older_checksum = NULL,
+    left_checksum = NULL,
+    right_checksum = NULL
+WHERE wc_id = ?1
+
 -- STMT_UPDATE_NODE_BASE_DEPTH
 UPDATE nodes SET depth = ?3
 WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0
@@ -871,26 +899,34 @@ SELECT wc_id, local_relpath, ?3 /*op_dep
 FROM nodes
 WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0
 
+/* Not valid on the wc-root */
 -- STMT_UPDATE_OP_DEPTH_INCREASE_RECURSIVE
 UPDATE nodes SET op_depth = ?3 + 1
 WHERE wc_id = ?1
-  AND (?2 = ''
-       OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
+ AND IS_STRICT_DESCENDANT_OF(local_relpath, ?2)
  AND op_depth = ?3
 
 -- STMT_DOES_NODE_EXIST
 SELECT 1 FROM nodes WHERE wc_id = ?1 AND local_relpath = ?2
 LIMIT 1
 
--- STMT_HAS_SERVER_EXCLUDED_NODES
+/* Not valid for the wc-root */
+-- STMT_HAS_SERVER_EXCLUDED_DESCENDANTS
 SELECT local_relpath FROM nodes
 WHERE wc_id = ?1
-  AND (?2 = ''
-       OR local_relpath = ?2
-       OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
+  AND IS_STRICT_DESCENDANT_OF(local_relpath, ?2)
   AND op_depth = 0 AND presence = 'absent'
 LIMIT 1
 
+/* Applies to all nodes in a wc */
+-- STMT_WC_HAS_SERVER_EXCLUDED
+SELECT local_relpath FROM nodes
+WHERE wc_id = ?1
+  AND op_depth = 0 AND presence = 'absent'
+LIMIT 1
+
+
+
 /* ### Select all server-excluded nodes. */
 -- STMT_SELECT_ALL_SERVER_EXCLUDED_NODES
 SELECT local_relpath FROM nodes
@@ -901,48 +937,40 @@ WHERE wc_id = ?1
   AND op_depth = 0
   AND presence = 'absent'
 
--- STMT_INSERT_WORKING_NODE_COPY_FROM_BASE
+/* Creates a copy from one top level NODE to a different location */
+-- STMT_INSERT_WORKING_NODE_COPY_FROM
 INSERT OR REPLACE INTO nodes (
     wc_id, local_relpath, op_depth, parent_relpath, repos_id,
     repos_path, revision, presence, depth, moved_here, kind, changed_revision,
     changed_date, changed_author, checksum, properties, translated_size,
     last_mod_time, symlink_target, moved_to )
-SELECT src.wc_id, ?3 /*local_relpath*/, ?4 /*op_depth*/, ?5 /*parent_relpath*/,
-    src.repos_id, src.repos_path, src.revision, ?6 /*presence*/, src.depth,
-    ?7/*moved_here*/, src.kind, src.changed_revision, src.changed_date,
-    src.changed_author, src.checksum, src.properties, src.translated_size,
-    src.last_mod_time, src.symlink_target, dst.moved_to
-FROM nodes AS src
-LEFT OUTER JOIN nodes_current dst ON dst.wc_id = src.wc_id
-  AND dst.local_relpath = ?3 AND dst.op_depth = ?4
-WHERE src.wc_id = ?1 AND src.local_relpath = ?2 AND src.op_depth = 0
+SELECT wc_id, ?3 /*local_relpath*/, ?4 /*op_depth*/, ?5 /*parent_relpath*/,
+    repos_id, repos_path, revision, ?6 /*presence*/, depth,
+    ?7/*moved_here*/, kind, changed_revision, changed_date,
+    changed_author, checksum, properties, translated_size,
+    last_mod_time, symlink_target,
+    (SELECT dst.moved_to FROM nodes_current AS dst
+                         WHERE dst.wc_id = ?1
+                         AND dst.local_relpath = ?3
+                         AND dst.op_depth = ?4)
+FROM nodes_current
+WHERE wc_id = ?1 AND local_relpath = ?2
 
--- STMT_INSERT_WORKING_NODE_COPY_FROM_WORKING
+-- STMT_INSERT_WORKING_NODE_COPY_FROM_DEPTH
 INSERT OR REPLACE INTO nodes (
     wc_id, local_relpath, op_depth, parent_relpath, repos_id,
     repos_path, revision, presence, depth, moved_here, kind, changed_revision,
     changed_date, changed_author, checksum, properties, translated_size,
     last_mod_time, symlink_target, moved_to )
-SELECT src.wc_id, ?3 /*local_relpath*/, ?4 /*op_depth*/, ?5 /*parent_relpath*/,
-    src.repos_id, src.repos_path, src.revision, ?6 /*presence*/, src.depth,
-    ?7 /*moved_here*/, src.kind, src.changed_revision, src.changed_date,
-    src.changed_author, src.checksum, src.properties, src.translated_size,
-    src.last_mod_time, src.symlink_target, dst.moved_to
-FROM nodes_current AS src
-LEFT OUTER JOIN nodes_current dst ON dst.wc_id = src.wc_id
-  AND dst.local_relpath = ?3  AND dst.op_depth = ?4
-WHERE src.wc_id = ?1 AND src.local_relpath = ?2 AND src.op_depth > 0
-
--- STMT_INSERT_WORKING_NODE_COPY_FROM_DEPTH
-INSERT OR REPLACE INTO nodes (
-    wc_id, local_relpath, op_depth, parent_relpath, repos_id, repos_path,
-    revision, presence, depth, moved_here, kind, changed_revision, changed_date,
-    changed_author, checksum, properties, translated_size, last_mod_time,
-    symlink_target )
 SELECT wc_id, ?3 /*local_relpath*/, ?4 /*op_depth*/, ?5 /*parent_relpath*/,
-    repos_id, repos_path, revision, ?6 /*presence*/, depth, ?7 /*moved_here*/,
-    kind, changed_revision, changed_date, changed_author, checksum,
-    properties, translated_size, last_mod_time, symlink_target
+    repos_id, repos_path, revision, ?6 /*presence*/, depth,
+    ?7 /*moved_here*/, kind, changed_revision, changed_date,
+    changed_author, checksum, properties, translated_size,
+    last_mod_time, symlink_target,
+    (SELECT dst.moved_to FROM nodes_current AS dst
+                         WHERE dst.wc_id = ?1
+                         AND dst.local_relpath = ?3
+                         AND dst.op_depth = ?4)
 FROM nodes
 WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = ?8
 
@@ -1024,10 +1052,6 @@ WHERE wc_id = ?1 
        OR def_local_relpath = ?2
        OR IS_STRICT_DESCENDANT_OF(def_local_relpath, ?2))
 
--- STMT_UPDATE_EXTERNAL_FILEINFO
-UPDATE externals SET recorded_size = ?3, recorded_mod_time = ?4
-WHERE wc_id = ?1 AND local_relpath = ?2
-
 -- STMT_DELETE_EXTERNAL
 DELETE FROM externals
 WHERE wc_id = ?1 AND local_relpath = ?2
@@ -1256,14 +1280,18 @@ CREATE TEMPORARY TABLE delete_list (
    local_relpath TEXT PRIMARY KEY NOT NULL UNIQUE
    )
 
-/* This matches the selection in STMT_INSERT_DELETE_FROM_NODE_RECURSIVE */
+/* This matches the selection in STMT_INSERT_DELETE_FROM_NODE_RECURSIVE.
+   A subquery is used instead of nodes_current to avoid a table scan */
 -- STMT_INSERT_DELETE_LIST
 INSERT INTO delete_list(local_relpath)
-SELECT local_relpath FROM nodes_current
+SELECT local_relpath FROM nodes AS n
 WHERE wc_id = ?1
   AND (local_relpath = ?2
        OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
   AND op_depth >= ?3
+  AND op_depth = (SELECT MAX(s.op_depth) FROM nodes AS s
+                  WHERE s.wc_id = ?1
+                    AND s.local_relpath = n.local_relpath)
   AND presence NOT IN ('base-deleted', 'not-present', 'excluded', 'absent')
 
 -- STMT_SELECT_DELETE_LIST

Modified: subversion/branches/ev2-export/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_wc/wc_db.c?rev=1341011&r1=1341010&r2=1341011&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_wc/wc_db.c Mon May 21 13:31:24 2012
@@ -51,7 +51,6 @@
 #include "private/svn_skel.h"
 #include "private/svn_wc_private.h"
 #include "private/svn_token.h"
-#include "private/svn_subr_private.h"
 
 
 #define NOT_IMPLEMENTED() SVN__NOT_IMPLEMENTED()
@@ -1187,7 +1186,7 @@ gather_children2(const apr_array_header_
                  apr_pool_t *result_pool,
                  apr_pool_t *scratch_pool)
 {
-  apr_hash_t *names_hash = svn_hash__make(scratch_pool);
+  apr_hash_t *names_hash = apr_hash_make(scratch_pool);
   apr_array_header_t *names_array;
 
   /* All of the names get allocated in RESULT_POOL.  It
@@ -1211,7 +1210,7 @@ gather_children(const apr_array_header_t
                 apr_pool_t *result_pool,
                 apr_pool_t *scratch_pool)
 {
-  apr_hash_t *names_hash = svn_hash__make(scratch_pool);
+  apr_hash_t *names_hash = apr_hash_make(scratch_pool);
   apr_array_header_t *names_array;
 
   /* All of the names get allocated in RESULT_POOL.  It
@@ -2211,7 +2210,7 @@ svn_wc__db_base_get_children_info(apr_ha
                               dir_abspath, scratch_pool, scratch_pool));
   VERIFY_USABLE_WCROOT(wcroot);
 
-  *nodes = svn_hash__make(result_pool);
+  *nodes = apr_hash_make(result_pool);
 
   SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
                                     STMT_SELECT_BASE_CHILDREN_INFO));
@@ -3409,7 +3408,6 @@ get_info_for_copy(apr_int64_t *copyfrom_
                   svn_wc__db_status_t *status,
                   svn_kind_t *kind,
                   svn_boolean_t *op_root,
-                  svn_boolean_t *have_work,
                   svn_wc__db_wcroot_t *wcroot,
                   const char *local_relpath,
                   apr_pool_t *result_pool,
@@ -3424,7 +3422,7 @@ get_info_for_copy(apr_int64_t *copyfrom_
                     NULL, NULL, NULL, NULL, NULL, op_root, NULL, NULL,
                     NULL /* have_base */,
                     NULL /* have_more_work */,
-                    have_work,
+                    NULL /* have_work */,
                     wcroot, local_relpath, result_pool, scratch_pool));
 
   if (node_status == svn_wc__db_status_excluded)
@@ -3436,7 +3434,7 @@ get_info_for_copy(apr_int64_t *copyfrom_
       svn_dirent_split(&parent_relpath, &base_name, local_relpath,
                        scratch_pool);
       SVN_ERR(get_info_for_copy(copyfrom_id, copyfrom_relpath, copyfrom_rev,
-                                NULL, NULL, NULL, NULL,
+                                NULL, NULL, NULL,
                                 wcroot, parent_relpath,
                                 scratch_pool, scratch_pool));
       if (*copyfrom_relpath)
@@ -3548,7 +3546,6 @@ db_op_copy(svn_wc__db_wcroot_t *src_wcro
   svn_wc__db_status_t status;
   svn_wc__db_status_t dst_presence;
   svn_boolean_t op_root;
-  svn_boolean_t have_work;
   apr_int64_t copyfrom_id;
   int dst_op_depth;
   int dst_np_op_depth;
@@ -3556,7 +3553,7 @@ db_op_copy(svn_wc__db_wcroot_t *src_wcro
   const apr_array_header_t *children;
 
   SVN_ERR(get_info_for_copy(&copyfrom_id, &copyfrom_relpath, &copyfrom_rev,
-                            &status, &kind, &op_root, &have_work, src_wcroot,
+                            &status, &kind, &op_root, src_wcroot,
                             src_relpath, scratch_pool, scratch_pool));
 
   SVN_ERR(op_depth_for_copy(&dst_op_depth, &dst_np_op_depth, copyfrom_id,
@@ -3651,12 +3648,8 @@ db_op_copy(svn_wc__db_wcroot_t *src_wcro
       const char *dst_parent_relpath = svn_relpath_dirname(dst_relpath,
                                                            scratch_pool);
 
-      if (have_work)
-        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_wcroot->sdb,
-                          STMT_INSERT_WORKING_NODE_COPY_FROM_BASE));
+      SVN_ERR(svn_sqlite__get_statement(&stmt, src_wcroot->sdb,
+                                        STMT_INSERT_WORKING_NODE_COPY_FROM));
 
       SVN_ERR(svn_sqlite__bindf(stmt, "issdst",
                     src_wcroot->wc_id, src_relpath,
@@ -3960,25 +3953,19 @@ db_op_copy_shadowed_layer(svn_wc__db_wcr
   if (dst_presence == svn_wc__db_status_normal
       && src_wcroot == dst_wcroot) /* ### Remove limitation */
     {
-      if (src_op_depth > 0)
-        SVN_ERR(svn_sqlite__get_statement(&stmt, src_wcroot->sdb,
+      SVN_ERR(svn_sqlite__get_statement(&stmt, src_wcroot->sdb,
                              STMT_INSERT_WORKING_NODE_COPY_FROM_DEPTH));
-      else
-        SVN_ERR(svn_sqlite__get_statement(&stmt, src_wcroot->sdb,
-                             STMT_INSERT_WORKING_NODE_COPY_FROM_BASE));
 
       /* Perhaps we should avoid setting moved_here to 0 and leave it
          null instead? */
-      SVN_ERR(svn_sqlite__bindf(stmt, "issdstd",
+      SVN_ERR(svn_sqlite__bindf(stmt, "issdstdd",
                         src_wcroot->wc_id, src_relpath,
                         dst_relpath,
                         dst_op_depth,
                         svn_relpath_dirname(dst_relpath, iterpool),
                         presence_map, dst_presence,
-                        (is_move ? 1 : 0)));
-
-      if (src_op_depth > 0)
-        SVN_ERR(svn_sqlite__bind_int(stmt, 8, src_op_depth));
+                        (is_move ? 1 : 0),
+                        src_op_depth));
 
       SVN_ERR(svn_sqlite__step_done(stmt));
 
@@ -4188,7 +4175,9 @@ catch_copy_of_server_excluded(svn_wc__db
   const char *server_excluded_relpath;
 
   SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
-                                    STMT_HAS_SERVER_EXCLUDED_NODES));
+                                    (local_relpath[0] == '\0')
+                                      ? STMT_WC_HAS_SERVER_EXCLUDED
+                                      : STMT_HAS_SERVER_EXCLUDED_DESCENDANTS));
   SVN_ERR(svn_sqlite__bindf(stmt, "is",
                             wcroot->wc_id,
                             local_relpath));
@@ -5539,7 +5528,7 @@ op_revert_recursive_txn(void *baton,
       SVN_ERR(svn_sqlite__reset(stmt));
 
       SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
-                                        STMT_DELETE_ACTUAL_NODE_RECURSIVE));
+                                        STMT_DELETE_ACTUAL_NODE));
       SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id,
                                 local_relpath));
       SVN_ERR(svn_sqlite__update(&affected_rows, stmt));
@@ -5569,23 +5558,49 @@ op_revert_recursive_txn(void *baton,
   /* Don't delete BASE nodes */
   select_op_depth = op_depth ? op_depth : 1;
 
-  SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
-                                    STMT_DELETE_NODES_RECURSIVE));
-  SVN_ERR(svn_sqlite__bindf(stmt, "isd", wcroot->wc_id,
-                            local_relpath, select_op_depth));
-  SVN_ERR(svn_sqlite__step_done(stmt));
+  if (local_relpath[0] == '\0')
+    {
+      /* Reverting the wc-root. Use the table-scan queries */
+      SVN_ERR(svn_sqlite__get_statement(
+                            &stmt, wcroot->sdb,
+                            STMT_DELETE_ALL_NODES_ABOVE_DEPTH));
+      SVN_ERR(svn_sqlite__bindf(stmt, "id", wcroot->wc_id, select_op_depth));
+      SVN_ERR(svn_sqlite__step_done(stmt));
 
-  SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
+      SVN_ERR(svn_sqlite__get_statement(
+                            &stmt, wcroot->sdb,
+                            STMT_DELETE_ALL_ACTUAL_NODE_LEAVING_CHANGELIST));
+      SVN_ERR(svn_sqlite__bind_int64(stmt, 1, wcroot->wc_id));
+      SVN_ERR(svn_sqlite__step_done(stmt));
+
+      SVN_ERR(svn_sqlite__get_statement(
+                            &stmt, wcroot->sdb,
+                            STMT_CLEAR_ALL_ACTUAL_NODE_LEAVING_CHANGELIST));
+      SVN_ERR(svn_sqlite__bind_int64(stmt, 1, wcroot->wc_id));
+      SVN_ERR(svn_sqlite__step_done(stmt));
+  }
+  else
+    {
+      /* Reverting any non wc-root node */
+      SVN_ERR(svn_sqlite__get_statement(
+                        &stmt, wcroot->sdb,
+                        STMT_DELETE_NODES_ABOVE_DEPTH_RECURSIVE));
+      SVN_ERR(svn_sqlite__bindf(stmt, "isd", wcroot->wc_id,
+                        local_relpath, select_op_depth));
+      SVN_ERR(svn_sqlite__step_done(stmt));
+
+      SVN_ERR(svn_sqlite__get_statement(
+                        &stmt, wcroot->sdb,
                         STMT_DELETE_ACTUAL_NODE_LEAVING_CHANGELIST_RECURSIVE));
-  SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id,
-                            local_relpath));
-  SVN_ERR(svn_sqlite__step_done(stmt));
+      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, wcroot->sdb,
+      SVN_ERR(svn_sqlite__get_statement(
+                        &stmt, wcroot->sdb,
                         STMT_CLEAR_ACTUAL_NODE_LEAVING_CHANGELIST_RECURSIVE));
-  SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id,
-                            local_relpath));
-  SVN_ERR(svn_sqlite__step_done(stmt));
+      SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
+      SVN_ERR(svn_sqlite__step_done(stmt));
+    }
 
   /* ### This removes the locks, but what about the access batons? */
   SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
@@ -6111,7 +6126,7 @@ remove_node_txn(void *baton,
                           scratch_pool, scratch_pool));
 
   SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
-                                    STMT_DELETE_NODES_RECURSIVE));
+                                    STMT_DELETE_NODES_ABOVE_DEPTH_RECURSIVE));
 
   /* Remove all nodes at or below local_relpath where op_depth >= 0 */
   SVN_ERR(svn_sqlite__bindf(stmt, "isd",
@@ -6465,24 +6480,44 @@ delete_node(void *baton,
       || status == svn_wc__db_status_not_present)
     return SVN_NO_ERROR;
 
-  SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
-                                    STMT_HAS_SERVER_EXCLUDED_NODES));
-  SVN_ERR(svn_sqlite__bindf(stmt, "is",
-                            wcroot->wc_id, local_relpath));
-  SVN_ERR(svn_sqlite__step(&have_row, stmt));
-  if (have_row)
+  /* Don't copy BASE directories with server excluded nodes */
+  if (status == svn_wc__db_status_normal && kind == svn_kind_dir)
     {
-      const char *absent_path = svn_sqlite__column_text(stmt, 0, scratch_pool);
+      SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
+                                        STMT_HAS_SERVER_EXCLUDED_DESCENDANTS));
+      SVN_ERR(svn_sqlite__bindf(stmt, "is",
+                                wcroot->wc_id, local_relpath));
+      SVN_ERR(svn_sqlite__step(&have_row, stmt));
+      if (have_row)
+        {
+          const char *absent_path = svn_sqlite__column_text(stmt, 0,
+                                                            scratch_pool);
 
-      return svn_error_createf(SVN_ERR_WC_PATH_UNEXPECTED_STATUS,
+          return svn_error_createf(
+                               SVN_ERR_WC_PATH_UNEXPECTED_STATUS,
                                svn_sqlite__reset(stmt),
                           _("Cannot delete '%s' as '%s' is excluded by server"),
                                path_for_error_message(wcroot, local_relpath,
                                                       scratch_pool),
                                path_for_error_message(wcroot, absent_path,
                                                       scratch_pool));
+        }
+      SVN_ERR(svn_sqlite__reset(stmt));
+    }
+  else if (status == svn_wc__db_status_server_excluded)
+    {
+      return svn_error_createf(SVN_ERR_WC_PATH_UNEXPECTED_STATUS, NULL,
+                          _("Cannot delete '%s' as it is excluded by server"),
+                               path_for_error_message(wcroot, local_relpath,
+                                                      scratch_pool));
+    }
+  else if (status == svn_wc__db_status_excluded)
+    {
+      return svn_error_createf(SVN_ERR_WC_PATH_UNEXPECTED_STATUS, NULL,
+                          _("Cannot delete '%s' as it is excluded"),
+                               path_for_error_message(wcroot, local_relpath,
+                                                      scratch_pool));
     }
-  SVN_ERR(svn_sqlite__reset(stmt));
 
   if (b->moved_to_relpath)
     {
@@ -6659,7 +6694,10 @@ delete_node(void *baton,
   else
     {
       add_work = TRUE;
-      SVN_ERR(op_depth_of(&select_depth, wcroot, local_relpath));
+      if (status != svn_wc__db_status_normal)
+        SVN_ERR(op_depth_of(&select_depth, wcroot, local_relpath));
+      else
+        select_depth = 0; /* Deleting BASE node */
     }
 
   /* ### Put actual-only nodes into the list? */
@@ -6670,7 +6708,7 @@ delete_node(void *baton,
   SVN_ERR(svn_sqlite__step_done(stmt));
 
   SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
-                                    STMT_DELETE_NODES_RECURSIVE));
+                                    STMT_DELETE_NODES_ABOVE_DEPTH_RECURSIVE));
   SVN_ERR(svn_sqlite__bindf(stmt, "isd",
                             wcroot->wc_id, local_relpath, b->delete_depth));
   SVN_ERR(svn_sqlite__step_done(stmt));
@@ -7688,8 +7726,8 @@ svn_wc__db_read_children_info(apr_hash_t
   svn_wc__db_wcroot_t *wcroot;
   const char *dir_relpath;
 
-  *conflicts = svn_hash__make(result_pool);
-  *nodes = svn_hash__make(result_pool);
+  *conflicts = apr_hash_make(result_pool);
+  *nodes = apr_hash_make(result_pool);
   SVN_ERR_ASSERT(svn_dirent_is_absolute(dir_abspath));
 
   SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &dir_relpath, db,
@@ -7882,7 +7920,7 @@ svn_wc__db_read_children_walker_info(apr
   SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, dir_relpath));
   SVN_ERR(svn_sqlite__step(&have_row, stmt));
 
-  *nodes = svn_hash__make(result_pool);
+  *nodes = apr_hash_make(result_pool);
   while (have_row)
     {
       struct svn_wc__db_walker_info_t *child;

Modified: subversion/branches/ev2-export/subversion/libsvn_wc/wc_db_wcroot.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_wc/wc_db_wcroot.c?rev=1341011&r1=1341010&r2=1341011&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_wc/wc_db_wcroot.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_wc/wc_db_wcroot.c Mon May 21 13:31:24 2012
@@ -372,6 +372,7 @@ svn_wc__db_wcroot_parse_local_abspath(sv
   svn_boolean_t moved_upwards = FALSE;
   svn_boolean_t always_check = FALSE;
   int wc_format = 0;
+  const char *adm_relpath;
 
   /* ### we need more logic for finding the database (if it is located
      ### outside of the wcroot) and then managing all of that within DB.
@@ -459,48 +460,60 @@ svn_wc__db_wcroot_parse_local_abspath(sv
      database in the right place. If we find it... great! If not, then
      peel off some components, and try again. */
 
+  adm_relpath = svn_wc_get_adm_dir(scratch_pool);
   while (TRUE)
     {
       svn_error_t *err;
+      svn_node_kind_t adm_subdir_kind;
 
-      /* We always open the database in read/write mode.  If the database
-         isn't writable in the filesystem, SQLite will internally open
-         it as read-only, and we'll get an error if we try to do a write
-         operation.
-
-         We could decide what to do on a per-operation basis, but since
-         we're caching database handles, it make sense to be as permissive
-         as the filesystem allows. */
-      err = svn_wc__db_util_open_db(&sdb, local_abspath, SDB_FILE,
-                                    svn_sqlite__mode_readwrite, NULL,
-                                    db->state_pool, scratch_pool);
-      if (err == NULL)
+      const char *adm_subdir = svn_dirent_join(local_abspath, adm_relpath,
+                                               scratch_pool);
+
+      SVN_ERR(svn_io_check_path(adm_subdir, &adm_subdir_kind, scratch_pool));
+
+      if (adm_subdir_kind == svn_node_dir)
         {
+          /* We always open the database in read/write mode.  If the database
+             isn't writable in the filesystem, SQLite will internally open
+             it as read-only, and we'll get an error if we try to do a write
+             operation.
+
+             We could decide what to do on a per-operation basis, but since
+             we're caching database handles, it make sense to be as permissive
+             as the filesystem allows. */
+          err = svn_wc__db_util_open_db(&sdb, local_abspath, SDB_FILE,
+                                        svn_sqlite__mode_readwrite, NULL,
+                                        db->state_pool, scratch_pool);
+          if (err == NULL)
+            {
 #ifdef SVN_DEBUG
-          /* Install self-verification trigger statements. */
-          SVN_ERR(svn_sqlite__exec_statements(sdb, STMT_VERIFICATION_TRIGGERS));
+              /* Install self-verification trigger statements. */
+              SVN_ERR(svn_sqlite__exec_statements(sdb,
+                                                  STMT_VERIFICATION_TRIGGERS));
 #endif
-          break;
-        }
-      if (err->apr_err != SVN_ERR_SQLITE_ERROR
-          && !APR_STATUS_IS_ENOENT(err->apr_err))
-        return svn_error_trace(err);
-      svn_error_clear(err);
-
-      /* If we have not moved upwards, then check for a wc-1 working copy.
-         Since wc-1 has a .svn in every directory, and we didn't find one
-         in the original directory, then we aren't looking at a wc-1.
-
-         If the original path is not present, then we have to check on every
-         iteration. The content may be the immediate parent, or possibly
-         five ancetors higher. We don't test for directory presence (just
-         for the presence of subdirs/files), so we don't know when we can
-         stop checking ... so just check always.  */
-      if (!moved_upwards || always_check)
-        {
-          SVN_ERR(get_old_version(&wc_format, local_abspath, scratch_pool));
-          if (wc_format != 0)
-            break;
+              break;
+            }
+          if (err->apr_err != SVN_ERR_SQLITE_ERROR
+              && !APR_STATUS_IS_ENOENT(err->apr_err))
+            return svn_error_trace(err);
+          svn_error_clear(err);
+
+          /* If we have not moved upwards, then check for a wc-1 working copy.
+             Since wc-1 has a .svn in every directory, and we didn't find one
+             in the original directory, then we aren't looking at a wc-1.
+
+             If the original path is not present, then we have to check on every
+             iteration. The content may be the immediate parent, or possibly
+             five ancetors higher. We don't test for directory presence (just
+             for the presence of subdirs/files), so we don't know when we can
+             stop checking ... so just check always.  */
+          if (!moved_upwards || always_check)
+            {
+              SVN_ERR(get_old_version(&wc_format, local_abspath,
+                                      scratch_pool));
+              if (wc_format != 0)
+                break;
+            }
         }
 
       /* We couldn't open the SDB within the specified directory, so

Modified: subversion/branches/ev2-export/subversion/tests/cmdline/stat_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/tests/cmdline/stat_tests.py?rev=1341011&r1=1341010&r2=1341011&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/tests/cmdline/stat_tests.py (original)
+++ subversion/branches/ev2-export/subversion/tests/cmdline/stat_tests.py Mon May 21 13:31:24 2012
@@ -993,8 +993,8 @@ def status_unversioned_dir(sbox):
   dir = sbox.wc_dir
   svntest.main.safe_rmtree(sbox.wc_dir)
   os.mkdir(dir)
-  expected_err = "svn: warning: W155007: '.*(/|\\\\)" + os.path.basename(dir) + \
-                 "' is not a working copy"
+  expected_err = "svn: warning: (W155007|W155010): '.*(/|\\\\)" \
+                                        + os.path.basename(dir) + "'"
   svntest.actions.run_and_verify_svn2(None, [], expected_err, 0,
                                       "status", dir, dir)
 

Modified: subversion/branches/ev2-export/tools/dev/benchmarks/large_dirs/create_bigdir.sh
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/tools/dev/benchmarks/large_dirs/create_bigdir.sh?rev=1341011&r1=1341010&r2=1341011&view=diff
==============================================================================
--- subversion/branches/ev2-export/tools/dev/benchmarks/large_dirs/create_bigdir.sh (original)
+++ subversion/branches/ev2-export/tools/dev/benchmarks/large_dirs/create_bigdir.sh Mon May 21 13:31:24 2012
@@ -124,6 +124,20 @@ run_svn_del() {
   fi
 }
 
+run_svn_del_many() {
+  printf "\n" > files.lst
+  sequence=`get_sequence 2 ${1}`
+  for i in $sequence; do
+    printf "$WC/${1}_c/$i\n" >> files.lst
+  done
+
+  if [ "${VALGRIND}" = "" ] ; then
+    time ${SVN} del -q --targets files.lst > /dev/null
+  else
+    ${VALGRIND} ${VG_OUTFILE}="${VG_TOOL}.out.del_many.$1" ${SVN} del -q --targets files.lst > /dev/null
+  fi
+}
+
 run_svn_ci() {
   if [ "${VALGRIND}" = "" ] ; then
     time ${SVN} ci $WC/$1 -m "" -q > /dev/null
@@ -185,12 +199,13 @@ while [ $FILECOUNT -lt $MAXCOUNT ]; do
   run_svn_del ${FILECOUNT} 1
 
   printf "\tDeleting files ... \t"
-  time sh -c "
-  for i in $sequence; do
-    ${SVN} del $WC/${FILECOUNT}_c/\$i -q
-  done "
+  if [ "$FILECOUNT" == "1" ] ; then
+    printf " skipped (0 files to delete)\n"
+  else
+    run_svn_del_many ${FILECOUNT}
+  fi
 
-  printf "\tCommit deletions ...\t"
+  printf "\tCommit deletions ..\t"
   run_svn_ci ${FILECOUNT}_c del
 
   rm -rf $WC