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 2012/05/10 14:41:00 UTC
svn commit: r1336639 - in /subversion/trunk/subversion/libsvn_ra_serf:
property.c ra_serf.h serf.c update.c util.c
Author: gstein
Date: Thu May 10 12:40:59 2012
New Revision: 1336639
URL: http://svn.apache.org/viewvc?rev=1336639&view=rev
Log:
Introduce a new function to fetch a simpler 2-level hash for fetching
properties. Most usage only requires props for a single node, rather
than the multi-level REV:PATH:NS:NAME:VALUE hash.
To support this, a new single-node walker has been added, and
flatten_props() and get_resource_type() have been switched to
single-node semantics.
* subversion/libsvn_ra_serf/ra_serf.h:
(svn_ra_serf__fetch_node_props): new declaration
(svn_ra_serf__walk_node_props): new declaration
(svn_ra_serf__flatten_props): drop the PATH parameter
(svn_ra_serf__get_resource_type): drop the URL parameter
* subversion/libsvn_ra_serf/property.c:
(svn_ra_serf__fetch_node_props): new implementation
(svn_ra_serf__walk_node_props): new function, based on code
extracted from svn_ra_serf__walk_all_props.
(svn_ra_serf__walk_all_props): wrap svn_ra_serf__walk_node_props
(svn_ra_serf__flatten_props): drop PATH parameter. switch to 2-level
hash input. use walk_node_props
(retrieve_baseline_info): drop SESSION param. switch to dual-pool.
use fetch_node_props. only do VERSION_NAME work when
ACTUAL_REVISION is not NULL.
(v1_get_youngest_revnum): update call to retrieve_baseline_info
(get_baseline_info): update call to retrieve_baseline_info
(svn_ra_serf__get_resource_type): drop URL param. switch to 2-hash
level input.
(svn_ra_serf__fetch_dav_prop): switch to fetch_node_props.
* subversion/libsvn_ra_serf/serf.c:
(fetch_path_props): drop RET_PATH output. rename REL_PATH to
SESSION_RELPATH for clarity. switch to dual-pool. rename localvar
PATH to URL for clarity. switch to fetch_node_props() and return a
2-level hash.
(svn_ra_serf__check_path): adjust params to fetch_path_props. adjust
call to get_resource_type.
(svn_ra_serf__stat): adjust params to fetch_path_props. switch to
walk_node_props().
(resource_is_directory): drop PATH parameter. consume 2-level hash.
adjust call to get_resoruce_type().
(svn_ra_serf__get_dir): switch call from resource_is_directory since
it now takes a 2-level hash, to manually testing the
DAV:resourcetype property. switch to fetch_node_props on the other
case, and update calls to resource_is_directory and flatten_props.
* subversion/libsvn_ra_serf/util.c:
(svn_ra_serf__discover_vcc): switch to fetch_node_props()
* subversion/libsvn_ra_serf/update.c:
(svn_ra_serf__get_file): switch to fetch_node_props and alter the
params to get_resource_type and flatten_props.
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=1336639&r1=1336638&r2=1336639&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/property.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/property.c Thu May 10 12:40:59 2012
@@ -109,6 +109,7 @@ struct svn_ra_serf__propfind_context_t {
svn_ra_serf__list_t done_item;
};
+
const svn_string_t *
svn_ra_serf__get_ver_prop_string(apr_hash_t *props,
const char *path,
@@ -644,32 +645,50 @@ svn_ra_serf__retrieve_props(apr_hash_t *
svn_error_t *
-svn_ra_serf__walk_all_props(apr_hash_t *props,
- const char *name,
- svn_revnum_t rev,
- svn_ra_serf__walker_visitor_t walker,
- void *baton,
- apr_pool_t *scratch_pool)
+svn_ra_serf__fetch_node_props(apr_hash_t **results,
+ svn_ra_serf__connection_t *conn,
+ const char *url,
+ svn_revnum_t revision,
+ const svn_ra_serf__dav_props_t *which_props,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
{
- apr_hash_index_t *ns_hi;
+ apr_hash_t *multiprops;
apr_hash_t *ver_props;
- apr_hash_t *path_props;
- apr_pool_t *iterpool;
- ver_props = apr_hash_get(props, &rev, sizeof(rev));
- if (!ver_props)
- {
- return SVN_NO_ERROR;
- }
+ /* Note: a couple extra hash tables and whatnot get into RESULT_POOL.
+ Not a big deal at this point. Theoretically, we could fetch all
+ props into SCRATCH_POOL, then copy just the REVISION/URL props
+ into RESULT_POOL. Too much work for too little gain... */
+ SVN_ERR(svn_ra_serf__retrieve_props(&multiprops, conn->session, conn,
+ url, revision, "0", which_props,
+ result_pool, scratch_pool));
+
+ ver_props = apr_hash_get(multiprops, &revision, sizeof(revision));
+ if (ver_props != NULL)
+ {
+ *results = apr_hash_get(ver_props, url, APR_HASH_KEY_STRING);
+ if (*results != NULL)
+ return SVN_NO_ERROR;
+ }
+
+ return svn_error_create(SVN_ERR_RA_DAV_PROPS_NOT_FOUND, NULL,
+ _("The PROPFIND response did not include "
+ "the requested properties"));
+}
- path_props = apr_hash_get(ver_props, name, APR_HASH_KEY_STRING);
- if (!path_props)
- {
- return SVN_NO_ERROR;
- }
+
+svn_error_t *
+svn_ra_serf__walk_node_props(apr_hash_t *props,
+ svn_ra_serf__walker_visitor_t walker,
+ void *baton,
+ apr_pool_t *scratch_pool)
+{
+ apr_pool_t *iterpool;
+ apr_hash_index_t *ns_hi;
iterpool = svn_pool_create(scratch_pool);
- for (ns_hi = apr_hash_first(scratch_pool, path_props); ns_hi;
+ for (ns_hi = apr_hash_first(scratch_pool, props); ns_hi;
ns_hi = apr_hash_next(ns_hi))
{
void *ns_val;
@@ -703,6 +722,31 @@ svn_ra_serf__walk_all_props(apr_hash_t *
svn_error_t *
+svn_ra_serf__walk_all_props(apr_hash_t *props,
+ const char *name,
+ svn_revnum_t rev,
+ svn_ra_serf__walker_visitor_t walker,
+ void *baton,
+ apr_pool_t *scratch_pool)
+{
+ apr_hash_t *ver_props;
+ apr_hash_t *path_props;
+
+ ver_props = apr_hash_get(props, &rev, sizeof(rev));
+ if (!ver_props)
+ return SVN_NO_ERROR;
+
+ path_props = apr_hash_get(ver_props, name, APR_HASH_KEY_STRING);
+ if (!path_props)
+ return SVN_NO_ERROR;
+
+ return svn_error_trace(svn_ra_serf__walk_node_props(path_props,
+ walker, baton,
+ scratch_pool));
+}
+
+
+svn_error_t *
svn_ra_serf__walk_all_paths(apr_hash_t *props,
svn_revnum_t rev,
svn_ra_serf__path_rev_walker_t walker,
@@ -824,14 +868,13 @@ set_flat_props(void *baton,
svn_error_t *
svn_ra_serf__flatten_props(apr_hash_t **flat_props,
apr_hash_t *props,
- const char *path,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
*flat_props = apr_hash_make(result_pool);
- return svn_error_trace(svn_ra_serf__walk_all_props(
- props, path, SVN_INVALID_REVNUM,
+ return svn_error_trace(svn_ra_serf__walk_node_props(
+ props,
set_flat_props,
*flat_props /* baton */,
scratch_pool));
@@ -890,7 +933,7 @@ svn_ra_serf__select_revprops(apr_hash_t
/*
- * Contact the server (using SESSION and CONN) to calculate baseline
+ * Contact the server (using CONN) to calculate baseline
* information for BASELINE_URL at REVISION (which may be
* SVN_INVALID_REVNUM to query the HEAD revision).
*
@@ -902,44 +945,42 @@ svn_ra_serf__select_revprops(apr_hash_t
static svn_error_t *
retrieve_baseline_info(svn_revnum_t *actual_revision,
const char **basecoll_url_p,
- svn_ra_serf__session_t *session,
svn_ra_serf__connection_t *conn,
const char *baseline_url,
svn_revnum_t revision,
- apr_pool_t *pool)
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
{
apr_hash_t *props;
+ apr_hash_t *dav_props;
const char *basecoll_url;
- const char *version_name;
-
- SVN_ERR(svn_ra_serf__retrieve_props(&props, session, conn,
- baseline_url, revision, "0",
- baseline_props,
- pool, pool));
- basecoll_url = svn_ra_serf__get_ver_prop(props, baseline_url, revision,
- "DAV:", "baseline-collection");
+ SVN_ERR(svn_ra_serf__fetch_node_props(&props, conn,
+ baseline_url, revision,
+ baseline_props,
+ scratch_pool, scratch_pool));
+ dav_props = apr_hash_get(props, "DAV:", 4);
+ /* If DAV_PROPS is NULL, then svn_prop_get_value() will return NULL. */
+ basecoll_url = svn_prop_get_value(dav_props, "baseline-collection");
if (!basecoll_url)
{
return svn_error_create(SVN_ERR_RA_DAV_PROPS_NOT_FOUND, NULL,
_("The PROPFIND response did not include "
"the requested baseline-collection value"));
}
-
- *basecoll_url_p = svn_urlpath__canonicalize(basecoll_url, pool);
-
- version_name = svn_ra_serf__get_ver_prop(props, baseline_url, revision,
- "DAV:", SVN_DAV__VERSION_NAME);
- if (!version_name)
- {
- return svn_error_create(SVN_ERR_RA_DAV_PROPS_NOT_FOUND, NULL,
- _("The PROPFIND response did not include "
- "the requested version-name value"));
- }
+ *basecoll_url_p = svn_urlpath__canonicalize(basecoll_url, result_pool);
if (actual_revision)
{
+ const char *version_name;
+
+ version_name = svn_prop_get_value(dav_props, SVN_DAV__VERSION_NAME);
+ if (!version_name)
+ return svn_error_create(SVN_ERR_RA_DAV_PROPS_NOT_FOUND, NULL,
+ _("The PROPFIND response did not include "
+ "the requested version-name value"));
+
*actual_revision = SVN_STR_TO_REV(version_name);
}
@@ -992,10 +1033,9 @@ v1_get_youngest_revnum(svn_revnum_t *you
scratch_pool));
if (!bc_url)
{
- SVN_ERR(retrieve_baseline_info(youngest, &bc_url,
- conn->session, conn,
+ SVN_ERR(retrieve_baseline_info(youngest, &bc_url, conn,
baseline_url, SVN_INVALID_REVNUM,
- scratch_pool));
+ scratch_pool, scratch_pool));
SVN_ERR(svn_ra_serf__blncache_set(conn->session->blncache,
baseline_url, *youngest,
bc_url, scratch_pool));
@@ -1083,8 +1123,8 @@ get_baseline_info(const char **bc_url,
revision, pool));
if (!*bc_url)
{
- SVN_ERR(retrieve_baseline_info(NULL, bc_url, session,
- conn, vcc_url, revision, pool));
+ SVN_ERR(retrieve_baseline_info(NULL, bc_url, conn,
+ vcc_url, revision, pool, pool));
SVN_ERR(svn_ra_serf__blncache_set(session->blncache, NULL,
revision, *bc_url, pool));
}
@@ -1142,18 +1182,19 @@ svn_ra_serf__get_stable_url(const char *
svn_error_t *
svn_ra_serf__get_resource_type(svn_kind_t *kind,
- apr_hash_t *props,
- const char *url)
+ apr_hash_t *props)
{
+ apr_hash_t *dav_props;
const char *res_type;
- res_type = svn_ra_serf__get_prop(props, url, "DAV:", "resourcetype");
+ dav_props = apr_hash_get(props, "DAV:", 4);
+ res_type = svn_prop_get_value(dav_props, "resourcetype");
if (!res_type)
{
/* How did this happen? */
return svn_error_create(SVN_ERR_RA_DAV_PROPS_NOT_FOUND, NULL,
_("The PROPFIND response did not include the "
- "requested resourcetype value"));
+ "requested resourcetype value"));
}
if (strcmp(res_type, "collection") == 0)
@@ -1179,17 +1220,22 @@ svn_ra_serf__fetch_dav_prop(const char *
apr_pool_t *scratch_pool)
{
apr_hash_t *props;
+ apr_hash_t *dav_props;
- SVN_ERR(svn_ra_serf__retrieve_props(&props, conn->session, conn, url,
- revision, "0", checked_in_props,
- scratch_pool, scratch_pool));
+ SVN_ERR(svn_ra_serf__fetch_node_props(&props, conn, url, revision,
+ checked_in_props,
+ scratch_pool, scratch_pool));
+ dav_props = apr_hash_get(props, "DAV:", 4);
+ if (dav_props == NULL)
+ return svn_error_create(SVN_ERR_RA_DAV_PROPS_NOT_FOUND, NULL,
+ _("The PROPFIND response did not include "
+ "the requested 'DAV:' properties"));
/* We wouldn't get here if the resource was not found (404), so the
property should be present.
Note: it is okay to call apr_pstrdup() with NULL. */
- *value = apr_pstrdup(result_pool, svn_ra_serf__get_ver_prop(
- props, url, revision, "DAV:", propname));
+ *value = apr_pstrdup(result_pool, svn_prop_get_value(dav_props, propname));
return SVN_NO_ERROR;
}
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=1336639&r1=1336638&r2=1336639&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h Thu May 10 12:40:59 2012
@@ -896,6 +896,27 @@ svn_ra_serf__retrieve_props(apr_hash_t *
apr_pool_t *scratch_pool);
+/* Using CONN, fetch the properties specified by WHICH_PROPS using CONN
+ for URL at REVISION. The resulting properties are placed into a 2-level
+ hash in RESULTS, mapping NAMESPACE -> hash<PROPNAME, PROPVALUE>, which
+ is allocated in RESULT_POOL.
+
+ If REVISION is SVN_INVALID_REVNUM, then the properties are fetched
+ from HEAD for URL.
+
+ This function performs the request synchronously.
+
+ Temporary allocations are made in SCRATCH_POOL. */
+svn_error_t *
+svn_ra_serf__fetch_node_props(apr_hash_t **results,
+ svn_ra_serf__connection_t *conn,
+ const char *url,
+ svn_revnum_t revision,
+ const svn_ra_serf__dav_props_t *which_props,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
+
+
/* Using CONN, fetch a DAV: property from the resource identified by URL
within REVISION. The PROPNAME may be one of:
@@ -946,6 +967,15 @@ svn_ra_serf__walk_all_props(apr_hash_t *
void *baton,
apr_pool_t *pool);
+
+/* Like walk_all_props(), but a 2-level hash. */
+svn_error_t *
+svn_ra_serf__walk_node_props(apr_hash_t *props,
+ svn_ra_serf__walker_visitor_t walker,
+ void *baton,
+ apr_pool_t *scratch_pool);
+
+
typedef svn_error_t *
(*svn_ra_serf__path_rev_walker_t)(void *baton,
const char *path, apr_ssize_t path_len,
@@ -984,15 +1014,12 @@ svn_ra_serf__select_revprops(apr_hash_t
apr_pool_t *scratch_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
+/* PROPS is nested hash tables mapping NS -> NAME -> VALUE.
+ This function takes the 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.
- ### REV is constant: SVN_INVALID_REVNUM
-
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.
@@ -1001,7 +1028,6 @@ svn_ra_serf__select_revprops(apr_hash_t
svn_error_t *
svn_ra_serf__flatten_props(apr_hash_t **flat_props,
apr_hash_t *props,
- const char *path,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
@@ -1042,8 +1068,7 @@ svn_ra_serf__set_prop(apr_hash_t *props,
svn_error_t *
svn_ra_serf__get_resource_type(svn_kind_t *kind,
- apr_hash_t *props,
- const char *url);
+ apr_hash_t *props);
/** MERGE-related functions **/
Modified: subversion/trunk/subversion/libsvn_ra_serf/serf.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/serf.c?rev=1336639&r1=1336638&r2=1336639&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/serf.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/serf.c Thu May 10 12:40:59 2012
@@ -558,48 +558,38 @@ svn_ra_serf__rev_prop(svn_ra_session_t *
}
static svn_error_t *
-fetch_path_props(apr_hash_t **ret_props,
- const char **ret_path,
+fetch_path_props(apr_hash_t **props,
svn_ra_serf__session_t *session,
- const char *rel_path,
+ const char *session_relpath,
svn_revnum_t revision,
const svn_ra_serf__dav_props_t *desired_props,
- apr_pool_t *pool)
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
{
- apr_hash_t *props;
- const char *path;
+ const char *url;
- path = session->session_url.path;
+ url = session->session_url.path;
/* If we have a relative path, append it. */
- if (rel_path)
- {
- path = svn_path_url_add_component2(path, rel_path, pool);
- }
+ if (session_relpath)
+ url = svn_path_url_add_component2(url, session_relpath, scratch_pool);
- /* If we were given a specific revision, we have to fetch the VCC and
- * do a PROPFIND off of that.
- */
+ /* If we were given a specific revision, get a URL that refers to that
+ specific revision (rather than floating with HEAD). */
if (SVN_IS_VALID_REVNUM(revision))
{
- SVN_ERR(svn_ra_serf__get_stable_url(&path, NULL /* latest_revnum */,
+ SVN_ERR(svn_ra_serf__get_stable_url(&url, NULL /* latest_revnum */,
session, NULL /* conn */,
- path, revision,
- pool, pool));
-
- /* We will try again with our new path; however, we're now
- * technically an unversioned resource because we are accessing
- * the revision's baseline-collection.
- */
- revision = SVN_INVALID_REVNUM;
+ url, revision,
+ scratch_pool, scratch_pool));
}
- SVN_ERR(svn_ra_serf__retrieve_props(&props, session, session->conns[0],
- path, SVN_INVALID_REVNUM, "0",
- desired_props, pool, pool));
-
- *ret_path = path;
- *ret_props = props;
+ /* URL is stable, so we use SVN_INVALID_REVNUM since it is now irrelevant.
+ Or we started with SVN_INVALID_REVNUM and URL may be floating. */
+ SVN_ERR(svn_ra_serf__fetch_node_props(props, session->conns[0],
+ url, SVN_INVALID_REVNUM,
+ desired_props,
+ result_pool, scratch_pool));
return SVN_NO_ERROR;
}
@@ -613,11 +603,10 @@ svn_ra_serf__check_path(svn_ra_session_t
{
svn_ra_serf__session_t *session = ra_session->priv;
apr_hash_t *props;
- const char *path;
- svn_error_t *err = fetch_path_props(&props, &path,
- session, rel_path,
- revision, check_path_props, pool);
+ svn_error_t *err = fetch_path_props(&props, session, rel_path,
+ revision, check_path_props,
+ pool, pool);
if (err && err->apr_err == SVN_ERR_FS_NOT_FOUND)
{
@@ -630,9 +619,9 @@ svn_ra_serf__check_path(svn_ra_session_t
/* Any other error, raise to caller. */
if (err)
- return err;
+ return svn_error_trace(err);
- SVN_ERR(svn_ra_serf__get_resource_type(&res_kind, props, path));
+ SVN_ERR(svn_ra_serf__get_resource_type(&res_kind, props));
*kind = svn__node_kind_from_kind(res_kind);
}
@@ -852,15 +841,14 @@ svn_ra_serf__stat(svn_ra_session_t *ra_s
{
svn_ra_serf__session_t *session = ra_session->priv;
apr_hash_t *props;
- const char *path;
svn_error_t *err;
struct dirent_walker_baton_t dwb;
svn_tristate_t deadprop_count = svn_tristate_unknown;
- err = fetch_path_props(&props, &path,
+ err = fetch_path_props(&props,
session, rel_path, revision,
get_dirent_props(SVN_DIRENT_ALL, session, pool),
- pool);
+ pool, pool);
if (err)
{
if (err->apr_err == SVN_ERR_FS_NOT_FOUND)
@@ -876,9 +864,7 @@ svn_ra_serf__stat(svn_ra_session_t *ra_s
dwb.entry = apr_pcalloc(pool, sizeof(*dwb.entry));
dwb.supports_deadprop_count = &deadprop_count;
dwb.result_pool = pool;
- SVN_ERR(svn_ra_serf__walk_all_props(props, path, SVN_INVALID_REVNUM,
- dirent_walker, &dwb,
- pool));
+ SVN_ERR(svn_ra_serf__walk_node_props(props, dirent_walker, &dwb, pool));
if (deadprop_count == svn_tristate_false
&& session->supports_deadprop_count == svn_tristate_unknown
@@ -888,14 +874,12 @@ svn_ra_serf__stat(svn_ra_session_t *ra_s
information */
session->supports_deadprop_count = svn_tristate_false;
- SVN_ERR(fetch_path_props(&props, &path,
+ SVN_ERR(fetch_path_props(&props,
session, rel_path, SVN_INVALID_REVNUM,
get_dirent_props(SVN_DIRENT_ALL, session, pool),
- pool));
+ pool, pool));
- SVN_ERR(svn_ra_serf__walk_all_props(props, path, SVN_INVALID_REVNUM,
- dirent_walker, &dwb,
- pool));
+ SVN_ERR(svn_ra_serf__walk_node_props(props, dirent_walker, &dwb, pool));
}
if (deadprop_count != svn_tristate_unknown)
@@ -911,12 +895,11 @@ svn_ra_serf__stat(svn_ra_session_t *ra_s
* SVN_ERR_FS_NOT_DIRECTORY if not.
*/
static svn_error_t *
-resource_is_directory(apr_hash_t *props,
- const char *path)
+resource_is_directory(apr_hash_t *props)
{
svn_kind_t kind;
- SVN_ERR(svn_ra_serf__get_resource_type(&kind, props, path));
+ SVN_ERR(svn_ra_serf__get_resource_type(&kind, props));
if (kind != svn_kind_dir)
{
@@ -967,6 +950,7 @@ svn_ra_serf__get_dir(svn_ra_session_t *r
{
struct path_dirent_visitor_t dirent_walk;
apr_hash_t *props;
+ const char *rtype;
/* Always request node kind to check that path is really a
* directory.
@@ -979,7 +963,10 @@ svn_ra_serf__get_dir(svn_ra_session_t *r
pool, pool));
/* Check if the path is really a directory. */
- SVN_ERR(resource_is_directory(props, path));
+ rtype = svn_ra_serf__get_prop(props, path, "DAV:", "resourcetype");
+ if (rtype == NULL || strcmp(rtype, "collection") != 0)
+ return svn_error_create(SVN_ERR_FS_NOT_DIRECTORY, NULL,
+ _("Can't get entries of non-directory"));
/* 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
@@ -1028,15 +1015,17 @@ svn_ra_serf__get_dir(svn_ra_session_t *r
{
apr_hash_t *props;
- SVN_ERR(svn_ra_serf__retrieve_props(&props, session, session->conns[0],
- path, SVN_INVALID_REVNUM, "0",
- all_props,
- pool, pool));
+ SVN_ERR(svn_ra_serf__fetch_node_props(&props, session->conns[0],
+ path, SVN_INVALID_REVNUM,
+ all_props,
+ pool, pool));
/* Check if the path is really a directory. */
- SVN_ERR(resource_is_directory(props, path));
+ SVN_ERR(resource_is_directory(props));
- SVN_ERR(svn_ra_serf__flatten_props(ret_props, props, path, pool, pool));
+ /* ### flatten_props() does not copy PROPVALUE, but fetch_node_props()
+ ### put them into POOL, so we're okay. */
+ SVN_ERR(svn_ra_serf__flatten_props(ret_props, props, 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=1336639&r1=1336638&r2=1336639&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/update.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/update.c Thu May 10 12:40:59 2012
@@ -2909,13 +2909,13 @@ svn_ra_serf__get_file(svn_ra_session_t *
/* REVISION is always SVN_INVALID_REVNUM */
SVN_ERR_ASSERT(!SVN_IS_VALID_REVNUM(revision));
- SVN_ERR(svn_ra_serf__retrieve_props(&fetch_props, session, conn, fetch_url,
- SVN_INVALID_REVNUM, "0",
- props ? all_props : check_path_props,
- pool, pool));
+ SVN_ERR(svn_ra_serf__fetch_node_props(&fetch_props, conn, fetch_url,
+ SVN_INVALID_REVNUM,
+ props ? all_props : check_path_props,
+ pool, pool));
- /* Verify that resource type is not colelction. */
- SVN_ERR(svn_ra_serf__get_resource_type(&res_kind, fetch_props, fetch_url));
+ /* Verify that resource type is not collection. */
+ SVN_ERR(svn_ra_serf__get_resource_type(&res_kind, fetch_props));
if (res_kind != svn_kind_file)
{
return svn_error_create(SVN_ERR_FS_NOT_FILE, NULL,
@@ -2925,7 +2925,9 @@ svn_ra_serf__get_file(svn_ra_session_t *
/* TODO Filter out all of our props into a usable format. */
if (props)
{
- SVN_ERR(svn_ra_serf__flatten_props(props, fetch_props, fetch_url,
+ /* ### flatten_props() does not copy PROPVALUE, but fetch_node_props()
+ ### put them into POOL, so we're okay. */
+ SVN_ERR(svn_ra_serf__flatten_props(props, fetch_props,
pool, pool));
}
Modified: subversion/trunk/subversion/libsvn_ra_serf/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/util.c?rev=1336639&r1=1336638&r2=1336639&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/util.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/util.c Thu May 10 12:40:59 2012
@@ -38,6 +38,7 @@
#include "svn_private_config.h"
#include "svn_string.h"
#include "svn_xml.h"
+#include "svn_props.h"
#include "../libsvn_ra/ra_loader.h"
#include "private/svn_dep_compat.h"
@@ -2038,6 +2039,7 @@ svn_ra_serf__request_create(svn_ra_serf_
setup_request_cb, handler);
}
+
svn_error_t *
svn_ra_serf__discover_vcc(const char **vcc_url,
svn_ra_serf__session_t *session,
@@ -2070,23 +2072,22 @@ svn_ra_serf__discover_vcc(const char **v
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);
+ err = svn_ra_serf__fetch_node_props(&props, conn,
+ path, SVN_INVALID_REVNUM,
+ base_props, pool, pool);
if (! err)
{
- *vcc_url =
- svn_ra_serf__get_prop(props, path,
- "DAV:",
- "version-controlled-configuration");
-
- relative_path = svn_ra_serf__get_prop(props, path,
- SVN_DAV_PROP_NS_DAV,
- "baseline-relative-path");
-
- uuid = svn_ra_serf__get_prop(props, path,
- SVN_DAV_PROP_NS_DAV,
- "repository-uuid");
+ apr_hash_t *ns_props;
+
+ ns_props = apr_hash_get(props, "DAV:", 4);
+ *vcc_url = svn_prop_get_value(ns_props,
+ "version-controlled-configuration");
+
+ ns_props = apr_hash_get(props,
+ SVN_DAV_PROP_NS_DAV, APR_HASH_KEY_STRING);
+ relative_path = svn_prop_get_value(ns_props,
+ "baseline-relative-path");
+ uuid = svn_prop_get_value(ns_props, "repository-uuid");
break;
}
else