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

code to check if ra_replay is supported

From: David Glasser <glasser_at_mit.edu>
Date: 2006-08-24 17:48:55 CEST

For SVN::Mirror we'll need to check if the server supports ra_replay,
and fallback to its current mirror mode if not. I think the following
should work for determining if a server supports ra_replay; it tries
to replay r0 and sets a boolean based on whether or not this throws an
"unsupported" error (and rethrows other errors).

Sanity-checking would be appreciated (Garrett?). And does anyone
think this code should be put somewhere in the repo?

--dave

static svn_error_t *
supports_ra_replay(svn_boolean_t *support,
                   svn_ra_session_t *ra,
                   apr_pool_t *pool)
{
  const svn_delta_editor_t *default_ed;
  svn_error_t *err;

  default_ed = svn_delta_default_editor(pool);

  err = svn_ra_replay(ra,
                      0,
                      0,
                      FALSE,
                      default_ed,
                      NULL,
                      pool);

  if (err)
    {
      if (err->apr_err == SVN_ERR_UNSUPPORTED_FEATURE)
        {
          svn_error_clear(err);
          *support = FALSE;
        }
      else
        {
          SVN_ERR(err);
        }
    }
  else
    {
      *support = TRUE;
    }

  return SVN_NO_ERROR;
}

-- 
David Glasser | glasser_at_mit.edu | http://www.davidglasser.net/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Aug 24 17:51:12 2006

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.