You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by gs...@apache.org on 2011/05/27 10:42:17 UTC
svn commit: r1128197 - in /subversion/trunk/subversion/libsvn_ra_serf:
property.c ra_serf.h serf.c update.c util.c
Author: gstein
Date: Fri May 27 08:42:17 2011
New Revision: 1128197
URL: http://svn.apache.org/viewvc?rev=1128197&view=rev
Log:
Change svn_ra_serf__retrieve_props() to allocate and return the properties
rather than filling in a provided hash table (ugh).
* subversion/libsvn_ra_serf/ra_serf.h:
(svn_ra_serf__retrieve_props): return properties as an OUT param rather
than expecting the caller to create an empty hash. switch to a
two-pool paradigm.
(svn_ra_serf__get_dir): tighten scope of PROPS to the two blocks. no
need to initialize it. adjust calls to retrieve_props().
* subversion/libsvn_ra_serf/serf.c:
(svn_ra_serf__rev_proplist): no need to create PROPS. move creation of
*RET_PROPS down near the walk_all_props call that populates it. update
the call to retrieve_props().
* subversion/libsvn_ra_serf/util.c:
(svn_ra_serf__discover_vcc): tighten scope of PROPS and adjust the call
to retrieve_props()
* subversion/libsvn_ra_serf/update.c:
(svn_ra_serf__get_file): remove init of FETCH_PROPS and update the call
to retrieve_props().
* subversion/libsvn_ra_serf/property.c:
(svn_ra_serf__retrieve_props): adjust params to return RESULTS and to
take two pools. initialize the RESULTS out-param and pass to the inner
calls. adjust for new pools.
Modified:
subversion/trunk/subversion/libsvn_ra_serf/property.c
subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h
subversion/trunk/subversion/libsvn_ra_serf/serf.c
subversion/trunk/subversion/libsvn_ra_serf/update.c
subversion/trunk/subversion/libsvn_ra_serf/util.c
Modified: subversion/trunk/subversion/libsvn_ra_serf/property.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/property.c?rev=1128197&r1=1128196&r2=1128197&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/property.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/property.c Fri May 27 08:42:17 2011
@@ -636,20 +636,23 @@ svn_ra_serf__wait_for_props(svn_ra_serf_
* This is a blocking version of deliver_props.
*/
svn_error_t *
-svn_ra_serf__retrieve_props(apr_hash_t *prop_vals,
+svn_ra_serf__retrieve_props(apr_hash_t **results,
svn_ra_serf__session_t *sess,
svn_ra_serf__connection_t *conn,
const char *url,
svn_revnum_t rev,
const char *depth,
const svn_ra_serf__dav_props_t *props,
- apr_pool_t *pool)
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
{
svn_ra_serf__propfind_context_t *prop_ctx;
- SVN_ERR(svn_ra_serf__deliver_props(&prop_ctx, prop_vals, sess, conn, url,
- rev, depth, props, NULL, pool));
- SVN_ERR(svn_ra_serf__wait_for_props(prop_ctx, sess, pool));
+ *results = apr_hash_make(result_pool);
+
+ SVN_ERR(svn_ra_serf__deliver_props(&prop_ctx, *results, sess, conn, url,
+ rev, depth, props, NULL, result_pool));
+ SVN_ERR(svn_ra_serf__wait_for_props(prop_ctx, sess, result_pool));
return SVN_NO_ERROR;
}
@@ -900,13 +903,14 @@ retrieve_baseline_info(svn_revnum_t *act
svn_revnum_t revision,
apr_pool_t *pool)
{
- apr_hash_t *props = apr_hash_make(pool);
+ apr_hash_t *props;
const char *basecoll_url;
const char *version_name;
- SVN_ERR(svn_ra_serf__retrieve_props(props, session, conn,
+ SVN_ERR(svn_ra_serf__retrieve_props(&props, session, conn,
baseline_url, revision, "0",
- baseline_props, pool));
+ baseline_props,
+ pool, pool));
basecoll_url = svn_ra_serf__get_ver_prop(props, baseline_url, revision,
"DAV:", "baseline-collection");
@@ -948,7 +952,6 @@ svn_ra_serf__get_baseline_info(const cha
apr_pool_t *pool)
{
const char *vcc_url, *relative_url, *basecoll_url, *baseline_url;
- apr_hash_t *props = apr_hash_make(pool);
/* No URL? No sweat. We'll use the session URL. */
if (! url)
@@ -1019,11 +1022,13 @@ svn_ra_serf__get_baseline_info(const cha
}
else
{
+ apr_hash_t *props;
svn_revnum_t actual_revision;
- SVN_ERR(svn_ra_serf__retrieve_props(props, session, conn,
+ SVN_ERR(svn_ra_serf__retrieve_props(&props, session, conn,
vcc_url, revision, "0",
- checked_in_props, pool));
+ checked_in_props,
+ pool, pool));
baseline_url = svn_ra_serf__get_ver_prop(props, vcc_url, revision,
"DAV:", "checked-in");
if (!baseline_url)
Modified: subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h?rev=1128197&r1=1128196&r2=1128197&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h Fri May 27 08:42:17 2011
@@ -892,18 +892,25 @@ svn_ra_serf__wait_for_props(svn_ra_serf_
svn_ra_serf__session_t *sess,
apr_pool_t *pool);
-/*
- * This is a blocking version of deliver_props.
- */
+/* This is a blocking version of deliver_props.
+
+ The properties are fetched and placed into RESULTS, allocated in
+ RESULT_POOL.
+
+ ### more docco about the other params.
+
+ Temporary allocations are made in SCRATCH_POOL.
+*/
svn_error_t *
-svn_ra_serf__retrieve_props(apr_hash_t *prop_vals,
+svn_ra_serf__retrieve_props(apr_hash_t **results,
svn_ra_serf__session_t *sess,
svn_ra_serf__connection_t *conn,
const char *url,
svn_revnum_t rev,
const char *depth,
const svn_ra_serf__dav_props_t *props,
- apr_pool_t *pool);
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
/* Set PROPS for PATH at REV revision with a NS:NAME VAL.
*
Modified: subversion/trunk/subversion/libsvn_ra_serf/serf.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/serf.c?rev=1128197&r1=1128196&r2=1128197&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/serf.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/serf.c Fri May 27 08:42:17 2011
@@ -517,9 +517,6 @@ svn_ra_serf__rev_proplist(svn_ra_session
apr_hash_t *props;
const char *propfind_path;
- props = apr_hash_make(pool);
- *ret_props = apr_hash_make(pool);
-
if (SVN_RA_SERF__HAVE_HTTPV2_SUPPORT(session))
{
propfind_path = apr_psprintf(pool, "%s/%ld", session->rev_stub, rev);
@@ -536,9 +533,11 @@ svn_ra_serf__rev_proplist(svn_ra_session
SVN_ERR(svn_ra_serf__discover_vcc(&propfind_path, session, NULL, pool));
}
- SVN_ERR(svn_ra_serf__retrieve_props(props, session, session->conns[0],
+ SVN_ERR(svn_ra_serf__retrieve_props(&props, session, session->conns[0],
propfind_path, rev, "0", all_props,
- pool));
+ pool, pool));
+
+ *ret_props = apr_hash_make(pool);
SVN_ERR(svn_ra_serf__walk_all_props(props, propfind_path, rev,
svn_ra_serf__set_bare_props, *ret_props,
@@ -898,7 +897,6 @@ svn_ra_serf__get_dir(svn_ra_session_t *r
apr_pool_t *pool)
{
svn_ra_serf__session_t *session = ra_session->priv;
- apr_hash_t *props;
const char *path;
path = session->session_url.path;
@@ -928,18 +926,17 @@ svn_ra_serf__get_dir(svn_ra_session_t *r
if (dirents)
{
struct path_dirent_visitor_t dirent_walk;
-
- props = apr_hash_make(pool);
+ apr_hash_t *props;
/* Always request node kind to check that path is really a
* directory.
*/
dirent_fields |= SVN_DIRENT_KIND;
- SVN_ERR(svn_ra_serf__retrieve_props(props, session, session->conns[0],
+ SVN_ERR(svn_ra_serf__retrieve_props(&props, session, session->conns[0],
path, revision, "1",
get_dirent_props(dirent_fields,
pool),
- pool));
+ pool, pool));
/* Check if the path is really a directory. */
SVN_ERR(resource_is_directory(props, path, revision));
@@ -961,11 +958,11 @@ svn_ra_serf__get_dir(svn_ra_session_t *r
/* If we're asked for the directory properties, fetch them too. */
if (ret_props)
{
- props = apr_hash_make(pool);
+ apr_hash_t *props;
- SVN_ERR(svn_ra_serf__retrieve_props(props, session, session->conns[0],
+ SVN_ERR(svn_ra_serf__retrieve_props(&props, session, session->conns[0],
path, revision, "0", all_props,
- pool));
+ pool, pool));
/* Check if the path is really a directory. */
SVN_ERR(resource_is_directory(props, path, revision));
Modified: subversion/trunk/subversion/libsvn_ra_serf/update.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/update.c?rev=1128197&r1=1128196&r2=1128197&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/update.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/update.c Fri May 27 08:42:17 2011
@@ -2731,7 +2731,6 @@ svn_ra_serf__get_file(svn_ra_session_t *
conn = session->conns[session->cur_conn];
/* Fetch properties. */
- fetch_props = apr_hash_make(pool);
fetch_url = svn_path_url_add_component2(session->session_url.path, path, pool);
@@ -2751,10 +2750,10 @@ svn_ra_serf__get_file(svn_ra_session_t *
revision = SVN_INVALID_REVNUM;
}
- SVN_ERR(svn_ra_serf__retrieve_props(fetch_props, session, conn, fetch_url,
+ SVN_ERR(svn_ra_serf__retrieve_props(&fetch_props, session, conn, fetch_url,
revision, "0",
props ? all_props : check_path_props,
- pool));
+ pool, pool));
/* Verify that resource type is not colelction. */
SVN_ERR(svn_ra_serf__get_resource_type(&res_kind, fetch_props, fetch_url,
Modified: subversion/trunk/subversion/libsvn_ra_serf/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/util.c?rev=1128197&r1=1128196&r2=1128197&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/util.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/util.c Fri May 27 08:42:17 2011
@@ -1651,8 +1651,9 @@ svn_ra_serf__discover_vcc(const char **v
svn_ra_serf__connection_t *conn,
apr_pool_t *pool)
{
- apr_hash_t *props;
- const char *path, *relative_path, *uuid;
+ const char *path;
+ const char *relative_path;
+ const char *uuid;
/* If we've already got the information our caller seeks, just return it. */
if (session->vcc_url && session->repos_root_str)
@@ -1667,16 +1668,18 @@ svn_ra_serf__discover_vcc(const char **v
conn = session->conns[0];
}
- props = apr_hash_make(pool);
path = session->session_url.path;
*vcc_url = NULL;
uuid = NULL;
do
{
- svn_error_t *err = svn_ra_serf__retrieve_props(props, session, conn,
- path, SVN_INVALID_REVNUM,
- "0", base_props, pool);
+ apr_hash_t *props;
+ svn_error_t *err;
+
+ err = svn_ra_serf__retrieve_props(&props, session, conn,
+ path, SVN_INVALID_REVNUM,
+ "0", base_props, pool, pool);
if (! err)
{
*vcc_url =