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

Re: [PATCH]remove adm_access in svn_wc_translated_file3

From: Hyrum K. Wright <hyrum_at_hyrumwright.org>
Date: Thu, 6 Aug 2009 12:25:17 -0500

On Aug 6, 2009, at 3:36 AM, HuiHuang wrote:

> Hey,
>
> When I try to modify some callers to svn_wc_transmit_prop_deltas2(),
> I find
> many functions also refer to svn_wc_translated_file2(). So I remove
> adm_access batons in svn_wc_translated_file2() first.

Did you run the regression tests on this patch? I get the following
errors:

At least one test FAILED, checking /Users/Hyrum/dev/svn-trunk2/tests.log
FAIL: merge_tests.py 40: conflict markers should match the file's eol
style
FAIL: special_tests.py 8: merge file into symlink
FAIL: trans_tests.py 2: update modified file with eol-style 'native'
FAIL: update_tests.py 27: conflict markers should match the file's
eol style
FAIL: update_tests.py 28: handle eol-style propchange during update

>
> Log:
> [[[
> Rip out some adm_access usage in svn_wc_translated_file3().
>
> * subversion/include/svn_wc.h
> (svn_wc_translated_file3): New.
> (svn_wc_translated_file2): Deprecate.
>
> * subversion/libsvn_wc/deprecated.c
> (svn_wc_translated_file2): Reimplement as a wrapper.
>
> * subversion/libsvn_wc/translate.c
> (svn_wc__internal_translated_file): New.
> (svn_wc_translated_file3): New.
> (svn_wc_translated_file2): Remove.
>
> * subversion/libsvn_wc/translate.h
> (svn_wc__internal_translated_file): New.
> ]]]
>
> Modified:
> trunk/subversion/include/svn_wc.h
> trunk/subversion/libsvn_wc/deprecated.c
> trunk/subversion/libsvn_wc/translate.c
> trunk/subversion/libsvn_wc/translate.h
>
>
>
> Index: subversion/include/svn_wc.h
> ===================================================================
> --- subversion/include/svn_wc.h (revision 38574)
> +++ subversion/include/svn_wc.h (working copy)
> @@ -5842,8 +5842,8 @@
>
> /** Set @a xlated_path to a translated copy of @a src
> * or to @a src itself if no translation is necessary.
> - * That is, if @a versioned_file's properties indicate newline
> conversion or
> - * keyword expansion, point @a *xlated_path to a copy of @a src
> + * That is, if @a versioned_abspath's properties indicate newline
> conversion
> + * or keyword expansion, point @a *xlated_path to a copy of @a src
> * whose newlines and keywords are converted using the translation
> * as requested by @a flags.
> *
> @@ -5857,20 +5857,37 @@
> * @c SVN_WC_TRANSLATE_FORCE_COPY flag in @a flags.
> *
> * This function is generally used to get a file that can be compared
> - * meaningfully against @a versioned_file's text base, if
> - * @c SVN_WC_TRANSLATE_TO_NF is specified, against @a
> versioned_file itself
> + * meaningfully against @a versioned_abspath's text base, if
> + * @c SVN_WC_TRANSLATE_TO_NF is specified, against @a
> versioned_abspath itself
> * if @c SVN_WC_TRANSLATE_FROM_NF is specified.
> *
> * Output files are created in the temp file area belonging to
> - * @a versioned_file. By default they will be deleted at pool
> cleanup.
> + * @a versioned_abspath. By default they will be deleted at
> scratch_pool cleanup.
> *
> * If @c SVN_WC_TRANSLATE_NO_OUTPUT_CLEANUP is specified, the default
> - * pool cleanup handler to remove @a *xlated_path is not registered.
> + * result_pool cleanup handler to remove @a *xlated_path is not
> registered.
> *
> * If an error is returned, the effect on @a *xlated_path is
> undefined.
> *
> - * @since New in 1.4
> + * @since New in 1.7.
> + */
> +svn_error_t *
> +svn_wc_translated_file3(const char **xlated_path,
> + const char *src,
> + svn_wc_context_t *wc_ctx,
> + const char *versioned_abspath,
> + apr_uint32_t flags,
> + apr_pool_t *result_pool,
> + apr_pool_t *scratch_pool);
> +
> +
> +/** Similar to svn_wc_translated_file3(), but with an adm_access
> baton
> + * and relative paths instead of a wc_context and absolute paths.
> + *
> + * @since New in 1.4.
> + * @deprecated Provided for compatibility with the 1.6 API
> */
> +SVN_DEPRECATED
> svn_error_t *
> svn_wc_translated_file2(const char **xlated_path,
> const char *src,
> Index: subversion/libsvn_wc/deprecated.c
> ===================================================================
> --- subversion/libsvn_wc/deprecated.c (revision 38574)
> +++ subversion/libsvn_wc/deprecated.c (working copy)
> @@ -2100,6 +2100,28 @@
> return svn_error_return(svn_wc_context_destroy(wc_ctx));
> }
>
> +svn_error_t *
> +svn_wc_translated_file2(const char **xlated_path,
> + const char *src,
> + const char *versioned_file,
> + svn_wc_adm_access_t *adm_access,
> + apr_uint32_t flags,
> + apr_pool_t *pool)
> +{
> + const char *versioned_abspath;
> + svn_wc_context_t *wc_ctx;
> +
> + SVN_ERR(svn_dirent_get_absolute(&versioned_abspath,
> versioned_file, 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_translated_file3(xlated_path, src, wc_ctx,
> versioned_abspath,
> + flags, pool, pool));
> +
> + return svn_error_return(svn_wc_context_destroy(wc_ctx));
> +}
> +
> /*** From relocate.c ***/
> svn_error_t *
> svn_wc_relocate3(const char *path,
> Index: subversion/libsvn_wc/translate.c
> ===================================================================
> --- subversion/libsvn_wc/translate.c (revision 38574)
> +++ subversion/libsvn_wc/translate.c (working copy)
> @@ -169,26 +169,27 @@
>
>
> svn_error_t *
> -svn_wc_translated_file2(const char **xlated_path,
> - const char *src,
> - const char *versioned_file,
> - svn_wc_adm_access_t *adm_access,
> - apr_uint32_t flags,
> - apr_pool_t *pool)
> +svn_wc__internal_translated_file(const char **xlated_path,
> + const char *src,
> + svn_wc__db_t *db,
> + const char *versioned_abspath,
> + apr_uint32_t flags,
> + apr_pool_t *result_pool,
> + apr_pool_t *scratch_pool)
> {
> svn_subst_eol_style_t style;
> const char *eol;
> apr_hash_t *keywords;
> svn_boolean_t special;
> - svn_wc__db_t *db = svn_wc__adm_get_db(adm_access);
> - const char *versioned_abspath;
>
> - SVN_ERR(svn_dirent_get_absolute(&versioned_abspath,
> versioned_file, pool));
> +
> + SVN_ERR_ASSERT(svn_dirent_is_absolute(versioned_abspath));
> +
> SVN_ERR(svn_wc__get_eol_style(&style, &eol, db, versioned_abspath,
> - pool, pool));
> - SVN_ERR(svn_wc__get_keywords(&keywords, db, versioned_abspath,
> NULL, pool,
> - pool));
> - SVN_ERR(svn_wc__get_special(&special, db, versioned_abspath,
> pool));
> + result_pool, scratch_pool));
> + SVN_ERR(svn_wc__get_keywords(&keywords, db, versioned_abspath,
> NULL,
> + result_pool, scratch_pool));
> + SVN_ERR(svn_wc__get_special(&special, db, versioned_abspath,
> result_pool));
>
> if (! svn_subst_translation_required(style, eol, keywords,
> special, TRUE)
> && (! (flags & SVN_WC_TRANSLATE_FORCE_COPY)))
> @@ -207,14 +208,15 @@
> if (flags & SVN_WC_TRANSLATE_USE_GLOBAL_TMP)
> tmp_dir = NULL;
> else
> - tmp_dir =
> svn_wc__adm_child(svn_dirent_dirname(versioned_file, pool),
> - SVN_WC__ADM_TMP, pool);
> + tmp_dir = svn_wc__adm_child(
> + svn_dirent_dirname(versioned_abspath,
> result_pool),
> + SVN_WC__ADM_TMP, scratch_pool);
>
> SVN_ERR(svn_io_open_unique_file3(NULL, &tmp_vfile, tmp_dir,
> (flags & SVN_WC_TRANSLATE_NO_OUTPUT_CLEANUP)
> ? svn_io_file_del_none
> : svn_io_file_del_on_pool_cleanup,
> - pool, pool));
> + result_pool, scratch_pool));
>
> /* ### ugh. the repair behavior does NOT match the docstring.
> bleah.
> ### all of these translation functions are crap and should go
> @@ -244,7 +246,7 @@
> keywords,
> expand,
> special,
> - pool));
> + result_pool));
>
> *xlated_path = tmp_vfile;
> }
> @@ -252,7 +254,21 @@
> return SVN_NO_ERROR;
> }
>
> +svn_error_t *
> +svn_wc_translated_file3(const char **xlated_path,
> + const char *src,
> + svn_wc_context_t *wc_ctx,
> + const char *versioned_abspath,
> + apr_uint32_t flags,
> + apr_pool_t *result_pool,
> + apr_pool_t *scratch_pool)
> +{
> + return svn_wc__internal_translated_file(xlated_path, src, wc_ctx-
> >db,
> + versioned_abspath, flags,
> + result_pool,scratch_pool);
> +}
>
> +
> svn_error_t *
> svn_wc__get_eol_style(svn_subst_eol_style_t *style,
> const char **eol,
> Index: subversion/libsvn_wc/translate.h
> ===================================================================
> --- subversion/libsvn_wc/translate.h (revision 38574)
> +++ subversion/libsvn_wc/translate.h (working copy)
> @@ -133,7 +133,17 @@
> apr_pool_t *result_pool,
> apr_pool_t *scratch_pool);
>
> +/* Internal version of svn_wc_translated_file3(). */
> +svn_error_t *
> +svn_wc__internal_translated_file(const char **xlated_path,
> + const char *src,
> + svn_wc__db_t *db,
> + const char *versioned_abspath,
> + apr_uint32_t flags,
> + apr_pool_t *result_pool,
> + apr_pool_t *scratch_pool);
>
> +
> #ifdef __cplusplus
> }
> #endif /* __cplusplus */
>
> Best Wishes!
> Huihuang
>
> --------------
> yellow.flying
> 2009-08-06
>
> __________________________________________________
> 赶快注册雅虎超大容量免费邮箱?
> http://cn.mail.yahoo.com
>
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2380739

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2380962
Received on 2009-08-06 19:25:41 CEST

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