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

RE: svn commit: r35465 - in trunk/subversion: include libsvn_client libsvn_subr libsvn_wc

From: Bert Huijben <rhuijben_at_sharpsvn.net>
Date: Mon, 26 Jan 2009 15:07:29 +0100

> -----Original Message-----
> From: Greg Stein [mailto:gstein_at_gmail.com]
> Sent: maandag 26 januari 2009 12:31
> To: svn_at_subversion.tigris.org
> Subject: svn commit: r35465 - in trunk/subversion: include
> libsvn_client libsvn_subr libsvn_wc
>
> Author: gstein
> Date: Mon Jan 26 03:30:42 2009
> New Revision: 35465
>
> Log:
> Various cleanups after all the subst work.
>
> * subversion/include/svn_subst.h:
> (SVN_SUBST_NATIVE_EOL_STR): new definition for the EOL format used in
> the repository ("Normal Form")

        Greg,

I think we should use 'NORMAL', 'INTERNAL' or [Fill-in-your-bike shed] for
the NATIVE part of this macro.

The subst methods can be used to convert to eols to svn:eol-style 'native'
format ('\r\n' on Windows) and this #define doesn't make it 100% obvious
that this value is for something completely different (Our internal format).

        Bert
>
> * subversion/libsvn_subr/subst.c:
> (SVN_SUBST__DEFAULT_EOL_STR): removed in favor of above
> (svn_subst_translation_required): use SVN_SUBST_NATIVE_EOL_STR
> (svn_subst_copy_and_translate3): fold old svn_subst_create_translated
> into this function.
>
> * subversion/libsvn_subr/deprecated.c:
> (svn_subst_stream_translated_to_normal_form,
> svn_subst_translate_to_normal_form): use SVN_SUBST_NATIVE_EOL_STR
>
> * subversion/libsvn_wc/questions.c:
> (compare_and_verify): use SVN_SUBST_NATIVE_EOL_STR
>
> * subversion/libsvn_wc/translate.c:
> (svn_wc_translated_stream, svn_wc_translated_file2): use
> SVN_SUBST_NATIVE_EOL_STR
>
> * subversion/libsvn_wc/merge.c:
> (detranslate_wc_file): use SVN_SUBST_NATIVE_EOL_STR
>
> * subversion/libsvn_wc/copy.c:
> (copy_file_administratively): use SVN_SUBST_NATIVE_EOL_STR
>
> * subversion/libsvn_client/export.c:
> (close_file): simplify via ternary operator removal
>
> * subversion/libsvn_client/commit.c:
> (send_file_contents): use SVN_SUBST_NATIVE_EOL_STR
>
> Suggestion (of SVN_SUBST_NATIVE_EOL_STR) by: rhuijben
>
> Modified:
> trunk/subversion/include/svn_subst.h
> trunk/subversion/libsvn_client/commit.c
> trunk/subversion/libsvn_client/export.c
> trunk/subversion/libsvn_subr/deprecated.c
> trunk/subversion/libsvn_subr/subst.c
> trunk/subversion/libsvn_wc/copy.c
> trunk/subversion/libsvn_wc/merge.c
> trunk/subversion/libsvn_wc/questions.c
> trunk/subversion/libsvn_wc/translate.c
>
> Modified: trunk/subversion/include/svn_subst.h
> URL:
> http://svn.collab.net/viewvc/svn/trunk/subversion/include/svn_subst.h?p
> athrev=35465&r1=35464&r2=35465
> =======================================================================
> =======
> --- trunk/subversion/include/svn_subst.h Mon Jan 26 00:11:12 2009
> (r35464)
> +++ trunk/subversion/include/svn_subst.h Mon Jan 26 03:30:42 2009
> (r35465)
> @@ -38,6 +38,9 @@ extern "C" {
>
> /* EOL conversion and keyword expansion. */
>
> +/** The EOL used in the Repository for "native" files */
> +#define SVN_SUBST_NATIVE_EOL_STR "\n"
> +
> /** Valid states for 'svn:eol-style' property.
> *
> * Property nonexistence is equivalent to 'none'.
>
> Modified: trunk/subversion/libsvn_client/commit.c
> URL:
> http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_client/commit.
> c?pathrev=35465&r1=35464&r2=35465
> =======================================================================
> =======
> --- trunk/subversion/libsvn_client/commit.c Mon Jan 26 00:11:12 2009
> (r35464)
> +++ trunk/subversion/libsvn_client/commit.c Mon Jan 26 03:30:42 2009
> (r35465)
> @@ -140,7 +140,7 @@ send_file_contents(const char *path,
> svn_boolean_t repair = FALSE;
>
> if (eol_style == svn_subst_eol_style_native)
> - eol = "\n"; /* ### SVN_SUBST__DEFAULT_EOL_STR; */
> + eol = SVN_SUBST_NATIVE_EOL_STR;
> else if (eol_style == svn_subst_eol_style_fixed)
> repair = TRUE;
> else if (eol_style != svn_subst_eol_style_none)
>
> Modified: trunk/subversion/libsvn_client/export.c
> URL:
> http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_client/export.
> c?pathrev=35465&r1=35464&r2=35465
> =======================================================================
> =======
> --- trunk/subversion/libsvn_client/export.c Mon Jan 26 00:11:12 2009
> (r35464)
> +++ trunk/subversion/libsvn_client/export.c Mon Jan 26 03:30:42 2009
> (r35465)
> @@ -778,12 +778,16 @@ close_file(void *file_baton,
> else
> {
> svn_subst_eol_style_t style;
> - const char *eol;
> - apr_hash_t *final_kw;
> + const char *eol = NULL;
> + svn_boolean_t repair = FALSE;
> + apr_hash_t *final_kw = NULL;
>
> if (fb->eol_style_val)
> - SVN_ERR(get_eol_style(&style, &eol, fb->eol_style_val->data,
> - eb->native_eol));
> + {
> + SVN_ERR(get_eol_style(&style, &eol, fb->eol_style_val->data,
> + eb->native_eol));
> + repair = TRUE;
> + }
>
> if (fb->keywords_val)
> SVN_ERR(svn_subst_build_keywords2(&final_kw, fb->keywords_val-
> >data,
> @@ -792,9 +796,7 @@ close_file(void *file_baton,
>
> SVN_ERR(svn_subst_copy_and_translate3
> (fb->tmppath, fb->path,
> - fb->eol_style_val ? eol : NULL,
> - fb->eol_style_val ? TRUE : FALSE, /* repair */
> - fb->keywords_val ? final_kw : NULL,
> + eol, repair, final_kw,
> TRUE, /* expand */
> fb->special,
> pool));
>
> Modified: trunk/subversion/libsvn_subr/deprecated.c
> URL:
> http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_subr/deprecate
> d.c?pathrev=35465&r1=35464&r2=35465
> =======================================================================
> =======
> --- trunk/subversion/libsvn_subr/deprecated.c Mon Jan 26 00:11:12 2009
> (r35464)
> +++ trunk/subversion/libsvn_subr/deprecated.c Mon Jan 26 03:30:42 2009
> (r35465)
> @@ -207,7 +207,7 @@ svn_subst_stream_translated_to_normal_fo
> apr_pool_t *pool)
> {
> if (eol_style == svn_subst_eol_style_native)
> - eol_str = "\n"; /* ### SVN_SUBST__DEFAULT_EOL_STR; */
> + eol_str = SVN_SUBST_NATIVE_EOL_STR;
> else if (! (eol_style == svn_subst_eol_style_fixed
> || eol_style == svn_subst_eol_style_none))
> return svn_error_create(SVN_ERR_IO_UNKNOWN_EOL, NULL, NULL);
> @@ -257,7 +257,7 @@ svn_subst_translate_to_normal_form(const
> {
>
> if (eol_style == svn_subst_eol_style_native)
> - eol_str = "\n"; /* ### SVN_SUBST__DEFAULT_EOL_STR; */
> + eol_str = SVN_SUBST_NATIVE_EOL_STR;
> else if (! (eol_style == svn_subst_eol_style_fixed
> || eol_style == svn_subst_eol_style_none))
> return svn_error_create(SVN_ERR_IO_UNKNOWN_EOL, NULL, NULL);
>
> Modified: trunk/subversion/libsvn_subr/subst.c
> URL:
> http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_subr/subst.c?p
> athrev=35465&r1=35464&r2=35465
> =======================================================================
> =======
> --- trunk/subversion/libsvn_subr/subst.c Mon Jan 26 00:11:12 2009
> (r35464)
> +++ trunk/subversion/libsvn_subr/subst.c Mon Jan 26 03:30:42 2009
> (r35465)
> @@ -41,10 +41,6 @@
>
> #include "svn_private_config.h"
>
> -/* The Repository Default EOL used for files which
> - * use the 'native' eol style.
> - */
> -#define SVN_SUBST__DEFAULT_EOL_STR "\n"
>
> /**
> * The textual elements of a detranslated special file. One of these
> @@ -108,7 +104,7 @@ svn_subst_translation_required(svn_subst
> return (special || keywords
> || (style != svn_subst_eol_style_none && force_eol_check)
> || (style == svn_subst_eol_style_native &&
> - strcmp(APR_EOL_STR, SVN_SUBST__DEFAULT_EOL_STR) != 0)
> + strcmp(APR_EOL_STR, SVN_SUBST_NATIVE_EOL_STR) != 0)
> || (style == svn_subst_eol_style_fixed &&
> strcmp(APR_EOL_STR, eol) != 0));
> }
> @@ -1348,16 +1344,6 @@ create_special_file_from_stream(svn_stre
> }
>
>
> -/* ### temp forward declaration, rather than a move, to minimize diff
> size */
> -static svn_error_t *
> -svn_subst_create_translated(svn_stream_t *src_stream,
> - const char *dst,
> - const char *eol_str,
> - svn_boolean_t repair,
> - apr_hash_t *keywords,
> - svn_boolean_t expand,
> - apr_pool_t *pool);
> -
> svn_error_t *
> svn_subst_copy_and_translate3(const char *src,
> const char *dst,
> @@ -1369,6 +1355,8 @@ svn_subst_copy_and_translate3(const char
> apr_pool_t *pool)
> {
> svn_stream_t *src_stream;
> + svn_stream_t *dst_stream;
> + const char *dst_tmp;
> svn_error_t *err;
> svn_node_kind_t kind;
> svn_boolean_t path_special;
> @@ -1381,8 +1369,6 @@ svn_subst_copy_and_translate3(const char
> {
> if (expand)
> {
> - svn_stream_t *source;
> -
> if (path_special)
> {
> /* We are being asked to create a special file from a
> special
> @@ -1393,14 +1379,14 @@ svn_subst_copy_and_translate3(const char
> ### svn_subst_read_specialfile even checks the file
> type
> ### for us! */
>
> - SVN_ERR(svn_subst_read_specialfile(&source, src, pool,
> pool));
> + SVN_ERR(svn_subst_read_specialfile(&src_stream, src,
> pool, pool));
> }
> else
> {
> - SVN_ERR(svn_stream_open_readonly(&source, src, pool,
> pool));
> + SVN_ERR(svn_stream_open_readonly(&src_stream, src, pool,
> pool));
> }
>
> - return create_special_file_from_stream(source, dst, pool);
> + return create_special_file_from_stream(src_stream, dst,
> pool);
> }
> /* else !expand */
>
> @@ -1414,55 +1400,26 @@ svn_subst_copy_and_translate3(const char
> /* Open source file. */
> SVN_ERR(svn_stream_open_readonly(&src_stream, src, pool, pool));
>
> - /* ### note: this checks for SPECIAL and for NO-TRANS. whatever. */
> - /* ### inline this code. create_translated is no longer... */
> - err = svn_subst_create_translated(src_stream, dst,
> - eol_str, repair, keywords, expand,
> - pool);
> -
> - /* On errors, we have a pathname available. */
> - if (err && err->apr_err == SVN_ERR_IO_INCONSISTENT_EOL)
> - err = svn_error_createf(SVN_ERR_IO_INCONSISTENT_EOL, err,
> - _("File '%s' has inconsistent newlines"),
> - svn_path_local_style(src, pool));
> -
> - return svn_error_compose_create(err, svn_stream_close(src_stream));
> -}
> -
> -
> -static svn_error_t *
> -svn_subst_create_translated(svn_stream_t *src_stream,
> - const char *dst,
> - const char *eol_str,
> - svn_boolean_t repair,
> - apr_hash_t *keywords,
> - svn_boolean_t expand,
> - apr_pool_t *pool)
> -{
> - const char *dst_tmp;
> - svn_stream_t *dst_stream;
> - svn_error_t *err;
> -
> - /* Our API contract says that we don't close SRC_STREAM, but the
> code
> - below always does. Disown the sucker. */
> - src_stream = svn_stream_disown(src_stream, pool);
> -
> /* For atomicity, we translate to a tmp file and then rename the tmp
> file
> over the real destination. */
> SVN_ERR(svn_stream_open_unique(&dst_stream, &dst_tmp,
> svn_path_dirname(dst, pool),
> svn_io_file_del_none, pool, pool));
>
> - /* If some translation is needed, the wrap the output stream (this
> is
> - more efficient than wrapping the input). */
> - if (eol_str || (keywords && (apr_hash_count(keywords) > 0)))
> - dst_stream = svn_subst_stream_translated(dst_stream, eol_str,
> repair,
> - keywords, expand, pool);
> + dst_stream = svn_subst_stream_translated(dst_stream, eol_str,
> repair,
> + keywords, expand, pool);
>
> /* ###: use cancel func/baton in place of NULL/NULL below. */
> err = svn_stream_copy3(src_stream, dst_stream, NULL, NULL, pool);
> if (err)
> - return svn_error_compose_create(err, svn_io_remove_file(dst_tmp,
> pool));
> + {
> + /* On errors, we have a pathname available. */
> + if (err->apr_err == SVN_ERR_IO_INCONSISTENT_EOL)
> + err = svn_error_createf(SVN_ERR_IO_INCONSISTENT_EOL, err,
> + _("File '%s' has inconsistent
> newlines"),
> + svn_path_local_style(src, pool));
> + return svn_error_compose_create(err, svn_io_remove_file(dst_tmp,
> pool));
> + }
>
> /* Now that dst_tmp contains the translated data, do the atomic
> rename. */
> return svn_io_file_rename(dst_tmp, dst, pool);
>
> Modified: trunk/subversion/libsvn_wc/copy.c
> URL:
> http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_wc/copy.c?path
> rev=35465&r1=35464&r2=35465
> =======================================================================
> =======
> --- trunk/subversion/libsvn_wc/copy.c Mon Jan 26 00:11:12 2009
> (r35464)
> +++ trunk/subversion/libsvn_wc/copy.c Mon Jan 26 03:30:42 2009
> (r35465)
> @@ -561,7 +561,7 @@ copy_file_administratively(const char *s
> svn_boolean_t repair = FALSE;
>
> if (eol_style == svn_subst_eol_style_native)
> - eol_str = "\n"; /* ### SVN_SUBST__DEFAULT_EOL_STR; */
> + eol_str = SVN_SUBST_NATIVE_EOL_STR;
> else if (eol_style == svn_subst_eol_style_fixed)
> repair = TRUE;
> else if (eol_style != svn_subst_eol_style_none)
>
> Modified: trunk/subversion/libsvn_wc/merge.c
> URL:
> http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_wc/merge.c?pat
> hrev=35465&r1=35464&r2=35465
> =======================================================================
> =======
> --- trunk/subversion/libsvn_wc/merge.c Mon Jan 26 00:11:12 2009
> (r35464)
> +++ trunk/subversion/libsvn_wc/merge.c Mon Jan 26 03:30:42 2009
> (r35465)
> @@ -211,7 +211,7 @@ detranslate_wc_file(const char **detrans
> consistent newlines and 'svn:eol-style' set. */
>
> if (style == svn_subst_eol_style_native)
> - eol = "\n"; /* ### SVN_SUBST__DEFAULT_EOL_STR; */
> + eol = SVN_SUBST_NATIVE_EOL_STR;
> else if (style != svn_subst_eol_style_fixed
> && style != svn_subst_eol_style_none)
> return svn_error_create(SVN_ERR_IO_UNKNOWN_EOL, NULL, NULL);
>
> Modified: trunk/subversion/libsvn_wc/questions.c
> URL:
> http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_wc/questions.c
> ?pathrev=35465&r1=35464&r2=35465
> =======================================================================
> =======
> --- trunk/subversion/libsvn_wc/questions.c Mon Jan 26 00:11:12 2009
> (r35464)
> +++ trunk/subversion/libsvn_wc/questions.c Mon Jan 26 03:30:42 2009
> (r35465)
> @@ -290,7 +290,7 @@ compare_and_verify(svn_boolean_t *modifi
> if (compare_textbases && need_translation)
> {
> if (eol_style == svn_subst_eol_style_native)
> - eol_str = "\n"; /* ### SVN_SUBST__DEFAULT_EOL_STR; */
> + eol_str = SVN_SUBST_NATIVE_EOL_STR;
> else if (eol_style != svn_subst_eol_style_fixed
> && eol_style != svn_subst_eol_style_none)
> return svn_error_create(SVN_ERR_IO_UNKNOWN_EOL, NULL,
> NULL);
>
> Modified: trunk/subversion/libsvn_wc/translate.c
> URL:
> http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_wc/translate.c
> ?pathrev=35465&r1=35464&r2=35465
> =======================================================================
> =======
> --- trunk/subversion/libsvn_wc/translate.c Mon Jan 26 00:11:12 2009
> (r35464)
> +++ trunk/subversion/libsvn_wc/translate.c Mon Jan 26 03:30:42 2009
> (r35465)
> @@ -102,7 +102,7 @@ svn_wc_translated_stream(svn_stream_t **
> if (to_nf)
> {
> if (style == svn_subst_eol_style_native)
> - eol = "\n"; /* ### SVN_SUBST__DEFAULT_EOL_STR; */
> + eol = SVN_SUBST_NATIVE_EOL_STR;
> else if (style == svn_subst_eol_style_fixed)
> repair_forced = TRUE;
> else if (style != svn_subst_eol_style_none)
> @@ -194,7 +194,7 @@ svn_wc_translated_file2(const char **xla
> /* to normal form */
>
> if (style == svn_subst_eol_style_native)
> - eol = "\n"; /* ### SVN_SUBST__DEFAULT_EOL_STR; */
> + eol = SVN_SUBST_NATIVE_EOL_STR;
> else if (style == svn_subst_eol_style_fixed)
> repair_forced = TRUE;
> else if (style != svn_subst_eol_style_none)
>
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=495&dsMessageI
> d=1054354

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1054756
Received on 2009-01-26 15:08:13 CET

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