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

Re: static linking broken in trunk since commit of clientstring feature

From: C. Michael Pilato <cmpilato_at_collab.net>
Date: 2007-12-17 22:09:05 CET

Eric Gillespie wrote:
>> I don't think that will work. Last time I wanted to add something to
>> svn_client_ctx_t and use it in the ra-layers, it didn't work because
>> svn_client_ctx_t is *not* passed down there (at least not as far down as
>> I needed it to). And I don't like to change APIs or introduce a whole
>
> I don't know what you were doing before, but in this case, you're
> just copying the function pointer from the ctx to the callbacks
> in libsvn_client/ra.c:svn_client__open_ra_session_internal .

Maybe this can serve as a good head start for you, Stefan? It's untested,
but does reflect the basic idea Eric and I are thinking of.

Index: subversion/include/svn_client.h
===================================================================
--- subversion/include/svn_client.h (revision 28513)
+++ subversion/include/svn_client.h (working copy)
@@ -857,6 +857,10 @@
   svn_wc_conflict_resolver_func_t conflict_func;
   void *conflict_baton;

+ /** Custom client name string, or @c null.
+ * @since New in 1.5. */
+ const char *client_name;
+
 } svn_client_ctx_t;

 /** @} end group: Client context management */
Index: subversion/include/svn_ra.h
===================================================================
--- subversion/include/svn_ra.h (revision 28513)
+++ subversion/include/svn_ra.h (working copy)
@@ -117,6 +117,16 @@
   (void *session_baton,
    svn_revnum_t *latest_revnum);

+/** A function type which allows the RA layer to ask about any
+ * customizations to the client name string. This is primarily used
+ * by HTTP-based RA layers wishing to extend the string reported to
+ * Apache/mod_dav_svn via the User-agent HTTP header.
+ */
+typedef svn_error_t *(*svn_ra_get_client_string_func_t)(void *baton,
+ const char **name,
+ apr_pool_t *pool);
+
+
 /**
  * A callback function type for use in @c get_file_revs.
  * @a baton is provided by the caller, @a path is the pathname of the file
@@ -488,10 +498,16 @@
    */
   svn_cancel_func_t cancel_func;

+ /** Client string customization callback function
+ * @since New in 1.5
+ */
+ svn_ra_get_client_string_func_t get_client_string;
+
 } svn_ra_callbacks2_t;

 /** Similar to svn_ra_callbacks2_t, except that the progress
- * notification function and baton is missing.
+ * notification function and baton, cancellation function, and client
+ * string customization function are missing.
  *
  * @deprecated Provided for backward compatibility with the 1.2 API.
  */
Index: subversion/libsvn_client/ra.c
===================================================================
--- subversion/libsvn_client/ra.c (revision 28513)
+++ subversion/libsvn_client/ra.c (working copy)
@@ -268,6 +268,17 @@
   return (b->ctx->cancel_func)(b->ctx->cancel_baton);
 }

+
+static svn_error_t *
+get_client_string(void *baton,
+ const char **name,
+ apr_pool_t *pool)
+{
+ svn_client__callback_baton_t *b = baton;
+ *name = apr_pstrdup(pool, b->ctx->client_name);
+ return SVN_NO_ERROR;
+}
+
 svn_error_t *
 svn_client__open_ra_session_internal(svn_ra_session_t **ra_session,
                                      const char *base_url,
@@ -291,6 +302,7 @@
   cbtable->progress_func = ctx->progress_func;
   cbtable->progress_baton = ctx->progress_baton;
   cbtable->cancel_func = ctx->cancel_func ? cancel_callback : NULL;
+ cbtable->get_client_string = get_client_string;

   cb->base_dir = base_dir;
   cb->base_access = base_access;

-- 
C. Michael Pilato <cmpilato@collab.net>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand

Received on Mon Dec 17 22:09:16 2007

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