Author: rhuijben
Date: Sat Dec 21 11:21:04 2013
New Revision: 1552894
URL: http://svn.apache.org/r1552894
Log:
Following up on r1552324, copy the settings hash in the ra session
implementations that now store a reference to the whole config. Tweak
documentation and move public function.
* subversion/include/svn_ra.h
(svn_ra_dup_session): Move function from between the svn_ra_openX()
functions and extend documentation a bit.
* subversion/libsvn_ra_serf/serf.c
(svn_ra_serf__open,
ra_serf_dup_session): Copy config hash instead of just referencing it.
* subversion/libsvn_ra_svn/client.c
(open_session): Copy config hash instead of just referencing it.
Modified:
subversion/trunk/subversion/include/svn_ra.h
subversion/trunk/subversion/libsvn_ra_serf/serf.c
subversion/trunk/subversion/libsvn_ra_svn/client.c
Modified: subversion/trunk/subversion/include/svn_ra.h
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_ra.h?rev=1552894&r1=1552893&r2=1552894&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_ra.h (original)
+++ subversion/trunk/subversion/include/svn_ra.h Sat Dec 21 11:21:04 2013
@@ -747,28 +747,6 @@ svn_ra_open4(svn_ra_session_t **session_
apr_hash_t *config,
apr_pool_t *pool);
-/**
- * Open a new ra session @a *new_session to the same repository as an existing
- * ra session @a old_session, copying the callbacks, auth baton, etc. from the
- * old session.
- *
- * If @a session_url is not NULL, parent the new session at session_url. Note
- * that @a session_url MUST BE in the same repository as @a old_session.
- * Otherwise the same root will be used.
- *
- * Allocate @a new_session in @a result_pool. Perform temporary allocations
- * in @a scratch_pool
- *
- * @since New in 1.9.
- */
-svn_error_t *
-svn_ra_dup_session(svn_ra_session_t **new_session,
- svn_ra_session_t *old_session,
- const char *session_url,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool);
-
-
/** Similar to svn_ra_open4(), but with @a corrected_url always passed
* as @c NULL.
*
@@ -814,6 +792,32 @@ svn_ra_open(svn_ra_session_t **session_p
apr_hash_t *config,
apr_pool_t *pool);
+/**
+ * Open a new ra session @a *new_session to the same repository as an existing
+ * ra session @a old_session, copying the callbacks, auth baton, etc. from the
+ * old session. This essentially limits the lifetime of the new, duplicated
+ * session to the lifetime of the old session. If the new session should
+ * outlive the new session, creating a new session using svn_ra_open4() is
+ * recommended.
+ *
+ * If @a session_url is not NULL, parent the new session at session_url. Note
+ * that @a session_url MUST BE in the same repository as @a old_session or an
+ * error will be returned. When @a session_url NULL the same session root
+ * will be used.
+ *
+ * Allocate @a new_session in @a result_pool. Perform temporary allocations
+ * in @a scratch_pool.
+ *
+ * @since New in 1.9.
+ */
+svn_error_t *
+svn_ra_dup_session(svn_ra_session_t **new_session,
+ svn_ra_session_t *old_session,
+ const char *session_url,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
+
+
/** Change the root URL of an open @a ra_session to point to a new path in the
* same repository. @a url is the new root URL. Use @a pool for
* temporary allocations.
Modified: subversion/trunk/subversion/libsvn_ra_serf/serf.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/serf.c?rev=1552894&r1=1552893&r2=1552894&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/serf.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/serf.c Sat Dec 21 11:21:04 2013
@@ -494,7 +494,10 @@ svn_ra_serf__open(svn_ra_session_t *sess
serf_sess = apr_pcalloc(pool, sizeof(*serf_sess));
serf_sess->pool = svn_pool_create(pool);
- serf_sess->config = config;
+ if (config)
+ SVN_ERR(svn_config_copy_config(&serf_sess->config, config, pool));
+ else
+ serf_sess->config = NULL;
serf_sess->wc_callbacks = callbacks;
serf_sess->wc_callback_baton = callback_baton;
serf_sess->progress_func = callbacks->progress_func;
@@ -614,7 +617,11 @@ ra_serf_dup_session(svn_ra_session_t *ne
new_sess = apr_pmemdup(result_pool, old_sess, sizeof(*new_sess));
new_sess->pool = result_pool;
- /* config */
+
+ if (new_sess->config)
+ SVN_ERR(svn_config_copy_config(&new_sess->config, new_sess->config,
+ result_pool));
+
/* max_connections */
/* using_ssl */
/* using_compression */
Modified: subversion/trunk/subversion/libsvn_ra_svn/client.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_svn/client.c?rev=1552894&r1=1552893&r2=1552894&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_svn/client.c (original)
+++ subversion/trunk/subversion/libsvn_ra_svn/client.c Sat Dec 21 11:21:04 2013
@@ -623,7 +623,11 @@ static svn_error_t *open_session(svn_ra_
sess->callbacks = callbacks;
sess->callbacks_baton = callbacks_baton;
sess->bytes_read = sess->bytes_written = 0;
- sess->config = config;
+
+ if (config)
+ SVN_ERR(svn_config_copy_config(&sess->config, config, pool));
+ else
+ sess->config = NULL;
if (tunnel_name)
{