You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2013/02/26 18:04:32 UTC

svn commit: r1450279 - in /subversion/trunk/subversion: include/ include/private/ libsvn_client/

Author: rhuijben
Date: Tue Feb 26 17:04:31 2013
New Revision: 1450279

URL: http://svn.apache.org/r1450279
Log:
Rev the standard libsvn_client api used for opening ra sessions, to allow
access to the libsvn_wc pristine store in many more cases. This allows serf
to obtain texts from the local working copy in many cases where it first
couldn't.

For just merge_tests.py this patch makes libsvn_ra_serf avoid more than 550
http requests.

* subversion/include/private/svn_client_private.h
  (svn_client__ra_session_from_path2): Update documentation.

* subversion/include/svn_client.h
  (svn_client_open_ra_session2): New function.
  (svn_client_open_ra_session): Deprecate function.

* subversion/libsvn_client/add.c
  (mkdir_urls): Update caller.

* subversion/libsvn_client/client.h
  (svn_client__open_ra_session_internal): Change some arguments. Update
    documentation. Add scratch_pool.

* subversion/libsvn_client/commit.c
  (check_url_kind): Update caller.

* subversion/libsvn_client/copy.c
  (repos_to_repos_copy): Update caller.

  (wc_to_repos_copy): Use session pool to avoid opening two sessions at the
    same time. Remove unneeded wait for timestamps, as we do a repository only
    commit here.
  (repos_to_wc_copy): Update caller.

* subversion/libsvn_client/delete.c
  (delete_urls_multi_repos): Update caller.

* subversion/libsvn_client/deprecated.c
  (svn_client_open_ra_session): New function.
  (svn_client_uuid_from_url): Wrap svn_client_get_repos_root, but with a
    subpool to avoid keeping ra sessions open in functions without dual pools.

  (svn_client_root_url_from_path): Use session pool, as there is no result_pool.

* subversion/libsvn_client/diff.c
  (diff_prepare_repos_repos,
   diff_repos_repos): Obtain wri_abspath and use it when opening ra
    session.
  (diff_repos_wc,
   diff_summarize_repos_repos): Update caller.

* subversion/libsvn_client/import.c
  (svn_client_import5): Update caller.

* subversion/libsvn_client/iprops.c
  (get_inheritable_props): Update caller.

* subversion/libsvn_client/list.c
  (svn_client__ra_stat_compatible): Update caller.

* subversion/libsvn_client/locking_commands.c
  (svn_client_lock,
   svn_client_unlock): Update caller.

* subversion/libsvn_client/merge.c
  (ensure_ra_session_url): Pass wri_abspath to speed up merging.
  (open_reintegrate_source_and_target,
   svn_client_find_automatic_merge,
   do_automatic_merge_locked): Update caller.

* subversion/libsvn_client/mergeinfo.c
  (svn_client__get_wc_or_repos_mergeinfo_catalog): Update caller.

* subversion/libsvn_client/prop_commands.c
  (propset_on_url,
   svn_client_revprop_set2): Update caller.

  (svn_client_revprop_get,
   svn_client_revprop_list): Update caller. Introduce subpool for function
     without result_pool argument.

* subversion/libsvn_client/ra.c
  (callback_baton_t): Add wcroot_abspath argument to make looking this up
    from the ra call a hashtable lookup.
  (get_wc_contents): Use wcroot_abspath.
  (svn_client__open_ra_session_internal): Separate wri_abspath and base
    abspath handling. Use scratch_pool where possible.
  (svn_client_open_ra_session): Rename to ...
  (svn_client_open_ra_session2): ... this and update caller.
  (svn_client__ra_session_from_path2): Update caller.
  (svn_client__repos_locations): Update caller.
  (svn_client__get_youngest_common_ancestor): Update caller.

* subversion/libsvn_client/status.c
  (reporter_finish_report,
   svn_client_status5): Update caller.

* subversion/libsvn_client/update.c
  (update_internal): Update caller.

* subversion/libsvn_client/util.c
  (svn_client_get_repos_root): Update caller.

Modified:
    subversion/trunk/subversion/include/private/svn_client_private.h
    subversion/trunk/subversion/include/svn_client.h
    subversion/trunk/subversion/libsvn_client/add.c
    subversion/trunk/subversion/libsvn_client/client.h
    subversion/trunk/subversion/libsvn_client/commit.c
    subversion/trunk/subversion/libsvn_client/copy.c
    subversion/trunk/subversion/libsvn_client/delete.c
    subversion/trunk/subversion/libsvn_client/deprecated.c
    subversion/trunk/subversion/libsvn_client/diff.c
    subversion/trunk/subversion/libsvn_client/import.c
    subversion/trunk/subversion/libsvn_client/iprops.c
    subversion/trunk/subversion/libsvn_client/list.c
    subversion/trunk/subversion/libsvn_client/locking_commands.c
    subversion/trunk/subversion/libsvn_client/merge.c
    subversion/trunk/subversion/libsvn_client/mergeinfo.c
    subversion/trunk/subversion/libsvn_client/prop_commands.c
    subversion/trunk/subversion/libsvn_client/ra.c
    subversion/trunk/subversion/libsvn_client/status.c
    subversion/trunk/subversion/libsvn_client/update.c
    subversion/trunk/subversion/libsvn_client/util.c

Modified: subversion/trunk/subversion/include/private/svn_client_private.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_client_private.h?rev=1450279&r1=1450278&r2=1450279&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_client_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_client_private.h Tue Feb 26 17:04:31 2013
@@ -121,9 +121,9 @@ svn_client__pathrev_fspath(const svn_cli
    that it is the same node in both PEG_REVISION and REVISION.  If it
    is not, then @c SVN_ERR_CLIENT_UNRELATED_RESOURCES is returned.
 
-   BASE_DIR_ABSPATH is the working copy path the ra_session corresponds to,
-   and should only be used if PATH_OR_URL is a url
-     ### else NULL? what's it for?
+   BASE_DIR_ABSPATH is the working copy path the ra_session corresponds
+   to. If provided it will be used to read and dav props. So if provided
+   this directory MUST match the session anchor.
 
    If PEG_REVISION->kind is 'unspecified', the peg revision is 'head'
    for a URL or 'working' for a WC path.  If REVISION->kind is

Modified: subversion/trunk/subversion/include/svn_client.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_client.h?rev=1450279&r1=1450278&r2=1450279&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_client.h (original)
+++ subversion/trunk/subversion/include/svn_client.h Tue Feb 26 17:04:31 2013
@@ -6486,13 +6486,30 @@ svn_client_uuid_from_path(const char **u
 /** Open an RA session rooted at @a url, and return it in @a *session.
  *
  * Use the authentication baton stored in @a ctx for authentication.
- * @a *session is allocated in @a pool.
+ * @a *session is allocated in @a result_pool.
  *
- * @since New in 1.3.
+ * If @a wri_abspath is not NULL, use the working copy identified by @a
+ * wri_abspath to potentially avoid transferring unneeded data.
  *
  * @note This function is similar to svn_ra_open3(), but the caller avoids
  * having to providing its own callback functions.
+ * @since New in 1.8.
+ */
+svn_error_t *
+svn_client_open_ra_session2(svn_ra_session_t **session,
+                           const char *url,
+                           const char *wri_abspath,
+                           svn_client_ctx_t *ctx,
+                           apr_pool_t *result_pool,
+                           apr_pool_t *scratch_pool);
+
+/** Similar to svn_client_open_ra_session(), but doesn't allow passing a
+ * working copy path.
+ *
+ * @since New in 1.3.
+ * @deprecated Provided for backward compatibility with the 1.7 API.
  */
+SVN_DEPRECATED
 svn_error_t *
 svn_client_open_ra_session(svn_ra_session_t **session,
                            const char *url,

Modified: subversion/trunk/subversion/libsvn_client/add.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/add.c?rev=1450279&r1=1450278&r2=1450279&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/add.c (original)
+++ subversion/trunk/subversion/libsvn_client/add.c Tue Feb 26 17:04:31 2013
@@ -1182,9 +1182,8 @@ mkdir_urls(const apr_array_header_t *url
       const char *first_url = APR_ARRAY_IDX(urls, 0, const char *);
       apr_pool_t *iterpool = svn_pool_create(pool);
 
-      SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL,
-                                                   first_url, NULL, NULL,
-                                                   FALSE, TRUE, ctx, pool));
+      SVN_ERR(svn_client_open_ra_session2(&ra_session, first_url, NULL,
+                                          ctx, pool, iterpool));
 
       for (i = 0; i < urls->nelts; i++)
         {
@@ -1294,9 +1293,11 @@ mkdir_urls(const apr_array_header_t *url
   /* Open an RA session for the URL. Note that we don't have a local
      directory, nor a place to put temp files. */
   if (!ra_session)
-    SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL, common,
-                                                 NULL, NULL, FALSE, TRUE,
-                                                 ctx, pool));
+    SVN_ERR(svn_client_open_ra_session2(&ra_session, common, NULL, ctx,
+                                        pool, pool));
+  else
+    SVN_ERR(svn_ra_reparent(ra_session, common, pool));
+
 
   /* Fetch RA commit editor */
   SVN_ERR(svn_ra__register_editor_shim_callbacks(ra_session,

Modified: subversion/trunk/subversion/libsvn_client/client.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/client.h?rev=1450279&r1=1450278&r2=1450279&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/client.h (original)
+++ subversion/trunk/subversion/libsvn_client/client.h Tue Feb 26 17:04:31 2013
@@ -265,15 +265,18 @@ svn_client__ensure_ra_session_url(const 
       - COMMIT_ITEMS is an array of svn_client_commit_item_t *
         structures, present only for working copy commits, NULL otherwise.
 
-      - USE_ADMIN indicates that the RA layer should create tempfiles
-        in the administrative area instead of in the working copy itself,
-        and read properties from the administrative area.
+      - WRITE_DAV_PROPS indicates that the RA layer can clear and write
+        the DAV properties in the working copy of BASE_DIR_ABSPATH.
 
-      - READ_ONLY_WC indicates that the RA layer should not attempt to
-        modify the WC props directly.
+      - READ_DAV_PROPS indicates that the RA layer should not attempt to
+        modify the WC props directly, but is still allowed to read them.
 
    BASE_DIR_ABSPATH may be NULL if the RA operation does not correspond to a
-   working copy (in which case, USE_ADMIN should be FALSE).
+   working copy (in which case, WRITE_DAV_PROPS and READ_DAV_PROPS must be
+   FALSE.
+
+   If WRITE_DAV_PROPS and READ_DAV_PROPS are both FALSE the working copy may
+   still be used for locating pristine files via their SHA1.
 
    The calling application's authentication baton is provided in CTX,
    and allocations related to this session are performed in POOL.
@@ -286,10 +289,11 @@ svn_client__open_ra_session_internal(svn
                                      const char *base_url,
                                      const char *base_dir_abspath,
                                      const apr_array_header_t *commit_items,
-                                     svn_boolean_t use_admin,
-                                     svn_boolean_t read_only_wc,
+                                     svn_boolean_t write_dav_props,
+                                     svn_boolean_t read_dav_props,
                                      svn_client_ctx_t *ctx,
-                                     apr_pool_t *pool);
+                                     apr_pool_t *result_pool,
+                                     apr_pool_t *scratch_pool);
 
 
 svn_error_t *

Modified: subversion/trunk/subversion/libsvn_client/commit.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/commit.c?rev=1450279&r1=1450278&r2=1450279&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/commit.c (original)
+++ subversion/trunk/subversion/libsvn_client/commit.c Tue Feb 26 17:04:31 2013
@@ -457,8 +457,8 @@ check_url_kind(void *baton,
   /* If we don't have a session or can't use the session, get one */
   if (!cukb->session || !svn_uri__is_ancestor(cukb->repos_root_url, url))
     {
-      SVN_ERR(svn_client_open_ra_session(&cukb->session, url, cukb->ctx,
-                                         cukb->pool));
+      SVN_ERR(svn_client_open_ra_session2(&cukb->session, url, NULL, cukb->ctx,
+                                          cukb->pool, scratch_pool));
       SVN_ERR(svn_ra_get_repos_root2(cukb->session, &cukb->repos_root_url,
                                      cukb->pool));
     }
@@ -925,7 +925,8 @@ svn_client_commit6(const apr_array_heade
                                                                  0,
                                                                  const char *),
                                                    commit_items,
-                                                   TRUE, FALSE, ctx, pool));
+                                                   TRUE, TRUE, ctx,
+                                                   pool, pool));
 
   if (cmt_err)
     goto cleanup;

Modified: subversion/trunk/subversion/libsvn_client/copy.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/copy.c?rev=1450279&r1=1450278&r2=1450279&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/copy.c (original)
+++ subversion/trunk/subversion/libsvn_client/copy.c Tue Feb 26 17:04:31 2013
@@ -797,10 +797,9 @@ repos_to_repos_copy(const apr_array_head
      be verifying that every one of our copy source and destination
      URLs is or is beneath this sucker's repository root URL as a form
      of a cheap(ish) sanity check.  */
-  SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL,
-                                               first_pair->src_abspath_or_url,
-                                               NULL, NULL, FALSE, TRUE,
-                                               ctx, pool));
+  SVN_ERR(svn_client_open_ra_session2(&ra_session,
+                                      first_pair->src_abspath_or_url, NULL,
+                                      ctx, pool, pool));
   SVN_ERR(svn_ra_get_repos_root2(ra_session, &repos_root, pool));
 
   /* Verify that sources and destinations are all at or under
@@ -1214,8 +1213,9 @@ wc_to_repos_copy(const apr_array_header_
                  svn_commit_callback2_t commit_callback,
                  void *commit_baton,
                  svn_client_ctx_t *ctx,
-                 apr_pool_t *pool)
+                 apr_pool_t *scratch_pool)
 {
+  apr_pool_t *pool = scratch_pool;
   const char *message;
   const char *top_src_path, *top_dst_url;
   struct check_url_kind_baton cukb;
@@ -1230,6 +1230,7 @@ wc_to_repos_copy(const apr_array_header_
   apr_array_header_t *new_dirs = NULL;
   apr_hash_t *commit_revprops;
   svn_client__copy_pair_t *first_pair;
+  apr_pool_t *session_pool = svn_pool_create(scratch_pool);
   int i;
 
   /* Find the common root of all the source paths */
@@ -1262,16 +1263,22 @@ wc_to_repos_copy(const apr_array_header_
     }
 
   SVN_ERR(svn_dirent_get_absolute(&top_src_abspath, top_src_path, pool));
+
+  /* Open a session to help while determining the exact targets */
   SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL, top_dst_url,
-                                               top_src_abspath, NULL, TRUE,
-                                               TRUE, ctx, pool));
+                                               top_src_abspath, NULL,
+                                               FALSE /* write_dav_props */,
+                                               TRUE /* read_dav_props */,
+                                               ctx,
+                                               session_pool, scratch_pool));
 
   /* If requested, determine the nearest existing parent of the destination,
      and reparent the ra session there. */
   if (make_parents)
     {
       new_dirs = apr_array_make(pool, 0, sizeof(const char *));
-      SVN_ERR(find_absent_parents2(ra_session, &top_dst_url, new_dirs, pool));
+      SVN_ERR(find_absent_parents2(ra_session, &top_dst_url, new_dirs,
+                                   scratch_pool));
     }
 
   /* Figure out the basename that will result from each copy and check to make
@@ -1466,10 +1473,14 @@ wc_to_repos_copy(const apr_array_header_
     }
 #endif
 
-  /* Open an RA session to DST_URL. */
+  /* Close the initial session, to reopen a new session with commit handling */
+  svn_pool_clear(session_pool);
+
+  /* Open a new RA session to DST_URL. */
   SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL, top_dst_url,
                                                NULL, commit_items,
-                                               FALSE, FALSE, ctx, pool));
+                                               FALSE, FALSE, ctx,
+                                               session_pool, scratch_pool));
 
   /* Fetch RA commit editor. */
   SVN_ERR(svn_ra__register_editor_shim_callbacks(ra_session,
@@ -1489,10 +1500,8 @@ wc_to_repos_copy(const apr_array_header_
                                   NULL, ctx, pool, pool),
             _("Commit failed (details follow):"));
 
-  /* Sleep to ensure timestamp integrity. */
-  svn_io_sleep_for_timestamps(top_src_path, pool);
-
   svn_pool_destroy(iterpool);
+  svn_pool_destroy(session_pool);
 
   return SVN_NO_ERROR;
 }
@@ -1813,9 +1822,8 @@ repos_to_wc_copy(const apr_array_header_
   /* Open a repository session to the longest common src ancestor.  We do not
      (yet) have a working copy, so we don't have a corresponding path and
      tempfiles cannot go into the admin area. */
-  SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL, top_src_url,
-                                               NULL, NULL, FALSE, TRUE,
-                                               ctx, pool));
+  SVN_ERR(svn_client_open_ra_session2(&ra_session, top_src_url, lock_abspath,
+                                      ctx, pool, pool));
 
   /* Get the correct src path for the peg revision used, and verify that we
      aren't overwriting an existing path. */

Modified: subversion/trunk/subversion/libsvn_client/delete.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/delete.c?rev=1450279&r1=1450278&r2=1450279&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/delete.c (original)
+++ subversion/trunk/subversion/libsvn_client/delete.c Tue Feb 26 17:04:31 2013
@@ -295,9 +295,8 @@ delete_urls_multi_repos(const apr_array_
           /* If we haven't found a session yet, we need to open one up.
              Note that we don't have a local directory, nor a place
              to put temp files. */
-          SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL, uri,
-                                                       NULL, NULL, FALSE,
-                                                       TRUE, ctx, pool));
+          SVN_ERR(svn_client_open_ra_session2(&ra_session, uri, NULL,
+                                              ctx, pool, pool));
           SVN_ERR(svn_ra_get_repos_root2(ra_session, &repos_root, pool));
           SVN_ERR(svn_ra_reparent(ra_session, repos_root, pool));
 

Modified: subversion/trunk/subversion/libsvn_client/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/deprecated.c?rev=1450279&r1=1450278&r2=1450279&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/deprecated.c (original)
+++ subversion/trunk/subversion/libsvn_client/deprecated.c Tue Feb 26 17:04:31 2013
@@ -2757,26 +2757,32 @@ svn_client_revert(const apr_array_header
 
 /*** From ra.c ***/
 svn_error_t *
+svn_client_open_ra_session(svn_ra_session_t **session,
+                           const char *url,
+                           svn_client_ctx_t *ctx,
+                           apr_pool_t *pool)
+{
+  return svn_error_trace(
+             svn_client_open_ra_session2(session, url,
+                                         NULL, ctx,
+                                         pool, pool));
+}
+
+svn_error_t *
 svn_client_uuid_from_url(const char **uuid,
                          const char *url,
                          svn_client_ctx_t *ctx,
                          apr_pool_t *pool)
 {
-  svn_ra_session_t *ra_session;
+  svn_error_t *err;
   apr_pool_t *subpool = svn_pool_create(pool);
 
-  /* use subpool to create a temporary RA session */
-  SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL, url,
-                                               NULL, /* no base dir */
-                                               NULL, FALSE, TRUE,
-                                               ctx, subpool));
-
-  SVN_ERR(svn_ra_get_uuid2(ra_session, uuid, pool));
-
+  err = svn_client_get_repos_root(NULL, uuid, url,
+                                  ctx, pool, subpool);
   /* destroy the RA session */
   svn_pool_destroy(subpool);
 
-  return SVN_NO_ERROR;
+  return svn_error_trace(err);;
 }
 
 svn_error_t *
@@ -2813,12 +2819,17 @@ svn_client_root_url_from_path(const char
                               svn_client_ctx_t *ctx,
                               apr_pool_t *pool)
 {
+  apr_pool_t *subpool = svn_pool_create(pool);
+  svn_error_t *err;
   if (!svn_path_is_url(path_or_url))
     SVN_ERR(svn_dirent_get_absolute(&path_or_url, path_or_url, pool));
 
-  return svn_error_trace(
-           svn_client_get_repos_root(url, NULL, path_or_url,
-                                     ctx, pool, pool));
+  err = svn_client_get_repos_root(url, NULL, path_or_url,
+                                  ctx, pool, subpool);
+
+  /* close ra session */
+  svn_pool_destroy(subpool);
+  return svn_error_trace(err);
 }
 
 svn_error_t *
@@ -2951,3 +2962,4 @@ svn_client_commit_item2_dup(const svn_cl
 
   return new_item;
 }
+

Modified: subversion/trunk/subversion/libsvn_client/diff.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/diff.c?rev=1450279&r1=1450278&r2=1450279&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/diff.c (original)
+++ subversion/trunk/subversion/libsvn_client/diff.c Tue Feb 26 17:04:31 2013
@@ -1387,12 +1387,14 @@ diff_prepare_repos_repos(const char **ur
   const char *abspath_or_url2;
   const char *abspath_or_url1;
   const char *repos_root_url;
+  const char *wri_abspath = NULL;
 
   if (!svn_path_is_url(path_or_url2))
     {
       SVN_ERR(svn_dirent_get_absolute(&abspath_or_url2, path_or_url2, pool));
       SVN_ERR(svn_wc__node_get_url(url2, ctx->wc_ctx, abspath_or_url2,
                                    pool, pool));
+      wri_abspath = abspath_or_url2;
     }
   else
     *url2 = abspath_or_url2 = apr_pstrdup(pool, path_or_url2);
@@ -1402,6 +1404,7 @@ diff_prepare_repos_repos(const char **ur
       SVN_ERR(svn_dirent_get_absolute(&abspath_or_url1, path_or_url1, pool));
       SVN_ERR(svn_wc__node_get_url(url1, ctx->wc_ctx, abspath_or_url1,
                                    pool, pool));
+      wri_abspath = abspath_or_url1;
     }
   else
     *url1 = abspath_or_url1 = apr_pstrdup(pool, path_or_url1);
@@ -1415,9 +1418,8 @@ diff_prepare_repos_repos(const char **ur
   if (strcmp(*url2, path_or_url2) != 0)
     *base_path = path_or_url2;
 
-  SVN_ERR(svn_client__open_ra_session_internal(ra_session, NULL, *url2,
-                                               NULL, NULL, FALSE,
-                                               TRUE, ctx, pool));
+  SVN_ERR(svn_client_open_ra_session2(ra_session, *url2, wri_abspath,
+                                      ctx, pool, pool));
 
   /* If we are performing a pegged diff, we need to find out what our
      actual URLs will be. */
@@ -1683,6 +1685,7 @@ diff_repos_repos(const svn_wc_diff_callb
   const char *target1;
   const char *target2;
   svn_ra_session_t *ra_session;
+  const char *wri_abspath = NULL;
 
   /* Prepare info for the repos repos diff. */
   SVN_ERR(diff_prepare_repos_repos(&url1, &url2, &base_path, &rev1, &rev2,
@@ -1692,6 +1695,12 @@ diff_repos_repos(const svn_wc_diff_callb
                                    revision1, revision2, peg_revision,
                                    pool));
 
+  /* Find a WC path for the ra session */
+  if (!svn_path_is_url(path_or_url1))
+    SVN_ERR(svn_dirent_get_absolute(&wri_abspath, path_or_url1, pool));
+  else if (!svn_path_is_url(path_or_url2))
+    SVN_ERR(svn_dirent_get_absolute(&wri_abspath, path_or_url2, pool));
+
   /* Set up the repos_diff editor on BASE_PATH, if available.
      Otherwise, we just use "". */
 
@@ -1749,9 +1758,8 @@ diff_repos_repos(const svn_wc_diff_callb
   /* Now, we open an extra RA session to the correct anchor
      location for URL1.  This is used during the editor calls to fetch file
      contents.  */
-  SVN_ERR(svn_client__open_ra_session_internal(&extra_ra_session, NULL,
-                                               anchor1, NULL, NULL, FALSE,
-                                               TRUE, ctx, pool));
+  SVN_ERR(svn_client_open_ra_session2(&extra_ra_session, anchor1, wri_abspath,
+                                      ctx, pool, pool));
 
   SVN_ERR(svn_client__get_diff_editor2(
                 &diff_editor, &diff_edit_baton,
@@ -1878,9 +1886,8 @@ diff_repos_wc(const char *path_or_url1,
     }
 
   /* Open an RA session to URL1 to figure out its node kind. */
-  SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL, url1,
-                                               NULL, NULL, FALSE, TRUE,
-                                               ctx, pool));
+  SVN_ERR(svn_client_open_ra_session2(&ra_session, url1, abspath2,
+                                      ctx, pool, pool));
   /* Resolve the revision to use for URL1. */
   SVN_ERR(svn_client__get_revision_number(&rev, NULL, ctx->wc_ctx,
                                           (strcmp(path_or_url1, url1) == 0)
@@ -2306,10 +2313,9 @@ diff_summarize_repos_repos(svn_client_di
     }
 
   /* Now, we open an extra RA session to the correct anchor
-     location for URL1.  This is used to get the kind of deleted paths.  */
-  SVN_ERR(svn_client__open_ra_session_internal(&extra_ra_session, NULL,
-                                               anchor1, NULL, NULL, FALSE,
-                                               TRUE, ctx, pool));
+     location for URL1.  This is used to get deleted path information.  */
+  SVN_ERR(svn_client_open_ra_session2(&extra_ra_session, anchor1, NULL,
+                                      ctx, pool, pool));
 
   SVN_ERR(svn_client__get_diff_editor2(&diff_editor, &diff_edit_baton,
                                        extra_ra_session,

Modified: subversion/trunk/subversion/libsvn_client/import.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/import.c?rev=1450279&r1=1450278&r2=1450279&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/import.c (original)
+++ subversion/trunk/subversion/libsvn_client/import.c Tue Feb 26 17:04:31 2013
@@ -845,9 +845,8 @@ svn_client_import5(const char *path,
 
   SVN_ERR(svn_io_check_path(local_abspath, &kind, scratch_pool));
 
-  SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL, url, NULL,
-                                               NULL, FALSE, TRUE, ctx,
-                                               scratch_pool));
+  SVN_ERR(svn_client_open_ra_session2(&ra_session, url, NULL,
+                                      ctx, scratch_pool, iterpool));
 
   /* Figure out all the path components we need to create just to have
      a place to stick our imported tree. */

Modified: subversion/trunk/subversion/libsvn_client/iprops.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/iprops.c?rev=1450279&r1=1450278&r2=1450279&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/iprops.c (original)
+++ subversion/trunk/subversion/libsvn_client/iprops.c Tue Feb 26 17:04:31 2013
@@ -199,12 +199,9 @@ get_inheritable_props(apr_hash_t **wcroo
               if (! session_pool)
                 session_pool = svn_pool_create(scratch_pool);
 
-              SVN_ERR(svn_client__open_ra_session_internal(&ra_session,
-                                                           NULL, url,
-                                                           NULL, NULL,
-                                                           FALSE, TRUE,
-                                                           ctx,
-                                                           session_pool));
+              SVN_ERR(svn_client_open_ra_session2(&ra_session, url, NULL,
+                                                  ctx,
+                                                  session_pool, iterpool));
             }
 
           err = svn_ra_get_inherited_props(ra_session, &inherited_props,

Modified: subversion/trunk/subversion/libsvn_client/list.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/list.c?rev=1450279&r1=1450278&r2=1450279&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/list.c (original)
+++ subversion/trunk/subversion/libsvn_client/list.c Tue Feb 26 17:04:31 2013
@@ -231,10 +231,9 @@ svn_client__ra_stat_compatible(svn_ra_se
                  doesn't support svn_ra_reparent anyway, so don't try it. */
               svn_uri_split(&parent_url, &base_name, session_url, subpool);
 
-              SVN_ERR(svn_client__open_ra_session_internal(&parent_session,
-                                                           NULL, parent_url,
-                                                           NULL, NULL, FALSE,
-                                                           TRUE, ctx, subpool));
+              SVN_ERR(svn_client_open_ra_session2(&parent_session, parent_url,
+                                                  NULL, ctx,
+                                                  subpool, subpool));
 
               /* Get all parent's entries, no props. */
               SVN_ERR(svn_ra_get_dir2(parent_session, &parent_ents, NULL,

Modified: subversion/trunk/subversion/libsvn_client/locking_commands.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/locking_commands.c?rev=1450279&r1=1450278&r2=1450279&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/locking_commands.c (original)
+++ subversion/trunk/subversion/libsvn_client/locking_commands.c Tue Feb 26 17:04:31 2013
@@ -493,10 +493,8 @@ svn_client_lock(const apr_array_header_t
   /* Open an RA session to the common parent of TARGETS. */
   if (base_dir)
     SVN_ERR(svn_dirent_get_absolute(&base_dir_abspath, base_dir, pool));
-  SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL,
-                                               common_parent_url, base_dir,
-                                               NULL, FALSE, FALSE,
-                                               ctx, pool));
+  SVN_ERR(svn_client_open_ra_session2(&ra_session, common_parent_url,
+                                      base_dir_abspath, ctx, pool, pool));
 
   cb.base_dir_abspath = base_dir_abspath;
   cb.urls_to_paths = urls_to_paths;
@@ -533,10 +531,8 @@ svn_client_unlock(const apr_array_header
   /* Open an RA session. */
   if (base_dir)
     SVN_ERR(svn_dirent_get_absolute(&base_dir_abspath, base_dir, pool));
-  SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL,
-                                               common_parent_url,
-                                               base_dir_abspath, NULL, FALSE,
-                                               FALSE, ctx, pool));
+  SVN_ERR(svn_client_open_ra_session2(&ra_session, common_parent_url,
+                                      base_dir_abspath, ctx, pool, pool));
 
   /* If break_lock is not set, lock tokens are required by the server.
      If the targets were all URLs, ensure that we provide lock tokens,

Modified: subversion/trunk/subversion/libsvn_client/merge.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/merge.c?rev=1450279&r1=1450278&r2=1450279&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/merge.c (original)
+++ subversion/trunk/subversion/libsvn_client/merge.c Tue Feb 26 17:04:31 2013
@@ -9415,6 +9415,7 @@ do_directory_merge(svn_mergeinfo_catalog
 static svn_error_t *
 ensure_ra_session_url(svn_ra_session_t **ra_session,
                       const char *url,
+                      const char *wri_abspath,
                       svn_client_ctx_t *ctx,
                       apr_pool_t *pool)
 {
@@ -9430,7 +9431,8 @@ ensure_ra_session_url(svn_ra_session_t *
   if (! *ra_session || (err && err->apr_err == SVN_ERR_RA_ILLEGAL_URL))
     {
       svn_error_clear(err);
-      err = svn_client_open_ra_session(ra_session, url, ctx, pool);
+      err = svn_client_open_ra_session2(ra_session, url, wri_abspath,
+                                        ctx, pool, pool);
     }
   SVN_ERR(err);
 
@@ -9670,9 +9672,9 @@ do_merge(apr_hash_t **modified_subtrees,
 
       /* Establish RA sessions to our URLs, reuse where possible. */
       SVN_ERR(ensure_ra_session_url(&ra_session1, source->loc1->url,
-                                    ctx, scratch_pool));
+                                    target->abspath, ctx, scratch_pool));
       SVN_ERR(ensure_ra_session_url(&ra_session2, source->loc2->url,
-                                    ctx, scratch_pool));
+                                    target->abspath, ctx, scratch_pool));
 
       /* Populate the portions of the merge context baton that need to
          be reset for each merge source iteration. */
@@ -11375,9 +11377,9 @@ open_reintegrate_source_and_target(svn_r
   SVN_ERR(open_target_wc(&target, target_abspath,
                          FALSE, FALSE, FALSE,
                          ctx, scratch_pool, scratch_pool));
-  SVN_ERR(svn_client_open_ra_session(target_ra_session_p,
-                                     target->loc.url,
-                                     ctx, scratch_pool));
+  SVN_ERR(svn_client_open_ra_session2(target_ra_session_p,
+                                      target->loc.url, target->abspath,
+                                      ctx, result_pool, scratch_pool));
   if (! target->loc.url)
     return svn_error_createf(SVN_ERR_CLIENT_UNRELATED_RESOURCES, NULL,
                              _("Can't reintegrate into '%s' because it is "
@@ -12122,9 +12124,10 @@ svn_client_find_automatic_merge(svn_clie
                          ctx, result_pool, scratch_pool));
 
   /* Open RA sessions to the source and target trees. */
-  SVN_ERR(svn_client_open_ra_session(&s_t->target_ra_session,
-                                     s_t->target->loc.url,
-                                     ctx, result_pool));
+  SVN_ERR(svn_client_open_ra_session2(&s_t->target_ra_session,
+                                      s_t->target->loc.url,
+                                      s_t->target->abspath,
+                                      ctx, result_pool, scratch_pool));
   /* ### check for null URL (i.e. added path) here, like in reintegrate? */
   SVN_ERR(svn_client__ra_session_from_path2(
             &s_t->source_ra_session, &s_t->source,
@@ -12229,11 +12232,11 @@ do_automatic_merge_locked(conflict_repor
                                   "cannot be used with this kind of merge"));
 
       SVN_ERR(ensure_ra_session_url(&base_ra_session, merge->base->url,
-                                    ctx, scratch_pool));
+                                    target->abspath, ctx, scratch_pool));
       SVN_ERR(ensure_ra_session_url(&right_ra_session, merge->right->url,
-                                    ctx, scratch_pool));
+                                    target->abspath, ctx, scratch_pool));
       SVN_ERR(ensure_ra_session_url(&target_ra_session, target->loc.url,
-                                    ctx, scratch_pool));
+                                    target->abspath, ctx, scratch_pool));
 
       /* Check for and reject any abnormalities -- such as revisions that
        * have not yet been merged in the opposite direction -- that a
@@ -12283,7 +12286,7 @@ do_automatic_merge_locked(conflict_repor
       /* Normalize our merge sources, do_merge() requires this.  See the
          'MERGEINFO MERGE SOURCE NORMALIZATION' global comment. */
       SVN_ERR(ensure_ra_session_url(&ra_session, merge->right->url,
-                                    ctx, scratch_pool));
+                                    target->abspath, ctx, scratch_pool));
       SVN_ERR(normalize_merge_sources_internal(
         &merge_sources, merge->right,
         svn_rangelist__initialize(merge->yca->rev, merge->right->rev, TRUE,

Modified: subversion/trunk/subversion/libsvn_client/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/mergeinfo.c?rev=1450279&r1=1450278&r2=1450279&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/mergeinfo.c (original)
+++ subversion/trunk/subversion/libsvn_client/mergeinfo.c Tue Feb 26 17:04:31 2013
@@ -685,9 +685,9 @@ svn_client__get_wc_or_repos_mergeinfo_ca
               if (! ra_session)
                 {
                   sesspool = svn_pool_create(scratch_pool);
-                  SVN_ERR(svn_client__open_ra_session_internal(
-                              &ra_session, NULL, url, NULL, NULL, FALSE,
-                              TRUE, ctx, sesspool));
+                  SVN_ERR(svn_client_open_ra_session2(&ra_session, url, NULL,
+                                                      ctx,
+                                                      sesspool, sesspool));
                 }
 
               SVN_ERR(svn_client__get_repos_mergeinfo_catalog(

Modified: subversion/trunk/subversion/libsvn_client/prop_commands.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/prop_commands.c?rev=1450279&r1=1450278&r2=1450279&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/prop_commands.c (original)
+++ subversion/trunk/subversion/libsvn_client/prop_commands.c Tue Feb 26 17:04:31 2013
@@ -156,9 +156,8 @@ propset_on_url(const char *propname,
 
   /* Open an RA session for the URL. Note that we don't have a local
      directory, nor a place to put temp files. */
-  SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL, target,
-                                               NULL, NULL, FALSE, TRUE,
-                                               ctx, pool));
+  SVN_ERR(svn_client_open_ra_session2(&ra_session, target, NULL,
+                                      ctx, pool, pool));
 
   SVN_ERR(svn_ra_check_path(ra_session, "", base_revision_for_url,
                             &node_kind, pool));
@@ -468,10 +467,9 @@ svn_client_revprop_set2(const char *prop
     return svn_error_createf(SVN_ERR_CLIENT_PROPERTY_NAME, NULL,
                              _("Bad property name: '%s'"), propname);
 
-  /* Open an RA session for the URL. Note that we don't have a local
-     directory, nor a place to put temp files. */
-  SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL, URL, NULL,
-                                               NULL, FALSE, TRUE, ctx, pool));
+  /* Open an RA session for the URL. */
+  SVN_ERR(svn_client_open_ra_session2(&ra_session, URL, NULL,
+                                      ctx, pool, pool));
 
   /* Resolve the revision into something real, and return that to the
      caller as well. */
@@ -992,19 +990,25 @@ svn_client_revprop_get(const char *propn
                        apr_pool_t *pool)
 {
   svn_ra_session_t *ra_session;
+  apr_pool_t *subpool = svn_pool_create(pool);
+  svn_error_t *err;
 
   /* Open an RA session for the URL. Note that we don't have a local
      directory, nor a place to put temp files. */
-  SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL, URL, NULL,
-                                               NULL, FALSE, TRUE, ctx, pool));
+  SVN_ERR(svn_client_open_ra_session2(&ra_session, URL, NULL,
+                                      ctx, subpool, subpool));
 
   /* Resolve the revision into something real, and return that to the
      caller as well. */
   SVN_ERR(svn_client__get_revision_number(set_rev, NULL, ctx->wc_ctx, NULL,
-                                          ra_session, revision, pool));
+                                          ra_session, revision, subpool));
 
   /* The actual RA call. */
-  return svn_ra_rev_prop(ra_session, *set_rev, propname, propval, pool);
+  err = svn_ra_rev_prop(ra_session, *set_rev, propname, propval, pool);
+
+  /* Close RA session */
+  svn_pool_destroy(subpool);
+  return svn_error_trace(err);
 }
 
 
@@ -1535,20 +1539,23 @@ svn_client_revprop_list(apr_hash_t **pro
 {
   svn_ra_session_t *ra_session;
   apr_hash_t *proplist;
+  apr_pool_t *subpool = svn_pool_create(pool);
+  svn_error_t *err;
 
   /* Open an RA session for the URL. Note that we don't have a local
      directory, nor a place to put temp files. */
-  SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL, URL, NULL,
-                                               NULL, FALSE, TRUE, ctx, pool));
+  SVN_ERR(svn_client_open_ra_session2(&ra_session, URL, NULL,
+                                      ctx, subpool, subpool));
 
   /* Resolve the revision into something real, and return that to the
      caller as well. */
   SVN_ERR(svn_client__get_revision_number(set_rev, NULL, ctx->wc_ctx, NULL,
-                                          ra_session, revision, pool));
+                                          ra_session, revision, subpool));
 
   /* The actual RA call. */
-  SVN_ERR(svn_ra_rev_proplist(ra_session, *set_rev, &proplist, pool));
+  err = svn_ra_rev_proplist(ra_session, *set_rev, &proplist, pool);
 
   *props = proplist;
-  return SVN_NO_ERROR;
+  svn_pool_destroy(subpool); /* Close RA session */
+  return svn_error_trace(err);
 }

Modified: subversion/trunk/subversion/libsvn_client/ra.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/ra.c?rev=1450279&r1=1450278&r2=1450279&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/ra.c (original)
+++ subversion/trunk/subversion/libsvn_client/ra.c Tue Feb 26 17:04:31 2013
@@ -59,6 +59,9 @@ typedef struct callback_baton_t
      happens to work most of the time but is ultimately incorrect.  */
   svn_boolean_t base_dir_isversioned;
 
+  /* Used as wri_abspath for obtaining access to the pristine store */
+  const char *wcroot_abspath;
+
   /* An array of svn_client_commit_item3_t * structures, present only
      during working copy commits. */
   const apr_array_header_t *commit_items;
@@ -250,7 +253,7 @@ get_wc_contents(void *baton,
 {
   callback_baton_t *cb = baton;
 
-  if (! (cb->base_dir_abspath && cb->base_dir_isversioned))
+  if (! cb->wcroot_abspath)
     {
       *contents = NULL;
       return SVN_NO_ERROR;
@@ -259,7 +262,7 @@ get_wc_contents(void *baton,
   return svn_error_trace(
              svn_wc__get_pristine_contents_by_checksum(contents,
                                                        cb->ctx->wc_ctx,
-                                                       cb->base_dir_abspath,
+                                                       cb->wcroot_abspath,
                                                        checksum,
                                                        pool, pool));
 }
@@ -292,42 +295,47 @@ svn_client__open_ra_session_internal(svn
                                      const char *base_url,
                                      const char *base_dir_abspath,
                                      const apr_array_header_t *commit_items,
-                                     svn_boolean_t use_admin,
-                                     svn_boolean_t read_only_wc,
+                                     svn_boolean_t write_dav_props,
+                                     svn_boolean_t read_dav_props,
                                      svn_client_ctx_t *ctx,
-                                     apr_pool_t *pool)
+                                     apr_pool_t *result_pool,
+                                     apr_pool_t *scratch_pool)
 {
   svn_ra_callbacks2_t *cbtable;
-  callback_baton_t *cb = apr_pcalloc(pool, sizeof(*cb));
+  callback_baton_t *cb = apr_pcalloc(result_pool, sizeof(*cb));
   const char *uuid = NULL;
 
-  SVN_ERR_ASSERT(base_dir_abspath != NULL || ! use_admin);
+  SVN_ERR_ASSERT(!write_dav_props || read_dav_props);
+  SVN_ERR_ASSERT(!read_dav_props || base_dir_abspath != NULL);
   SVN_ERR_ASSERT(base_dir_abspath == NULL
                         || svn_dirent_is_absolute(base_dir_abspath));
 
-  SVN_ERR(svn_ra_create_callbacks(&cbtable, pool));
+  SVN_ERR(svn_ra_create_callbacks(&cbtable, result_pool));
   cbtable->open_tmp_file = open_tmp_file;
-  cbtable->get_wc_prop = use_admin ? get_wc_prop : NULL;
-  cbtable->set_wc_prop = read_only_wc ? NULL : set_wc_prop;
+  cbtable->get_wc_prop = read_dav_props ? get_wc_prop : NULL;
+  cbtable->set_wc_prop = (write_dav_props && read_dav_props)
+                          ? set_wc_prop : NULL;
   cbtable->push_wc_prop = commit_items ? push_wc_prop : NULL;
-  cbtable->invalidate_wc_props = read_only_wc ? NULL : invalidate_wc_props;
+  cbtable->invalidate_wc_props = (write_dav_props && read_dav_props)
+                                  ? invalidate_wc_props : NULL;
   cbtable->auth_baton = ctx->auth_baton; /* new-style */
   cbtable->progress_func = ctx->progress_func;
   cbtable->progress_baton = ctx->progress_baton;
   cbtable->cancel_func = ctx->cancel_func ? cancel_callback : NULL;
   cbtable->get_client_string = get_client_string;
-  cbtable->get_wc_contents = get_wc_contents;
+  if (base_dir_abspath)
+    cbtable->get_wc_contents = get_wc_contents;
 
-  cb->base_dir_abspath = base_dir_abspath;
   cb->commit_items = commit_items;
   cb->ctx = ctx;
 
-  if (base_dir_abspath)
+  if (base_dir_abspath && (read_dav_props || write_dav_props))
     {
       svn_error_t *err = svn_wc__node_get_repos_info(NULL, NULL, NULL, &uuid,
                                                      ctx->wc_ctx,
                                                      base_dir_abspath,
-                                                     pool, pool);
+                                                     result_pool,
+                                                     scratch_pool);
 
       if (err && (err->apr_err == SVN_ERR_WC_NOT_WORKING_COPY
                   || err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND
@@ -341,6 +349,25 @@ svn_client__open_ra_session_internal(svn
           SVN_ERR(err);
           cb->base_dir_isversioned = TRUE;
         }
+      cb->base_dir_abspath = apr_pstrdup(result_pool, base_dir_abspath);
+    }
+
+  if (base_dir_abspath)
+    {
+      svn_error_t *err = svn_wc__get_wcroot(&cb->wcroot_abspath,
+                                            ctx->wc_ctx, base_dir_abspath,
+                                            result_pool, scratch_pool);
+
+      if (err)
+        {
+          if (err->apr_err != SVN_ERR_WC_NOT_WORKING_COPY
+              && err->apr_err != SVN_ERR_WC_PATH_NOT_FOUND
+              && err->apr_err != SVN_ERR_WC_UPGRADE_REQUIRED)
+            return svn_error_trace(err);
+
+          svn_error_clear(err);
+          cb->wcroot_abspath = NULL;
+        }
     }
 
   /* If the caller allows for auto-following redirections, and the
@@ -349,7 +376,7 @@ svn_client__open_ra_session_internal(svn
      attempts.  */
   if (corrected_url)
     {
-      apr_hash_t *attempted = apr_hash_make(pool);
+      apr_hash_t *attempted = apr_hash_make(scratch_pool);
       int attempts_left = SVN_CLIENT__MAX_REDIRECT_ATTEMPTS;
 
       *corrected_url = NULL;
@@ -361,7 +388,8 @@ svn_client__open_ra_session_internal(svn
              don't accept corrected URLs from the RA provider. */
           SVN_ERR(svn_ra_open4(ra_session,
                                attempts_left == 0 ? NULL : &corrected,
-                               base_url, uuid, cbtable, cb, ctx->config, pool));
+                               base_url, uuid, cbtable, cb, ctx->config,
+                               result_pool));
 
           /* No error and no corrected URL?  We're done here. */
           if (! corrected)
@@ -372,8 +400,9 @@ svn_client__open_ra_session_internal(svn
             {
               svn_wc_notify_t *notify =
                 svn_wc_create_notify_url(corrected,
-                                         svn_wc_notify_url_redirect, pool);
-              (*ctx->notify_func2)(ctx->notify_baton2, notify, pool);
+                                         svn_wc_notify_url_redirect,
+                                         scratch_pool);
+              (*ctx->notify_func2)(ctx->notify_baton2, notify, scratch_pool);
             }
 
           /* Our caller will want to know what our final corrected URL was. */
@@ -393,7 +422,7 @@ svn_client__open_ra_session_internal(svn
   else
     {
       SVN_ERR(svn_ra_open4(ra_session, NULL, base_url,
-                           uuid, cbtable, cb, ctx->config, pool));
+                           uuid, cbtable, cb, ctx->config, result_pool));
     }
 
   return SVN_NO_ERROR;
@@ -402,15 +431,19 @@ svn_client__open_ra_session_internal(svn
 
 
 svn_error_t *
-svn_client_open_ra_session(svn_ra_session_t **session,
-                           const char *url,
-                           svn_client_ctx_t *ctx,
-                           apr_pool_t *pool)
+svn_client_open_ra_session2(svn_ra_session_t **session,
+                            const char *url,
+                            const char *wri_abspath,
+                            svn_client_ctx_t *ctx,
+                            apr_pool_t *result_pool,
+                            apr_pool_t *scratch_pool)
 {
   return svn_error_trace(
              svn_client__open_ra_session_internal(session, NULL, url,
-                                                  NULL, NULL, FALSE, TRUE,
-                                                  ctx, pool));
+                                                  wri_abspath, NULL,
+                                                  FALSE, FALSE,
+                                                  ctx, result_pool,
+                                                  scratch_pool));
 }
 
 
@@ -483,6 +516,7 @@ svn_client__ra_session_from_path2(svn_ra
   const char *initial_url;
   const char *corrected_url;
   svn_client__pathrev_t *resolved_loc;
+  const char *wri_abspath;
 
   SVN_ERR(svn_client_url_from_path2(&initial_url, path_or_url, ctx, pool,
                                     pool));
@@ -490,12 +524,20 @@ svn_client__ra_session_from_path2(svn_ra
     return svn_error_createf(SVN_ERR_ENTRY_MISSING_URL, NULL,
                              _("'%s' has no URL"), path_or_url);
 
+  if (base_dir_abspath)
+    wri_abspath = base_dir_abspath;
+  else if (!svn_path_is_url(path_or_url))
+    SVN_ERR(svn_dirent_get_absolute(&wri_abspath, path_or_url, pool));
+  else
+    wri_abspath = NULL;
+
   SVN_ERR(svn_client__open_ra_session_internal(&ra_session, &corrected_url,
                                                initial_url,
-                                               base_dir_abspath, NULL,
+                                               wri_abspath,
+                                               NULL /* commit_items */,
+                                               base_dir_abspath != NULL,
                                                base_dir_abspath != NULL,
-                                               base_dir_abspath == NULL,
-                                               ctx, pool));
+                                               ctx, pool, pool));
 
   /* If we got a CORRECTED_URL, we'll want to refer to that as the
      URL-ized form of PATH_OR_URL from now on. */
@@ -807,9 +849,8 @@ svn_client__repos_locations(const char *
 
   /* Open a RA session to this URL if we don't have one already. */
   if (! ra_session)
-    SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL, url, NULL,
-                                                 NULL, FALSE, TRUE,
-                                                 ctx, subpool));
+    SVN_ERR(svn_client_open_ra_session2(&ra_session, url, NULL,
+                                        ctx, subpool, subpool));
 
   /* Resolve the opt_revision_ts. */
   if (peg_revnum == SVN_INVALID_REVNUM)
@@ -873,7 +914,8 @@ svn_client__get_youngest_common_ancestor
   if (session == NULL)
     {
       sesspool = svn_pool_create(scratch_pool);
-      SVN_ERR(svn_client_open_ra_session(&session, loc1->url, ctx, sesspool));
+      SVN_ERR(svn_client_open_ra_session2(&session, loc1->url, NULL, ctx,
+                                          sesspool, sesspool));
     }
 
   /* We're going to cheat and use history-as-mergeinfo because it

Modified: subversion/trunk/subversion/libsvn_client/status.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/status.c?rev=1450279&r1=1450278&r2=1450279&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/status.c (original)
+++ subversion/trunk/subversion/libsvn_client/status.c Tue Feb 26 17:04:31 2013
@@ -189,9 +189,8 @@ reporter_finish_report(void *report_bato
 
   /* Open an RA session to our common ancestor and grab the locks under it.
    */
-  SVN_ERR(svn_client__open_ra_session_internal(&ras, NULL, rb->ancestor, NULL,
-                                               NULL, FALSE, TRUE,
-                                               rb->ctx, subpool));
+  SVN_ERR(svn_client_open_ra_session2(&ras, rb->ancestor, NULL,
+                                      rb->ctx, subpool, subpool));
 
   /* The locks need to live throughout the edit.  Note that if the
      server doesn't support lock discovery, we'll just not do locky
@@ -458,9 +457,9 @@ svn_client_status5(svn_revnum_t *result_
 
       /* Open a repository session to the URL. */
       SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL, URL,
-                                                   dir_abspath,
-                                                   NULL, FALSE, TRUE,
-                                                   ctx, pool));
+                                                   dir_abspath, NULL,
+                                                   FALSE, TRUE,
+                                                   ctx, pool, pool));
 
       SVN_ERR(svn_ra_has_capability(ra_session, &server_supports_depth,
                                     SVN_RA_CAPABILITY_DEPTH, pool));

Modified: subversion/trunk/subversion/libsvn_client/update.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/update.c?rev=1450279&r1=1450278&r2=1450279&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/update.c (original)
+++ subversion/trunk/subversion/libsvn_client/update.c Tue Feb 26 17:04:31 2013
@@ -346,7 +346,7 @@ update_internal(svn_revnum_t *result_rev
   SVN_ERR(svn_client__open_ra_session_internal(&ra_session, &corrected_url,
                                                anchor_url,
                                                anchor_abspath, NULL, TRUE,
-                                               TRUE, ctx, pool));
+                                               TRUE, ctx, pool, pool));
 
   /* If we got a corrected URL from the RA subsystem, we'll need to
      relocate our working copy first. */

Modified: subversion/trunk/subversion/libsvn_client/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/util.c?rev=1450279&r1=1450278&r2=1450279&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/util.c (original)
+++ subversion/trunk/subversion/libsvn_client/util.c Tue Feb 26 17:04:31 2013
@@ -266,10 +266,8 @@ svn_client_get_repos_root(const char **r
     }
 
   /* If PATH_OR_URL was a URL, we use the RA layer to look it up. */
-  SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL,
-                                               abspath_or_url,
-                                               NULL, NULL, FALSE, TRUE,
-                                               ctx, scratch_pool));
+  SVN_ERR(svn_client_open_ra_session2(&ra_session,  abspath_or_url, NULL,
+                                      ctx, scratch_pool, scratch_pool));
 
   if (repos_root)
     SVN_ERR(svn_ra_get_repos_root2(ra_session, repos_root, result_pool));