"Peter N. Lundblad" <peter@famlundblad.se> writes:
> What you asked for, Sir. A patch is below with this, obviously incomplete,
> just for illustration.
>
> the idea is that svn_client_create_context set the new func/baton to
> something that will forward to the old deprecated stuff. If the user sets
> the old func/baton, she will get notification as before. If she set the
> new function, the old stuff will not be called, but that shouldn't be a
> problem.
Thank you. I don't know why I didn't see that myself, it makes
perfect sense now. +1.
-Karl
> Index: subversion/include/svn_wc.h
> ===================================================================
> --- subversion/include/svn_wc.h (revision 13218)
> +++ subversion/include/svn_wc.h (arbetskopia)
> @@ -564,6 +564,26 @@
> } svn_wc_notify_state_t;
>
>
> +/** @since New in 1.2. */
> +typedef struct svn_wc_notify_t {
> + svn_wc_notify_action_t action;
> + svn_node_kind_t kind;
> + const char *mime_type;
> + svn_wc_notify_state_t content_state;
> + svn_wc_notify_state_t prop_state;
> + svn_revnum_t revision;
> +} svn_wc_notify_t;
> +
> +/** @since New in 1.2. */
> +svn_wc_notify_t *
> +svn_wc_create_notify (apr_pool_t *pool);
> +
> +/** @since New in 1.2. */
> +typedef void (*svn_wc_notify_func2_t) (void *baton,
> + const char *path,
> + const svn_wc_notify_t *notify,
> + apr_pool_t *pool);
> +
> /** Notify the world that @a action has happened to @a path. @a path is
> * either absolute or relative to cwd (i.e., not relative to an anchor).
> *
> Index: subversion/include/svn_client.h
> ===================================================================
> --- subversion/include/svn_client.h (revision 13218)
> +++ subversion/include/svn_client.h (arbetskopia)
> @@ -360,10 +360,12 @@
> /** main authentication baton. */
> svn_auth_baton_t *auth_baton;
>
> - /** notification callback function */
> + /** @deprecated Provided for backwards compatibility with the 1.1 API.
> + notification callback function.
> + This will be called by @c notify_func2 by default. */
> svn_wc_notify_func_t notify_func;
>
> - /** notification callback baton */
> + /** notification callback baton for the above */
> void *notify_baton;
>
> /** log message callback function */
> @@ -386,6 +388,11 @@
> /** a baton to pass to the cancellation callback. */
> void *cancel_baton;
>
> + /** notification function, defaulting to a function that fowrads
> + to @c notify_func. */
> + svn_wc_notify_func2_t notify_func2;
> + /** notification baton for the above. */
> + void *notify_baton2;
> } svn_client_ctx_t;
>
>
> Index: subversion/libsvn_client/ctx.c
> ===================================================================
> --- subversion/libsvn_client/ctx.c (revision 13218)
> +++ subversion/libsvn_client/ctx.c (arbetskopia)
> @@ -29,10 +29,25 @@
>
> /*** Code. ***/
>
> +/* Call the notify_func of the context provided by BATON, if non-NULL. */
> +static void
> +call_notify_func (void *baton, const char *path, const svn_wc_notify_t *n,
> + apr_pool_t *pool)
> +{
> + const svn_client_ctx_t *ctx = baton;
> +
> + if (ctx->notify_func)
> + ctx->notify_func (ctx->notify_baton, path, n->action, n->kind,
> + n->mime_type, n->content_state, n->prop_state,
> + n->revision);
> +}
> +
> svn_error_t *
> svn_client_create_context (svn_client_ctx_t **ctx,
> apr_pool_t *pool)
> {
> *ctx = apr_pcalloc (pool, sizeof (svn_client_ctx_t));
> + (*ctx)->notify_func2 = call_notify_func;
> + (*ctx)->notify_baton2 = *ctx;
> return SVN_NO_ERROR;
> }
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Mar 2 18:31:03 2005