Index: subversion/include/svn_wc.h
===================================================================
--- subversion/include/svn_wc.h	(revision 38741)
+++ subversion/include/svn_wc.h	(arbetskopia)
@@ -2662,8 +2662,7 @@
 /** Parse the `entries' file for @a adm_access and return a hash @a entries,
  * whose keys are (<tt>const char *</tt>) entry names and values are
  * (<tt>svn_wc_entry_t *</tt>).  The hash @a entries, and its keys and
- * values, are allocated from the pool used to open the @a adm_access
- * baton (that's how the entries caching works).  @a pool is used for
+ * values, are allocated from @a result_pool.  @a scratch_pool is used for
  * transient allocations.
  *
  * Entries that are in a 'excluded', 'deleted' or 'absent' state (and not
@@ -2690,7 +2689,20 @@
  * routine to open its @a path and read the @c SVN_WC_ENTRY_THIS_DIR
  * structure, or call svn_wc_entry() on its @a path.
  */
+
 svn_error_t *
+svn_wc_entries_read2(apr_hash_t **entries,
+                     svn_wc_context_t *wc_ctx,
+                     const char *local_abspath,
+                     svn_boolean_t show_hidden,
+                     apr_pool_t *result_pool,
+                     apr_pool_t *scratch_pool);
+
+/** Similar to svn_wc_entries_read2 but allocates the result_pool from @a
+ * adm_access and uses the entries cache in adm_access. 
+ * */
+SVN_DEPRECATED
+svn_error_t *
 svn_wc_entries_read(apr_hash_t **entries,
                     svn_wc_adm_access_t *adm_access,
                     svn_boolean_t show_hidden,
Index: subversion/libsvn_wc/deprecated.c
===================================================================
--- subversion/libsvn_wc/deprecated.c	(revision 38741)
+++ subversion/libsvn_wc/deprecated.c	(arbetskopia)
@@ -35,6 +35,7 @@
 #include "wc.h"
 #include "lock.h"
 #include "props.h"
+#include "entries.h"
 
 #include "svn_private_config.h"
 
@@ -1392,7 +1393,106 @@
 }
 
 /*** From entries.c ***/
+
+/* Prune the deleted entries from the cached entries in ADM_ACCESS, and
+   return that collection in *ENTRIES_PRUNED.  SCRATCH_POOL is used for local,
+   short term, memory allocation, RESULT_POOL for permanent stuff.  */
+static svn_error_t *
+prune_deleted(apr_hash_t **entries_pruned,
+              apr_hash_t *entries_all,
+              apr_pool_t *result_pool,
+              apr_pool_t *scratch_pool)
+{
+  apr_hash_index_t *hi;
+
+  if (!entries_all)
+    {
+      *entries_pruned = NULL;
+      return SVN_NO_ERROR;
+    }
+
+  /* I think it will be common for there to be no deleted entries, so
+     it is worth checking for that case as we can optimise it. */
+  for (hi = apr_hash_first(scratch_pool, entries_all);
+       hi;
+       hi = apr_hash_next(hi))
+    {
+      void *val;
+      svn_boolean_t hidden;
+
+      apr_hash_this(hi, NULL, NULL, &val);
+      SVN_ERR(svn_wc__entry_is_hidden(&hidden, val));
+      if (hidden)
+        break;
+    }
+
+  if (! hi)
+    {
+      /* There are no deleted entries, so we can use the full hash */
+      *entries_pruned = entries_all;
+      return SVN_NO_ERROR;
+    }
+
+  /* Construct pruned hash without deleted entries */
+  *entries_pruned = apr_hash_make(result_pool);
+  for (hi = apr_hash_first(scratch_pool, entries_all);
+       hi;
+       hi = apr_hash_next(hi))
+    {
+      void *val;
+      const void *key;
+      const svn_wc_entry_t *entry;
+      svn_boolean_t hidden;
+
+      apr_hash_this(hi, &key, NULL, &val);
+      entry = val;
+      SVN_ERR(svn_wc__entry_is_hidden(&hidden, entry));
+      if (!hidden)
+        {
+          apr_hash_set(*entries_pruned, key, APR_HASH_KEY_STRING, entry);
+        }
+    }
+
+  return SVN_NO_ERROR;
+}
+
 svn_error_t *
+svn_wc_entries_read(apr_hash_t **entries,
+                    svn_wc_adm_access_t *adm_access,
+                    svn_boolean_t show_hidden,
+                    apr_pool_t *pool)
+{
+  apr_hash_t *new_entries;
+  svn_wc__db_t *db; 
+  svn_wc_context_t *wc_ctx;
+  const char *local_abspath = svn_wc__adm_access_abspath(adm_access);
+  apr_pool_t *result_pool = svn_wc_adm_access_pool(adm_access);
+
+  new_entries = svn_wc__adm_access_entries(adm_access);
+
+  SVN_ERR(svn_wc__context_create_with_db(&wc_ctx, NULL, 
+                                         svn_wc__adm_get_db(adm_access), 
+                                         pool));
+  
+  if (! new_entries)
+    {
+      SVN_ERR(svn_wc_entries_read2(&new_entries, wc_ctx, local_abspath,
+                                   TRUE, result_pool, pool));
+
+      svn_wc__adm_access_set_entries(adm_access, new_entries);
+    }
+
+  if (show_hidden)
+    *entries = new_entries;
+  else
+    SVN_ERR(prune_deleted(entries, new_entries,
+                          svn_wc_adm_access_pool(adm_access),
+                          pool));
+
+  svn_error_return(svn_wc_context_destroy(wc_ctx));
+}
+
+svn_error_t *
 svn_wc_walk_entries2(const char *path,
                      svn_wc_adm_access_t *adm_access,
                      const svn_wc_entry_callbacks_t *walk_callbacks,
Index: subversion/libsvn_wc/entries.c
===================================================================
--- subversion/libsvn_wc/entries.c	(revision 38741)
+++ subversion/libsvn_wc/entries.c	(arbetskopia)
@@ -1512,36 +1512,28 @@
 }
 
 svn_error_t *
-svn_wc_entries_read(apr_hash_t **entries,
-                    svn_wc_adm_access_t *adm_access,
-                    svn_boolean_t show_hidden,
-                    apr_pool_t *pool)
+svn_wc_entries_read2(apr_hash_t **entries,
+                     svn_wc_context_t *wc_ctx,
+                     const char *local_abspath,
+                     svn_boolean_t show_hidden,
+                     apr_pool_t *result_pool,
+                     apr_pool_t *scratch_pool)
 {
-  apr_hash_t *new_entries;
+  svn_wc__db_t *db = wc_ctx->db;
 
-  new_entries = svn_wc__adm_access_entries(adm_access);
-  if (! new_entries)
-    {
-      svn_wc__db_t *db = svn_wc__adm_get_db(adm_access);
-      const char *local_abspath = svn_wc__adm_access_abspath(adm_access);
-      apr_pool_t *result_pool = svn_wc_adm_access_pool(adm_access);
+  SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
 
-      SVN_ERR(read_entries(&new_entries, db, local_abspath,
-                           result_pool, pool));
-      svn_wc__adm_access_set_entries(adm_access, new_entries);
-    }
+  SVN_ERR(read_entries(entries, db, local_abspath,
+                       result_pool, scratch_pool));
 
-  if (show_hidden)
-    *entries = new_entries;
-  else
-    SVN_ERR(prune_deleted(entries, new_entries,
-                          svn_wc_adm_access_pool(adm_access),
-                          pool));
+  if (! show_hidden)
+    SVN_ERR(prune_deleted(entries, *entries,
+                          result_pool,
+                          scratch_pool));
 
   return SVN_NO_ERROR;
 }
 
-
 svn_error_t *
 svn_wc__set_depth(svn_wc__db_t *db,
                   const char *local_dir_abspath,
