You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by iv...@apache.org on 2011/05/20 15:48:53 UTC
svn commit: r1125391 - in /subversion/trunk/subversion/libsvn_ra_neon:
fetch.c ra_neon.h session.c util.c
Author: ivan
Date: Fri May 20 13:48:53 2011
New Revision: 1125391
URL: http://svn.apache.org/viewvc?rev=1125391&view=rev
Log:
ra_neon: Cache information about deadprop-count support in ra_session object.
* subversion/libsvn_ra_neon/fetch.c
(deadprop_count_support_props): Move to subversion/libsvn_ra_neon/util.c.
(svn_ra_neon__get_dir): Use svn_ra_neon__get_deadprop_count_support()
function instead of requesting this information from server.
* subversion/libsvn_ra_neon/ra_neon.h
(svn_ra_neon__session_t): Add supports_deadprop_count tri-state variable to
cache information about deadprop-count support.
(svn_ra_neon__get_deadprop_count_support): New.
* subversion/libsvn_ra_neon/session.c
(svn_ra_neon__open): Initialize supports_deadprop_count to zero (unknown).
* subversion/libsvn_ra_neon/util.c
(svn_ra_neon__get_deadprop_count_support): New, extracted from
svn_ra_neon__get_dir().
Modified:
subversion/trunk/subversion/libsvn_ra_neon/fetch.c
subversion/trunk/subversion/libsvn_ra_neon/ra_neon.h
subversion/trunk/subversion/libsvn_ra_neon/session.c
subversion/trunk/subversion/libsvn_ra_neon/util.c
Modified: subversion/trunk/subversion/libsvn_ra_neon/fetch.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_neon/fetch.c?rev=1125391&r1=1125390&r2=1125391&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_neon/fetch.c (original)
+++ subversion/trunk/subversion/libsvn_ra_neon/fetch.c Fri May 20 13:48:53 2011
@@ -774,14 +774,6 @@ svn_error_t *svn_ra_neon__get_file(svn_r
return SVN_NO_ERROR;
}
-/* The property we need to fetch to see whether the server we are
- connected to supports the deadprop-count property. */
-static const ne_propname deadprop_count_support_props[] =
-{
- { SVN_DAV_PROP_NS_DAV, "deadprop-count" },
- { NULL }
-};
-
svn_error_t *svn_ra_neon__get_dir(svn_ra_session_t *session,
apr_hash_t **dirents,
svn_revnum_t *fetched_rev,
@@ -830,15 +822,8 @@ svn_error_t *svn_ra_neon__get_dir(svn_ra
targeted PROPFIND. */
if (dirent_fields & SVN_DIRENT_HAS_PROPS)
{
- const svn_string_t *deadprop_count;
-
- SVN_ERR(svn_ra_neon__get_props_resource(&rsrc, ras, final_url, NULL,
- deadprop_count_support_props,
- pool));
- deadprop_count = apr_hash_get(rsrc->propset,
- SVN_RA_NEON__PROP_DEADPROP_COUNT,
- APR_HASH_KEY_STRING);
- supports_deadprop_count = (deadprop_count != NULL);
+ SVN_ERR(svn_ra_neon__get_deadprop_count_support
+ (&supports_deadprop_count, ras, final_url, pool));
}
/* if we didn't ask for the has_props field, we can get individual
Modified: subversion/trunk/subversion/libsvn_ra_neon/ra_neon.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_neon/ra_neon.h?rev=1125391&r1=1125390&r2=1125391&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_neon/ra_neon.h (original)
+++ subversion/trunk/subversion/libsvn_ra_neon/ra_neon.h Fri May 20 13:48:53 2011
@@ -127,6 +127,12 @@ typedef struct svn_ra_neon__session_t {
constants' addresses, therefore). */
apr_hash_t *capabilities;
+ /* Tri-state variable holding information about server support for
+ deadprop-count property. Zero if information still unknown,
+ positive if server support deadprop-count and negative if it
+ does not. */
+ int supports_deadprop_count;
+
/*** HTTP v2 protocol stuff. ***
*
* We assume that if mod_dav_svn sends one of the special v2 OPTIONs
@@ -1173,6 +1179,15 @@ const char *
svn_ra_neon__uri_unparse(const ne_uri *uri,
apr_pool_t *pool);
+/* Sets *SUPPORTS_DEADPROP_COUNT to non-zero if server supports
+ * deadprop-count property. Uses FINAL_URL to discover this informationn
+ * if it is not already cached. */
+svn_error_t *
+svn_ra_neon__get_deadprop_count_support(svn_boolean_t *supported,
+ svn_ra_neon__session_t *ras,
+ const char *final_url,
+ apr_pool_t *pool);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
Modified: subversion/trunk/subversion/libsvn_ra_neon/session.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_neon/session.c?rev=1125391&r1=1125390&r2=1125391&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_neon/session.c (original)
+++ subversion/trunk/subversion/libsvn_ra_neon/session.c Fri May 20 13:48:53 2011
@@ -950,6 +950,7 @@ svn_ra_neon__open(svn_ra_session_t *sess
ras->progress_baton = callbacks->progress_baton;
ras->progress_func = callbacks->progress_func;
ras->capabilities = apr_hash_make(ras->pool);
+ ras->supports_deadprop_count = 0;
ras->vcc = NULL;
ras->uuid = NULL;
/* save config and server group in the auth parameter hash */
Modified: subversion/trunk/subversion/libsvn_ra_neon/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_neon/util.c?rev=1125391&r1=1125390&r2=1125391&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_neon/util.c (original)
+++ subversion/trunk/subversion/libsvn_ra_neon/util.c Fri May 20 13:48:53 2011
@@ -1598,3 +1598,46 @@ svn_ra_neon__uri_unparse(const ne_uri *u
/* Return string allocated in result pool. */
return result;
}
+
+/* Sets *SUPPORTS_DEADPROP_COUNT to non-zero if server supports
+ * deadprop-count property. */
+svn_error_t *
+svn_ra_neon__get_deadprop_count_support(svn_boolean_t *supported,
+ svn_ra_neon__session_t *ras,
+ const char *final_url,
+ apr_pool_t *pool)
+{
+ /* The property we need to fetch to see whether the server we are
+ connected to supports the deadprop-count property. */
+ static const ne_propname deadprop_count_support_props[] =
+ {
+ { SVN_DAV_PROP_NS_DAV, "deadprop-count" },
+ { NULL }
+ };
+
+ /* Check if we already checked deadprop_count support. */
+ if (!ras->supports_deadprop_count)
+ {
+ svn_ra_neon__resource_t *rsrc;
+ const svn_string_t *deadprop_count;
+
+ SVN_ERR(svn_ra_neon__get_props_resource(&rsrc, ras, final_url, NULL,
+ deadprop_count_support_props,
+ pool));
+ deadprop_count = apr_hash_get(rsrc->propset,
+ SVN_RA_NEON__PROP_DEADPROP_COUNT,
+ APR_HASH_KEY_STRING);
+ if (deadprop_count != NULL)
+ {
+ ras->supports_deadprop_count = 1;
+ }
+ else
+ {
+ ras->supports_deadprop_count = -1;
+ }
+ }
+
+ *supported = (ras->supports_deadprop_count > 0);
+
+ return SVN_NO_ERROR;
+}
Re: svn commit: r1125391 - in /subversion/trunk/subversion/libsvn_ra_neon:
fetch.c ra_neon.h session.c util.c
Posted by Ivan Zhakov <iv...@visualsvn.com>.
On Fri, May 20, 2011 at 16:11, Ivan Zhakov <iv...@visualsvn.com> wrote:
> On Fri, May 20, 2011 at 16:07, Greg Stein <gs...@gmail.com> wrote:
>> On Fri, May 20, 2011 at 09:48, <iv...@apache.org> wrote:
>>> - supports_deadprop_count = (deadprop_count != NULL);
>>> + SVN_ERR(svn_ra_neon__get_deadprop_count_support
>>> + (&supports_deadprop_count, ras, final_url, pool));
>>
>> No spaces before func-call parens!
>>
> Oh, sorry. I'm always confused how to put long arguments on next line.
>
Fixed in r1125409.
>>> + /* Tri-state variable holding information about server support for
>>> + deadprop-count property. Zero if information still unknown,
>>> + positive if server support deadprop-count and negative if it
>>> + does not. */
>>> + int supports_deadprop_count;
>>
>> I would suggest svn_tristate_t and its enumerated constants. The bar
>> 0, 1, -1 constants are a big fugly.
>>
> Thanks for pointing! I've just didn't know about it.
>
Fixed in r1125415.
Thank you for review!
--
Ivan Zhakov
Re: svn commit: r1125391 - in /subversion/trunk/subversion/libsvn_ra_neon:
fetch.c ra_neon.h session.c util.c
Posted by Ivan Zhakov <iv...@visualsvn.com>.
On Fri, May 20, 2011 at 16:07, Greg Stein <gs...@gmail.com> wrote:
> On Fri, May 20, 2011 at 09:48, <iv...@apache.org> wrote:
>>...
>> +++ subversion/trunk/subversion/libsvn_ra_neon/fetch.c Fri May 20 13:48:53 2011
>>...
>> @@ -830,15 +822,8 @@ svn_error_t *svn_ra_neon__get_dir(svn_ra
>> targeted PROPFIND. */
>> if (dirent_fields & SVN_DIRENT_HAS_PROPS)
>> {
>> - const svn_string_t *deadprop_count;
>> -
>> - SVN_ERR(svn_ra_neon__get_props_resource(&rsrc, ras, final_url, NULL,
>> - deadprop_count_support_props,
>> - pool));
>> - deadprop_count = apr_hash_get(rsrc->propset,
>> - SVN_RA_NEON__PROP_DEADPROP_COUNT,
>> - APR_HASH_KEY_STRING);
>> - supports_deadprop_count = (deadprop_count != NULL);
>> + SVN_ERR(svn_ra_neon__get_deadprop_count_support
>> + (&supports_deadprop_count, ras, final_url, pool));
>
> No spaces before func-call parens!
>
Oh, sorry. I'm always confused how to put long arguments on next line.
>>...
>> +++ subversion/trunk/subversion/libsvn_ra_neon/ra_neon.h Fri May 20 13:48:53 2011
>> @@ -127,6 +127,12 @@ typedef struct svn_ra_neon__session_t {
>> constants' addresses, therefore). */
>> apr_hash_t *capabilities;
>>
>> + /* Tri-state variable holding information about server support for
>> + deadprop-count property. Zero if information still unknown,
>> + positive if server support deadprop-count and negative if it
>> + does not. */
>> + int supports_deadprop_count;
>
> I would suggest svn_tristate_t and its enumerated constants. The bar
> 0, 1, -1 constants are a big fugly.
>
Thanks for pointing! I've just didn't know about it.
--
Ivan Zhakov
Re: svn commit: r1125391 - in /subversion/trunk/subversion/libsvn_ra_neon:
fetch.c ra_neon.h session.c util.c
Posted by Greg Stein <gs...@gmail.com>.
On Fri, May 20, 2011 at 09:48, <iv...@apache.org> wrote:
>...
> +++ subversion/trunk/subversion/libsvn_ra_neon/fetch.c Fri May 20 13:48:53 2011
>...
> @@ -830,15 +822,8 @@ svn_error_t *svn_ra_neon__get_dir(svn_ra
> targeted PROPFIND. */
> if (dirent_fields & SVN_DIRENT_HAS_PROPS)
> {
> - const svn_string_t *deadprop_count;
> -
> - SVN_ERR(svn_ra_neon__get_props_resource(&rsrc, ras, final_url, NULL,
> - deadprop_count_support_props,
> - pool));
> - deadprop_count = apr_hash_get(rsrc->propset,
> - SVN_RA_NEON__PROP_DEADPROP_COUNT,
> - APR_HASH_KEY_STRING);
> - supports_deadprop_count = (deadprop_count != NULL);
> + SVN_ERR(svn_ra_neon__get_deadprop_count_support
> + (&supports_deadprop_count, ras, final_url, pool));
No spaces before func-call parens!
>...
> +++ subversion/trunk/subversion/libsvn_ra_neon/ra_neon.h Fri May 20 13:48:53 2011
> @@ -127,6 +127,12 @@ typedef struct svn_ra_neon__session_t {
> constants' addresses, therefore). */
> apr_hash_t *capabilities;
>
> + /* Tri-state variable holding information about server support for
> + deadprop-count property. Zero if information still unknown,
> + positive if server support deadprop-count and negative if it
> + does not. */
> + int supports_deadprop_count;
I would suggest svn_tristate_t and its enumerated constants. The bar
0, 1, -1 constants are a big fugly.
>...
Cheers,
-g