You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by cm...@apache.org on 2010/02/02 19:21:01 UTC
svn commit: r905741 - in /subversion/trunk/subversion/libsvn_ra_neon:
fetch.c options.c ra_neon.h session.c
Author: cmpilato
Date: Tue Feb 2 18:20:59 2010
New Revision: 905741
URL: http://svn.apache.org/viewvc?rev=905741&view=rev
Log:
Teach ra_neon to use OPTIONS requests for youngest-rev checks where
HTTPv2 is available (versus a batch of PROPFINDs).
(This shaves off 6% of the update_tests.py network requests.)
* subversion/libsvn_ra_neon/ra_neon.h
(svn_ra_neon__exchange_capabilities): Add 'youngest_rev' parameter.
* subversion/libsvn_ra_neon/options.c
(parse_capabilities): Add 'youngest_rev' parameter, and populate it
with data from the OPTIONS request if so provided.
(svn_ra_neon__exchange_capabilities): Add 'youngest_rev' parameter,
populated from the OPTIONS request if possible. Update call to
parse_capabilities().
(svn_ra_neon__get_activity_collection, svn_ra_neon__has_capability):
Update calls to svn_ra_neon__exchange_capabilities().
* subversion/libsvn_ra_neon/fetch.c
(svn_ra_neon__get_latest_revnum): If HTTPv2 is available, use an
OPTIONS request to fetch the latest revision. While here, remove
stale comment.
* subversion/libsvn_ra_neon/session.c
(svn_ra_neon__open): Update call to svn_ra_neon__exchange_capabilities().
Modified:
subversion/trunk/subversion/libsvn_ra_neon/fetch.c
subversion/trunk/subversion/libsvn_ra_neon/options.c
subversion/trunk/subversion/libsvn_ra_neon/ra_neon.h
subversion/trunk/subversion/libsvn_ra_neon/session.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=905741&r1=905740&r2=905741&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_neon/fetch.c (original)
+++ subversion/trunk/subversion/libsvn_ra_neon/fetch.c Tue Feb 2 18:20:59 2010
@@ -1092,15 +1092,25 @@
{
svn_ra_neon__session_t *ras = session->priv;
- /* ### should we perform an OPTIONS to validate the server we're about
- ### to talk to? */
-
- /* we don't need any of the baseline URLs and stuff, but this does
- give us the latest revision number */
- SVN_ERR(svn_ra_neon__get_baseline_info(NULL, NULL, NULL, latest_revnum,
- ras, ras->root.path,
- SVN_INVALID_REVNUM, pool));
-
+ /* If we detected HTTPv2 support, we can fetch the youngest revision
+ from a quick OPTIONS request instead of via a batch of
+ PROPFINDs. */
+ if (SVN_RA_NEON__HAVE_HTTPV2_SUPPORT(ras))
+ {
+ SVN_ERR(svn_ra_neon__exchange_capabilities(ras, latest_revnum, pool));
+ if (! SVN_IS_VALID_REVNUM(*latest_revnum))
+ return svn_error_create(SVN_ERR_RA_DAV_OPTIONS_REQ_FAILED, NULL,
+ _("The OPTIONS response did not include "
+ "the youngest revision"));
+ }
+ else
+ {
+ /* We don't need any of the baseline URLs and stuff, but this
+ does give us the latest revision number. */
+ SVN_ERR(svn_ra_neon__get_baseline_info(NULL, NULL, NULL, latest_revnum,
+ ras, ras->root.path,
+ SVN_INVALID_REVNUM, pool));
+ }
SVN_ERR(svn_ra_neon__maybe_store_auth_info(ras, pool));
return NULL;
Modified: subversion/trunk/subversion/libsvn_ra_neon/options.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_neon/options.c?rev=905741&r1=905740&r2=905741&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_neon/options.c (original)
+++ subversion/trunk/subversion/libsvn_ra_neon/options.c Tue Feb 2 18:20:59 2010
@@ -128,14 +128,21 @@
/* Store in RAS the capabilities and other interesting tidbits of
information discovered from REQ's headers. Use POOL for temporary
- allocation only. */
+ allocation only.
+
+ Also, set *YOUNGEST_REV to the current youngest revision if we can
+ detect that from the OPTIONS exchange; set it to SVN_INVALID_REVNUM
+ otherwise. */
static void
parse_capabilities(ne_request *req,
svn_ra_neon__session_t *ras,
+ svn_revnum_t *youngest_rev,
apr_pool_t *pool)
{
const char *val;
+ *youngest_rev = SVN_INVALID_REVNUM;
+
/* Start out assuming all capabilities are unsupported. */
apr_hash_set(ras->capabilities, SVN_RA_CAPABILITY_DEPTH,
APR_HASH_KEY_STRING, capability_no);
@@ -197,11 +204,10 @@
}
/* Not strictly capabilities, but while we're here, we might as well... */
-#if 0
if ((val = ne_get_response_header(req, SVN_DAV_YOUNGEST_REV_HEADER)))
{
+ *youngest_rev = SVN_STR_TO_REV(val);
}
-#endif
if ((val = ne_get_response_header(req, SVN_DAV_REPOS_UUID_HEADER)))
{
ras->uuid = apr_pstrdup(ras->pool, val);
@@ -243,6 +249,7 @@
svn_error_t *
svn_ra_neon__exchange_capabilities(svn_ra_neon__session_t *ras,
+ svn_revnum_t *youngest_rev,
apr_pool_t *pool)
{
svn_ra_neon__request_t* req;
@@ -255,6 +262,8 @@
oc.pool = pool;
oc.cdata = svn_stringbuf_create("", pool);
+ *youngest_rev = SVN_INVALID_REVNUM;
+
req = svn_ra_neon__request_create(ras, "OPTIONS", ras->url->data, pool);
/* ### Use a symbolic name somewhere for this MIME type? */
@@ -298,7 +307,7 @@
}
ras->act_coll = apr_pstrdup(ras->pool, oc.activity_coll->data);
- parse_capabilities(req->ne_req, ras, pool);
+ parse_capabilities(req->ne_req, ras, youngest_rev, pool);
cleanup:
svn_ra_neon__request_destroy(req);
@@ -312,8 +321,9 @@
svn_ra_neon__session_t *ras,
apr_pool_t *pool)
{
+ svn_revnum_t ignored_revnum;
if (! ras->act_coll)
- SVN_ERR(svn_ra_neon__exchange_capabilities(ras, pool));
+ SVN_ERR(svn_ra_neon__exchange_capabilities(ras, &ignored_revnum, pool));
*activity_coll = svn_string_create(ras->act_coll, pool);
return SVN_NO_ERROR;
}
@@ -341,7 +351,10 @@
/* If any capability is unknown, they're all unknown, so ask. */
if (cap_result == NULL)
- SVN_ERR(svn_ra_neon__exchange_capabilities(ras, pool));
+ {
+ svn_revnum_t ignored_revnum;
+ SVN_ERR(svn_ra_neon__exchange_capabilities(ras, &ignored_revnum, pool));
+ }
/* Try again, now that we've fetched the capabilities. */
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=905741&r1=905740&r2=905741&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_neon/ra_neon.h (original)
+++ subversion/trunk/subversion/libsvn_ra_neon/ra_neon.h Tue Feb 2 18:20:59 2010
@@ -1087,10 +1087,15 @@
RAS->capabilities with the server's capabilities as read from the
response headers. Use POOL only for temporary allocation.
- NOTE: This function also expects the server to announce the
+ If the server is kind enough to tell us the current youngest
+ revision of the target repository, set *YOUNGEST_REV to that value;
+ set it to SVN_INVALID_REVNUM otherwise.
+
+ NOTE: This function also expects the server to announce the
activity collection. */
svn_error_t *
svn_ra_neon__exchange_capabilities(svn_ra_neon__session_t *ras,
+ svn_revnum_t *youngest_rev,
apr_pool_t *pool);
/*
Modified: subversion/trunk/subversion/libsvn_ra_neon/session.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_neon/session.c?rev=905741&r1=905740&r2=905741&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_neon/session.c (original)
+++ subversion/trunk/subversion/libsvn_ra_neon/session.c Tue Feb 2 18:20:59 2010
@@ -768,6 +768,7 @@
apr_pcalloc(pool, sizeof(*neonprogress_baton));
const char *useragent = NULL;
const char *client_string = NULL;
+ svn_revnum_t ignored_revnum;
if (callbacks->get_client_string)
callbacks->get_client_string(callback_baton, &client_string, pool);
@@ -1046,7 +1047,7 @@
ne_set_progress(sess2, ra_neon_neonprogress, neonprogress_baton);
session->priv = ras;
- return svn_ra_neon__exchange_capabilities(ras, pool);
+ return svn_ra_neon__exchange_capabilities(ras, &ignored_revnum, pool);
}