[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r34914 - branches/http-protocol-v2/subversion/libsvn_ra_serf

From: Greg Stein <gstein_at_gmail.com>
Date: Wed, 24 Dec 2008 08:56:28 -0800

The old-fashioned code can cache the youngest rev.

It also looks like the key compare is bad. How can you compare to
"svn"? Do you mean to compare just the first three letters?

On Dec 23, 2008, at 20:06, Ben Collins-Sussman <sussman_at_red-bean.com>
wrote:

> Author: sussman
> Date: Tue Dec 23 20:06:49 2008
> New Revision: 34914
>
> Log:
> Make serf notice and hold onto the v2 "stubs" in its session_t.
> This should happen right in the initial ra_open() call, when the RA
> session kicks off.
>
> * subversion/libsvn_ra_serf/options.c
> (capabilities_headers_iterator_callback): notice the new v2 stub
> headers, and save the values in the master session_t.
>
> * subversion/libsvn_ra_serf/ra_serf.h
> (struct svn_ra_serf__session_t): add (cached) youngest_rev field.
>
> * subversion/libsvn_ra_serf/serf.c
> (svn_ra_serf__open): initialize session's youngest_rev field.
> (svn_ra_serf__get_latest_revnum): try to return cached
> youngest_rev first!
>
> Modified:
> branches/http-protocol-v2/subversion/libsvn_ra_serf/options.c
> branches/http-protocol-v2/subversion/libsvn_ra_serf/ra_serf.h
> branches/http-protocol-v2/subversion/libsvn_ra_serf/serf.c
>
> Modified: branches/http-protocol-v2/subversion/libsvn_ra_serf/
> options.c
> URL: http://svn.collab.net/viewvc/svn/branches/http-protocol-v2/subversion/libsvn_ra_serf/options.c?pathrev=34914&r1=34913&r2=34914
> ===
> ===
> ===
> =====================================================================
> --- branches/http-protocol-v2/subversion/libsvn_ra_serf/options.c
> Tue Dec 23 18:57:28 2008 (r34913)
> +++ branches/http-protocol-v2/subversion/libsvn_ra_serf/options.c
> Tue Dec 23 20:06:49 2008 (r34914)
> @@ -310,6 +310,22 @@ capabilities_headers_iterator_callback(v
> }
> }
>
> + /* SVN-specific headers -- if present, server supports HTTP
> protocol v2 */
> + if (svn_cstring_casecmp(key, "svn") == 0)
> + {
> + if (svn_cstring_casecmp(key, SVN_DAV_ROOT_STUB_HEADER) == 0)
> + orc->session->root_stub = apr_pstrdup(orc->session->pool,
> val);
> +
> + if (svn_cstring_casecmp(key, SVN_DAV_PEGREV_STUB_HEADER) == 0)
> + orc->session->pegrev_stub = apr_pstrdup(orc->session->pool,
> val);
> +
> + if (svn_cstring_casecmp(key, SVN_DAV_REV_STUB_HEADER) == 0)
> + orc->session->rev_stub = apr_pstrdup(orc->session->pool,
> val);
> +
> + if (svn_cstring_casecmp(key, SVN_DAV_YOUNGEST_REV_HEADER) == 0)
> + orc->session->youngest_rev = SVN_STR_TO_REV(val);
> + }
> +
> return 0;
> }
>
>
> Modified: branches/http-protocol-v2/subversion/libsvn_ra_serf/
> ra_serf.h
> URL: http://svn.collab.net/viewvc/svn/branches/http-protocol-v2/subversion/libsvn_ra_serf/ra_serf.h?pathrev=34914&r1=34913&r2=34914
> ===
> ===
> ===
> =====================================================================
> --- branches/http-protocol-v2/subversion/libsvn_ra_serf/ra_serf.h
> Tue Dec 23 18:57:28 2008 (r34913)
> +++ branches/http-protocol-v2/subversion/libsvn_ra_serf/ra_serf.h
> Tue Dec 23 20:06:49 2008 (r34914)
> @@ -202,6 +202,10 @@ struct svn_ra_serf__session_t {
> /* Repository UUID */
> const char *uuid;
>
> + /* Cached HEAD revnum of the repository: for v2 protocol, usually
> + returned by initial OPTIONS response. */
> + svn_revnum_t youngest_rev;
> +
> /* Opaque URL "stubs". If the OPTIONS response returns these, then
> we know we're using HTTP protocol v2. */
> const char *root_stub; /* where to send REPORT requests */
>
> Modified: branches/http-protocol-v2/subversion/libsvn_ra_serf/serf.c
> URL: http://svn.collab.net/viewvc/svn/branches/http-protocol-v2/subversion/libsvn_ra_serf/serf.c?pathrev=34914&r1=34913&r2=34914
> ===
> ===
> ===
> =====================================================================
> --- branches/http-protocol-v2/subversion/libsvn_ra_serf/serf.c
> Tue Dec 23 18:57:28 2008 (r34913)
> +++ branches/http-protocol-v2/subversion/libsvn_ra_serf/serf.c
> Tue Dec 23 20:06:49 2008 (r34914)
> @@ -385,6 +385,8 @@ svn_ra_serf__open(svn_ra_session_t *sess
> if (url.path == NULL || url.path[0] == '\0')
> url.path = apr_pstrdup(serf_sess->pool, "/");
>
> + serf_sess->youngest_rev = SVN_INVALID_REVNUM;
> +
> serf_sess->repos_url = url;
> serf_sess->repos_url_str = apr_pstrdup(serf_sess->pool, repos_URL);
>
> @@ -520,6 +522,14 @@ svn_ra_serf__get_latest_revnum(svn_ra_se
> const char *relative_url, *basecoll_url;
> svn_ra_serf__session_t *session = ra_session->priv;
>
> + /* Using HTTP protocol v2; already got it in the initial OPTIONS
> response. */
> + if (SVN_IS_VALID_REVNUM(session->youngest_rev))
> + {
> + *latest_revnum = session->youngest_rev;
> + return SVN_NO_ERROR;
> + }
> +
> + /* Fall back to old-fashioned way of getting it. */
> return svn_ra_serf__get_baseline_info(&basecoll_url, &relative_url,
> session, session-
> >repos_url.path,
> SVN_INVALID_REVNUM,
> latest_revnum,
>
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=495&dsMessageId=991228

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=991726
Received on 2008-12-24 17:56:39 CET

This is an archived mail posted to the Subversion Dev mailing list.