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

Re: [PATCH]svn_wc_transmit_prop_deltas2-wc-ng

From: Hyrum K. Wright <hyrum_at_hyrumwright.org>
Date: Tue, 4 Aug 2009 09:18:52 -0500

On Aug 4, 2009, at 2:19 AM, HuiHuang wrote:

> Hey,
>
> I modified the patch as you like. See below:
> I meet an error now, so I have not tested it yet.

Looks good! I removed the result pool (since we're no longer
returning any results), updated some formatting and comments, ran the
complete test suite, and then committed in r38556.

Are you planning on doing the followup patch to update the callers?

-Hyrum

>
> Log:
> [[[
> Rip out some adm_access usage in svn_wc_transmit_prop_deltas().
>
> * subversion/include/svn_wc.h
> (svn_wc_transmit_prop_deltas2): New.
> (svn_wc_transmit_prop_deltas): Deprecate.
>
> * subversion/libsvn_wc/adm_crawler.c
> (svn_wc_internal_transmit_prop_deltas): New.
> (svn_wc_transmit_prop_deltas2): New.
> (svn_wc_transmit_prop_deltas): Remove.
>
> * subversion/libsvn_wc/deprecated.c
> (svn_wc_transmit_prop_deltas): Reimplement as a wrapper.
>
> * subversion/libsvn_wc/wc.h
> (svn_wc_internal_transmit_prop_deltas): New.
> ]]]
>
> Modified:
> trunk/subversion/include/svn_wc.h
> trunk/subversion/libsvn_wc/deprecated.c
> trunk/subversion/libsvn_wc/adm_crawler.c
> trunk/subversion/libsvn_wc/wc.h
>
>
>
> Index: subversion/include/svn_wc.h
> ===================================================================
> --- subversion/include/svn_wc.h (revision 38546)
> +++ subversion/include/svn_wc.h (working copy)
> @@ -5998,18 +5998,34 @@
> apr_pool_t *pool);
>
>
> -/** Given a @a path with its accompanying @a entry, transmit all
> local
> - * property modifications using the appropriate @a editor method (in
> - * conjunction with @a baton). @a adm_access is an access baton set
> - * that contains @a path. Use @a pool for all allocations.
> +/** Given a @a local_abspath, transmit all local property
> + * modifications using the appropriate @a editor method (in
> conjunction
> + * with @a baton). Use @a scratch_pool for any temporary allocation.
> *
> + * @note Starting version 1.5, no tempfile will ever be returned
> + * anymore. If @a *tempfile is passed, its value is set to
> @c NULL.
> + *
> + * @since New in 1.7.
> + */
> +svn_error_t *
> +svn_wc_transmit_prop_deltas2(svn_wc_context_t *wc_ctx,
> + const char *local_abspath,
> + const svn_delta_editor_t *editor,
> + void *baton,
> + apr_pool_t *result_pool,
> + apr_pool_t *scratch_pool);
> +
> +
> +/** Similar to svn_wc_transmit_prop_deltas2(), but with a relative
> path,
> + * adm_access baton and tempfile.
> + *
> * If a temporary file remains after this function is finished, the
> * path to that file is returned in @a *tempfile (so the caller can
> * clean this up if it wishes to do so).
> *
> - * @note Starting version 1.5, no tempfile will ever be returned
> - * anymore. If @a *tempfile is passed, its value is set to
> @c NULL.
> + * @deprecated Provided for backwards compatibility with the 1.6 API.
> */
> +SVN_DEPRECATED
> svn_error_t *
> svn_wc_transmit_prop_deltas(const char *path,
> svn_wc_adm_access_t *adm_access,
> Index: subversion/libsvn_wc/adm_crawler.c
> ===================================================================
> --- subversion/libsvn_wc/adm_crawler.c (revision 38546)
> +++ subversion/libsvn_wc/adm_crawler.c (working copy)
> @@ -1075,37 +1075,46 @@
> }
>
> svn_error_t *
> -svn_wc_transmit_prop_deltas(const char *path,
> - svn_wc_adm_access_t *adm_access,
> - const svn_wc_entry_t *entry,
> - const svn_delta_editor_t *editor,
> - void *baton,
> - const char **tempfile,
> - apr_pool_t *pool)
> +svn_wc__internal_transmit_prop_deltas(svn_wc__db_t *db,
> + const char *local_abspath,
> + const svn_delta_editor_t
> *editor,
> + void *baton,
> + apr_pool_t *result_pool,
> + apr_pool_t *scratch_pool)
> {
> int i;
> apr_array_header_t *propmods;
> - svn_wc__db_t *db = svn_wc__adm_get_db(adm_access);
> - const char *local_abspath;
> + svn_wc__db_kind_t kind;
>
> - SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, pool));
> -
> - if (tempfile)
> - *tempfile = NULL;
> -
> + SVN_ERR(svn_wc__db_check_node(&kind, db, local_abspath,
> scratch_pool));
> /* Get an array of local changes by comparing the hashes. */
> SVN_ERR(svn_wc__internal_propdiff(&propmods, NULL, db,
> local_abspath,
> - pool, pool));
> + result_pool, scratch_pool));
>
> /* Apply each local change to the baton */
> for (i = 0; i < propmods->nelts; i++)
> {
> const svn_prop_t *p = &APR_ARRAY_IDX(propmods, i, svn_prop_t);
> - if (entry->kind == svn_node_file)
> - SVN_ERR(editor->change_file_prop(baton, p->name, p->value,
> pool));
> + if (kind == svn_wc__db_kind_file)
> + SVN_ERR(editor->change_file_prop(baton, p->name, p->value,
> + result_pool));
> else
> - SVN_ERR(editor->change_dir_prop(baton, p->name, p->value,
> pool));
> + SVN_ERR(editor->change_dir_prop(baton, p->name, p->value,
> + result_pool));
> }
>
> return SVN_NO_ERROR;
> }
> +
> +svn_error_t *
> +svn_wc_transmit_prop_deltas2(svn_wc_context_t *wc_ctx,
> + const char *local_abspath,
> + const svn_delta_editor_t *editor,
> + void *baton,
> + apr_pool_t *result_pool,
> + apr_pool_t *scratch_pool)
> +{
> + return svn_wc__internal_transmit_prop_deltas(wc_ctx->db,
> local_abspath, editor,
> + baton, result_pool,
> + scratch_pool);
> +}
> Index: subversion/libsvn_wc/deprecated.c
> ===================================================================
> --- subversion/libsvn_wc/deprecated.c (revision 38546)
> +++ subversion/libsvn_wc/deprecated.c (working copy)
> @@ -315,7 +315,32 @@
> fulltext, editor, file_baton,
> pool);
> }
>
> +svn_error_t *
> +svn_wc_transmit_prop_deltas(const char *path,
> + svn_wc_adm_access_t *adm_access,
> + const svn_wc_entry_t *entry,
> + const svn_delta_editor_t *editor,
> + void *baton,
> + const char **tempfile,
> + apr_pool_t *pool)
> +{
> + const char *local_abspath;
> + svn_wc_context_t *wc_ctx;
>
> + if (tempfile)
> + *tempfile = NULL;
> +
> + SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, pool));
> + SVN_ERR(svn_wc__context_create_with_db(&wc_ctx, NULL /* config */,
> +
> svn_wc__adm_get_db(adm_access),
> + pool));
> +
> + SVN_ERR(svn_wc_transmit_prop_deltas2(wc_ctx, local_abspath,
> editor, baton,
> + pool, pool));
> +
> + return svn_error_return(svn_wc_context_destroy(wc_ctx));
> +}
> +
> /*** From adm_files.c ***/
> svn_error_t *
> svn_wc_ensure_adm2(const char *path,
> Index: subversion/libsvn_wc/wc.h
> ===================================================================
> --- subversion/libsvn_wc/wc.h (revision 38546)
> +++ subversion/libsvn_wc/wc.h (working copy)
> @@ -458,7 +458,16 @@
> apr_pool_t *result_pool,
> apr_pool_t *scratch_pool);
>
> +/* Internal version of svn_wc_transmit_prop_deltas2(). */
> +svn_error_t *
> +svn_wc__internal_transmit_prop_deltas(svn_wc__db_t *db,
> + const char *local_abspath,
> + const svn_delta_editor_t
> *editor,
> + void *baton,
> + apr_pool_t *result_pool,
> + apr_pool_t *scratch_pool);
>
> +
> #ifdef __cplusplus
> }
> #endif /* __cplusplus */
>
> Best~
> Huihuang
>
> ------------------
> yellow.flying
> 2009-08-04
>
> __________________________________________________
> 赶快注册雅虎超大容量免费邮箱?
> http://cn.mail.yahoo.com
>
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2379896

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2380016
Received on 2009-08-04 16:19:29 CEST

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.