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:11:38 UTC
svn commit: r1128187 - in /subversion/trunk/subversion/libsvn_ra_serf:
property.c ra_serf.h serf.c update.c
Author: gstein
Date: Fri May 27 08:11:38 2011
New Revision: 1128187
URL: http://svn.apache.org/viewvc?rev=1128187&view=rev
Log:
Rather than exposing a callback for the walker, just expose a function
that (privately) invokes the walker and uses a private version of the
callback. This is much clearer...
* subversion/libsvn_ra_serf/serf.c:
(svn_ra_serf__get_dir): shift one initialize of PROPS closer to the
retrieve_props() that will fill it in. remove the walker call that
uses svn_ra_serf__set_flat_props() and call the new
svn_ra_serf__flatten_props() funciton.
* subversion/libsvn_ra_serf/update.c:
(svn_ra_serf__get_file): switch from the walker to the new
svn_ra_serf__flatten_props().
* subversion/libsvn_ra_serf/property.c:
(svn_ra_serf__set_flat_props): renamed to ...
(set_flat_props): ... this, and made private
(svn_ra_serf__flatten_props): new function that invokes the walker with
the private function.
* subversion/libsvn_ra_serf/ra_serf.h:
(svn_ra_serF__set_flat_props): removed
(svn_ra_serf__flatten_props): new funciton. documented.
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
Modified: subversion/trunk/subversion/libsvn_ra_serf/property.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/property.c?rev=1128187&r1=1128186&r2=1128187&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/property.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/property.c Fri May 27 08:11:38 2011
@@ -817,17 +817,36 @@ set_hash_props(void *baton,
return SVN_NO_ERROR;
}
-svn_error_t *
-svn_ra_serf__set_flat_props(void *baton,
- const char *ns,
- const char *name,
- const svn_string_t *val,
- apr_pool_t *pool)
+static svn_error_t *
+set_flat_props(void *baton,
+ const char *ns,
+ const char *name,
+ const svn_string_t *val,
+ apr_pool_t *pool)
{
return svn_ra_serf__set_baton_props(set_hash_props, baton,
ns, name, val, pool);
}
+
+svn_error_t *
+svn_ra_serf__flatten_props(apr_hash_t **flat_props,
+ apr_hash_t *props,
+ const char *path,
+ svn_revnum_t revision,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ *flat_props = apr_hash_make(result_pool);
+
+ return svn_error_return(svn_ra_serf__walk_all_props(
+ props, path, revision,
+ set_flat_props,
+ *flat_props /* baton */,
+ result_pool));
+}
+
+
svn_error_t *
svn_ra_serf__set_bare_props(void *baton,
const char *ns,
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=1128187&r1=1128186&r2=1128187&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:11:38 2011
@@ -961,12 +961,6 @@ svn_ra_serf__set_baton_props(svn_ra_serf
const svn_string_t *val,
apr_pool_t *pool);
-svn_error_t *
-svn_ra_serf__set_flat_props(void *baton,
- const char *ns,
- const char *name,
- const svn_string_t *val,
- apr_pool_t *pool);
svn_error_t *
svn_ra_serf__set_bare_props(void *baton,
@@ -975,6 +969,28 @@ svn_ra_serf__set_bare_props(void *baton,
const svn_string_t *val,
apr_pool_t *pool);
+
+/* PROPS is nested hash tables mapping REV -> PATH -> NS -> NAME -> VALUE.
+ This function takes the tree of tables identified by PATH and REVISION
+ (resulting in NS:NAME:VALUE hashes) and flattens them into a set of
+ names to VALUE. The names are composed of NS:NAME, with specific
+ rewrite from wire names (DAV) to SVN names. This mapping is managed
+ by the svn_ra_serf__set_baton_props() function.
+
+ FLAT_PROPS is allocated in RESULT_POOL.
+ ### right now, we do a shallow copy from PROPS to FLAT_PROPS. therefore,
+ ### the names and values in PROPS must be in the proper pool.
+
+ Temporary allocations are made in SCRATCH_POOL. */
+svn_error_t *
+svn_ra_serf__flatten_props(apr_hash_t **flat_props,
+ apr_hash_t *props,
+ const char *path,
+ svn_revnum_t revision,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
+
+
/* Return the property value for PATH at REV revision with a NS:NAME.
* PROPS is a four-level nested hash: (svn_revnum_t => char *path =>
* char *ns => char *name => svn_string_t *). */
Modified: subversion/trunk/subversion/libsvn_ra_serf/serf.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/serf.c?rev=1128187&r1=1128186&r2=1128187&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/serf.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/serf.c Fri May 27 08:11:38 2011
@@ -909,8 +909,6 @@ svn_ra_serf__get_dir(svn_ra_session_t *r
path = svn_path_url_add_component2(path, rel_path, pool);
}
- props = apr_hash_make(pool);
-
/* If the user specified a peg revision other than HEAD, we have to fetch
the baseline collection url for that revision. If not, we can use the
public url. */
@@ -931,6 +929,8 @@ svn_ra_serf__get_dir(svn_ra_session_t *r
{
struct path_dirent_visitor_t dirent_walk;
+ props = apr_hash_make(pool);
+
/* Always request node kind to check that path is really a
* directory.
*/
@@ -942,7 +942,7 @@ svn_ra_serf__get_dir(svn_ra_session_t *r
pool));
/* Check if the path is really a directory. */
- SVN_ERR(resource_is_directory (props, path, revision));
+ SVN_ERR(resource_is_directory(props, path, revision));
/* We're going to create two hashes to help the walker along.
* We're going to return the 2nd one back to the caller as it
@@ -962,7 +962,6 @@ svn_ra_serf__get_dir(svn_ra_session_t *r
if (ret_props)
{
props = apr_hash_make(pool);
- *ret_props = apr_hash_make(pool);
SVN_ERR(svn_ra_serf__retrieve_props(props, session, session->conns[0],
path, revision, "0", all_props,
@@ -970,9 +969,8 @@ svn_ra_serf__get_dir(svn_ra_session_t *r
/* Check if the path is really a directory. */
SVN_ERR(resource_is_directory(props, path, revision));
- SVN_ERR(svn_ra_serf__walk_all_props(props, path, revision,
- svn_ra_serf__set_flat_props,
- *ret_props, pool));
+ SVN_ERR(svn_ra_serf__flatten_props(ret_props, props, path, revision,
+ pool, pool));
}
return SVN_NO_ERROR;
Modified: subversion/trunk/subversion/libsvn_ra_serf/update.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/update.c?rev=1128187&r1=1128186&r2=1128187&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/update.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/update.c Fri May 27 08:11:38 2011
@@ -2768,11 +2768,8 @@ svn_ra_serf__get_file(svn_ra_session_t *
/* TODO Filter out all of our props into a usable format. */
if (props)
{
- *props = apr_hash_make(pool);
-
- SVN_ERR(svn_ra_serf__walk_all_props(fetch_props, fetch_url, revision,
- svn_ra_serf__set_flat_props, *props,
- pool));
+ SVN_ERR(svn_ra_serf__flatten_props(props, fetch_props, fetch_url,
+ revision, pool, pool));
}
if (stream)