You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by David Glasser <gl...@mit.edu> on 2006/08/24 15:48:55 UTC

code to check if ra_replay is supported

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@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

Re: code to check if ra_replay is supported

Posted by Garrett Rooney <ro...@electricjellyfish.net>.
On 8/24/06, David Glasser <gl...@mit.edu> wrote:
> 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?

That's pretty much what I'd do, although I'd probably just try to sync
the revision in question, then catch the unsupported error and do it
the other way in that case.  Seems better than trying to do a no-op
replay.

-garrett

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org