[[[ For issue #2959: fooo * subversion/include/svn_dav.h (SVN_DAV_PROP_NS_DAV_SVN_DEPTH): New header for response to OPTIONS request. * subversion/mod_dav_svn/version.c (get_vsn_options): Add above new header to OPTIONS response. * subversion/libsvn_ra/ra_loader.h (svn_ra__vtable_t): Add new has_capability() prototype. * subversion/include/svn_ra.h (svn_ra_has_capability): New prototype. (SVN_RA_CAPABILITY_DEPTH): New constant. * subversion/libsvn_ra/ra_loader.c (svn_ra_has_capability): New function definition. * subversion/libsvn_ra_neon/ra_neon.h (svn_ra_neon__has_capability): New prototype. (svn_ra_neon__session_t): Add new 'capabilities' hash. * subversion/libsvn_ra_neon/session.c (svn_ra_neon__has_capability): New function definition. ]]] Index: subversion/libsvn_ra/ra_loader.c =================================================================== --- subversion/libsvn_ra/ra_loader.c (revision 27088) +++ subversion/libsvn_ra/ra_loader.c (working copy) @@ -1020,6 +1020,14 @@ text_deltas, editor, edit_baton, pool); } +svn_error_t *svn_ra_has_capability(svn_ra_session_t *session, + svn_boolean_t *has, + const char *capability, + apr_pool_t *pool) +{ + return session->vtable->has_capability(session, has, capability, pool); +} + svn_error_t * Index: subversion/libsvn_ra/ra_loader.h =================================================================== --- subversion/libsvn_ra/ra_loader.h (revision 27088) +++ subversion/libsvn_ra/ra_loader.h (working copy) @@ -224,6 +224,10 @@ const svn_delta_editor_t *editor, void *edit_baton, apr_pool_t *pool); + svn_error_t *(*has_capability)(svn_ra_session_t *session, + svn_boolean_t *has, + const char *capability, + apr_pool_t *pool); } svn_ra__vtable_t; /* The RA session object. */ Index: subversion/include/svn_dav.h =================================================================== --- subversion/include/svn_dav.h (revision 27088) +++ subversion/include/svn_dav.h (working copy) @@ -149,6 +149,10 @@ */ #define SVN_DAV_PROP_NS_DAV "http://subversion.tigris.org/xmlns/dav/" +/* Presence of this in the DAV header response to an OPTIONS request + indicates that the server supports @c svn_depth_t. */ +#define SVN_DAV_PROP_NS_DAV_SVN_DEPTH SVN_DAV_PROP_NS_DAV "svn/depth" + /** @} */ #ifdef __cplusplus Index: subversion/include/svn_ra.h =================================================================== --- subversion/include/svn_ra.h (revision 27088) +++ subversion/include/svn_ra.h (working copy) @@ -1488,6 +1488,29 @@ apr_pool_t *pool); /** + * Set @a *has to true if the server represented by @a session has + * capability @a capability (one of the capabilities beginning with + * @c "SVN_RA_CAPABILITY_"), else set @a *has to false. + * + * Use @a pool for all allocation. + * + * @since New in 1.5. + */ +svn_error_t *svn_ra_has_capability(svn_ra_session_t *session, + svn_boolean_t *has, + const char *capability, + apr_pool_t *pool); + +/** + * The capability of understanding @c svn_depth_t (e.g., the server + * understands what the client means when the client describes the + * depth of a working copy to the server.) + * + * @since New in 1.5. + */ +#define SVN_RA_CAPABILITY_DEPTH "depth" + +/** * Append a textual list of all available RA modules to the stringbuf * @a output. * Index: subversion/libsvn_ra_neon/session.c =================================================================== --- subversion/libsvn_ra_neon/session.c (revision 27088) +++ subversion/libsvn_ra_neon/session.c (working copy) @@ -788,6 +788,7 @@ ras->compression = compression; ras->progress_baton = callbacks->progress_baton; ras->progress_func = callbacks->progress_func; + ras->capabilities = apr_hash_make(session->pool); /* save config and server group in the auth parameter hash */ svn_auth_set_parameter(ras->callbacks->auth_baton, SVN_AUTH_PARAM_CONFIG, cfg); @@ -962,6 +963,47 @@ } +svn_error_t * +svn_ra_neon__has_capability(svn_ra_session_t *session, + svn_boolean_t *has, + const char *capability, + apr_pool_t *pool) +{ + svn_ra_neon__session_t *ras = session->priv; + void *ne_header_cursor = NULL; + const char *header_name; + const char *header_value; + options_ctx_t oc = { 0 }; + + oc.pool = pool; + oc.cdata = svn_stringbuf_create("", pool); + + SVN_ERR(svn_ra_neon__parsed_request(ras, "OPTIONS", url, + "" + "" + /* empty body */ + "", 0, NULL, + start_element, + svn_ra_neon__xml_collect_cdata, + end_element, &oc, + NULL, NULL, FALSE, pool)); + + do { + ne_header_cursor = ne_response_header_iterate(ne_request *req, + ne_header_cursor, + &header_name, + &header_value); + if (ne_header_cursor) + { + fooo; + } + } while (ne_header_cursor); + + return SVN_NO_ERROR; +} + + static const svn_version_t * ra_neon_version(void) { Index: subversion/libsvn_ra_neon/ra_neon.h =================================================================== --- subversion/libsvn_ra_neon/ra_neon.h (revision 27088) +++ subversion/libsvn_ra_neon/ra_neon.h (working copy) @@ -100,6 +100,13 @@ svn_ra_progress_notify_func_t progress_func; void *progress_baton; + + /* Maps SVN_RA_CAPABILITY_foo keys to "YES" or "NO" values; if a + capability is not yet discovered, it is absent from the table. + The table itself is allocated in the svn_ra_session_t's pool; + keys and values must have at least that lifetime (most likely + they are constants anyway). */ + apr_hash_t *capabilities; } svn_ra_neon__session_t; @@ -988,6 +995,15 @@ void *edit_baton, apr_pool_t *pool); +/* + * Implements the has_capability RA layer function. */ +svn_error_t * +svn_ra_neon__has_capability(svn_ra_session_t *session, + svn_boolean_t *has, + const char *capability, + apr_pool_t *pool); + + /* Helper function. Loop over LOCK_TOKENS and assemble all keys and values into a stringbuf allocated in POOL. The string will be of the form Index: subversion/mod_dav_svn/version.c =================================================================== --- subversion/mod_dav_svn/version.c (revision 27088) +++ subversion/mod_dav_svn/version.c (working copy) @@ -133,8 +133,8 @@ "version-control,checkout,working-resource"); apr_text_append(p, phdr, "merge,baseline,activity,version-controlled-collection"); - /* ### fork-control? */ + apr_text_append(p, phdr, SVN_DAV_PROP_NS_DAV_SVN_DEPTH); } Index: subversion/libsvn_ra_svn/protocol =================================================================== --- subversion/libsvn_ra_svn/protocol (revision 27088) +++ subversion/libsvn_ra_svn/protocol (working copy) @@ -188,6 +188,9 @@ See section 3.1.1. [S] mergeinfo If the server presents this capability, it supports the get-mergeinfo command. See section 3.1.1. +[S] depth If the server presents this capability, it understands + requested operational depth (see section 3.1.1) and + per-path ambient depth (see section 3.1.3). 3. Commands -----------