Author: kotkov Date: Thu Dec 1 10:15:09 2022 New Revision: 1905662 URL: http://svn.apache.org/viewvc?rev=1905662&view=rev Log: On the 'pristines-on-demand-on-mwf' branch: Expose the working copy text-base sync function as a new public svn_wc API.
* subversion/include/private/svn_wc_private.h (svn_wc__textbase_fetch_cb_t, svn_wc__textbase_sync): Promote these private members … * subversion/include/svn_wc.h (svn_wc_textbase_fetch_cb_t, svn_wc_textbase_sync): …into these new APIs. * subversion/libsvn_client/textbase.c (): Adjust includes. (textbase_fetch_cb, svn_client__textbase_sync): Use the new public API. * subversion/libsvn_wc/textbase.c (svn_wc__textbase_sync): Rename to … (svn_wc_textbase_sync): …this. Adjust the type of `fetch_callback`. (textbase_sync_baton_t): Adjust the type of `fetch_callback`. Modified: subversion/branches/pristines-on-demand-on-mwf/subversion/include/private/svn_wc_private.h subversion/branches/pristines-on-demand-on-mwf/subversion/include/svn_wc.h subversion/branches/pristines-on-demand-on-mwf/subversion/libsvn_client/textbase.c subversion/branches/pristines-on-demand-on-mwf/subversion/libsvn_wc/textbase.c Modified: subversion/branches/pristines-on-demand-on-mwf/subversion/include/private/svn_wc_private.h URL: http://svn.apache.org/viewvc/subversion/branches/pristines-on-demand-on-mwf/subversion/include/private/svn_wc_private.h?rev=1905662&r1=1905661&r2=1905662&view=diff ============================================================================== --- subversion/branches/pristines-on-demand-on-mwf/subversion/include/private/svn_wc_private.h (original) +++ subversion/branches/pristines-on-demand-on-mwf/subversion/include/private/svn_wc_private.h Thu Dec 1 10:15:09 2022 @@ -2321,33 +2321,6 @@ svn_wc__upgrade(svn_wc_context_t *wc_ctx void *notify_baton, apr_pool_t *scratch_pool); -/* The callback invoked by svn_wc__textbase_sync() to fetch the text-base - contents identified by REPOS_ROOT_URL, REPOS_RELPATH and REVISION. */ -typedef svn_error_t *(*svn_wc__textbase_fetch_cb_t)( - void *baton, - const char *repos_root_url, - const char *repos_relpath, - svn_revnum_t revision, - svn_stream_t *contents, - svn_cancel_func_t cancel_func, - void *cancel_baton, - apr_pool_t *scratch_pool); - -/* Synchronize the state of the text-base contents for the LOCAL_ABSPATH tree. - If ALLOW_HYDRATE is true, fetch the required but missing text-base contents - using the provided FETCH_CALLBACK and FETCH_BATON. If ALLOW_DEHYDRATE - is true, remove the on disk text-base contents that is not required. */ -svn_error_t * -svn_wc__textbase_sync(svn_wc_context_t *wc_ctx, - const char *local_abspath, - svn_boolean_t allow_hydrate, - svn_boolean_t allow_dehydrate, - svn_wc__textbase_fetch_cb_t fetch_callback, - void *fetch_baton, - svn_cancel_func_t cancel_func, - void *cancel_baton, - apr_pool_t *scratch_pool); - /* Return the working copy settings *FORMAT_P and *STORE_PRISTINE_P for LOCAL_ABSPATH in WC_CTX. */ svn_error_t * Modified: subversion/branches/pristines-on-demand-on-mwf/subversion/include/svn_wc.h URL: http://svn.apache.org/viewvc/subversion/branches/pristines-on-demand-on-mwf/subversion/include/svn_wc.h?rev=1905662&r1=1905661&r2=1905662&view=diff ============================================================================== --- subversion/branches/pristines-on-demand-on-mwf/subversion/include/svn_wc.h (original) +++ subversion/branches/pristines-on-demand-on-mwf/subversion/include/svn_wc.h Thu Dec 1 10:15:09 2022 @@ -7358,6 +7358,51 @@ svn_wc_get_pristine_copy_path(const char apr_pool_t *pool); +/** The callback invoked by svn_wc_textbase_sync() to provide the text-base + * contents identified by @a repos_root_url, @a repos_relpath and @a revision. + * + * The callback is expected to write the contents to @a contents and close + * the stream. + * + * @since New in 1.15. + */ +typedef svn_error_t *(*svn_wc_textbase_fetch_cb_t)( + void *baton, + const char *repos_root_url, + const char *repos_relpath, + svn_revnum_t revision, + svn_stream_t *contents, + svn_cancel_func_t cancel_func, + void *cancel_baton, + apr_pool_t *scratch_pool); + + /** Synchronize the state of the text-base contents for the + * @a local_abspath tree. + * + * If @a allow_hydrate is true, fetch the required but missing text-base + * contents using the provided @a fetch_callback and @a fetch_baton. + * If @a allow_hydrate is false, @a fetch_callback will not be used and + * may be @c NULL. + * + * If @a allow_dehydrate is true, remove the on disk text-base contents + * that is not required. + * + * @see svn_wc_textbase_hydrate_cb_t + * @see svn_client__textbase_sync for usage/implementation example. + * + * @since New in 1.15. + */ +svn_error_t * +svn_wc_textbase_sync(svn_wc_context_t *wc_ctx, + const char *local_abspath, + svn_boolean_t allow_hydrate, + svn_boolean_t allow_dehydrate, + svn_wc_textbase_fetch_cb_t fetch_callback, + void *fetch_baton, + svn_cancel_func_t cancel_func, + void *cancel_baton, + apr_pool_t *scratch_pool); + /** * Recurse from @a local_abspath, cleaning up unfinished tasks. Perform * any temporary allocations in @a scratch_pool. If @a break_locks is TRUE Modified: subversion/branches/pristines-on-demand-on-mwf/subversion/libsvn_client/textbase.c URL: http://svn.apache.org/viewvc/subversion/branches/pristines-on-demand-on-mwf/subversion/libsvn_client/textbase.c?rev=1905662&r1=1905661&r2=1905662&view=diff ============================================================================== --- subversion/branches/pristines-on-demand-on-mwf/subversion/libsvn_client/textbase.c (original) +++ subversion/branches/pristines-on-demand-on-mwf/subversion/libsvn_client/textbase.c Thu Dec 1 10:15:09 2022 @@ -22,8 +22,7 @@ */ #include "svn_path.h" - -#include "private/svn_wc_private.h" +#include "svn_wc.h" #include "client.h" @@ -36,7 +35,7 @@ typedef struct textbase_fetch_baton_t svn_ra_session_t *ra_session; } textbase_fetch_baton_t; -/* Implements svn_wc__textbase_fetch_cb_t. */ +/* Implements svn_wc_textbase_fetch_cb_t. */ static svn_error_t * textbase_fetch_cb(void *baton, const char *repos_root_url, @@ -121,11 +120,11 @@ svn_client__textbase_sync(svn_ra_session if (ra_session) SVN_ERR(svn_ra_get_session_url(ra_session, &old_session_url, scratch_pool)); - SVN_ERR(svn_wc__textbase_sync(ctx->wc_ctx, local_abspath, - allow_hydrate, allow_dehydrate, - textbase_fetch_cb, &fetch_baton, - ctx->cancel_func, ctx->cancel_baton, - scratch_pool)); + SVN_ERR(svn_wc_textbase_sync(ctx->wc_ctx, local_abspath, + allow_hydrate, allow_dehydrate, + textbase_fetch_cb, &fetch_baton, + ctx->cancel_func, ctx->cancel_baton, + scratch_pool)); if (ra_session) SVN_ERR(svn_ra_reparent(ra_session, old_session_url, scratch_pool)); Modified: subversion/branches/pristines-on-demand-on-mwf/subversion/libsvn_wc/textbase.c URL: http://svn.apache.org/viewvc/subversion/branches/pristines-on-demand-on-mwf/subversion/libsvn_wc/textbase.c?rev=1905662&r1=1905661&r2=1905662&view=diff ============================================================================== --- subversion/branches/pristines-on-demand-on-mwf/subversion/libsvn_wc/textbase.c (original) +++ subversion/branches/pristines-on-demand-on-mwf/subversion/libsvn_wc/textbase.c Thu Dec 1 10:15:09 2022 @@ -460,7 +460,7 @@ svn_wc__textbase_prepare_install(svn_str typedef struct textbase_sync_baton_t { svn_wc__db_t *db; - svn_wc__textbase_fetch_cb_t fetch_callback; + svn_wc_textbase_fetch_cb_t fetch_callback; void *fetch_baton; } textbase_sync_baton_t; @@ -529,15 +529,15 @@ textbase_fetch_cb(void *baton, } svn_error_t * -svn_wc__textbase_sync(svn_wc_context_t *wc_ctx, - const char *local_abspath, - svn_boolean_t allow_hydrate, - svn_boolean_t allow_dehydrate, - svn_wc__textbase_fetch_cb_t fetch_callback, - void *fetch_baton, - svn_cancel_func_t cancel_func, - void *cancel_baton, - apr_pool_t *scratch_pool) +svn_wc_textbase_sync(svn_wc_context_t *wc_ctx, + const char *local_abspath, + svn_boolean_t allow_hydrate, + svn_boolean_t allow_dehydrate, + svn_wc_textbase_fetch_cb_t fetch_callback, + void *fetch_baton, + svn_cancel_func_t cancel_func, + void *cancel_baton, + apr_pool_t *scratch_pool) { svn_boolean_t store_pristine; textbase_sync_baton_t baton = {0};