Danny Trebbien <dtrebbien@gmail.com>
r1051322 | julianfoad | 2010-12-21 00:05:27 +0000 (Tue, 21 Dec 2010)
Add a public API function, svn_subst_translate_string2(), an extension of
svn_subst_translate_string(), that has two additional output parameters for
determining whether re-encoding and/or line ending translation were performed.
As discussed at:
<http://thread.gmane.org/gmane.comp.version-control.subversion.devel/122550>
<http://thread.gmane.org/gmane.comp.version-control.subversion.devel/123020>
The essential changes are to the translate_newline() function, which now takes
an svn_boolean_t pointer, the value at which is set to TRUE if the pointer is
non-NULL and a different newline is written out. Most other changes are to pass
the svn_boolean_t pointer through to translate_newline().
* build.conf
Configure subversion/tests/libsvn_subr/subst_translate-test
* subversion/include/svn_subst.h
(svn_subst_translate_string2): New function.
(svn_subst_translate_string): Deprecate in favor of
svn_subst_translate_string2().
* subversion/libsvn_subr/subst.c
(STRING_IS_EOL): New macro that tests whether a string is an end-of-line
string ("\n", "\r", "\r\n").
(DIFFERENT_EOL_STRINGS): New macro that tests whether two end-of-line strings
are different.
(translate_newline): Add the TRANSLATED_EOL parameter. If the function
writes out a different newline, then it sets TRANSLATED_EOL to TRUE.
(translation_baton): Add the TRANSLATED_EOL field.
(create_translation_baton): Add a new parameter TRANSLATED_EOL that is
passed to the resulting translation_baton.
(translate_chunk): When calling translate_newline(), pass TRANSLATED_EOL from
the translation_baton.
(stream_translated): New static function. Its implementation is the old
implementation of svn_subst_stream_translated(), but accepting another
parameter, TRANSLATED_EOL, that is passed to the in/out translation batons
that it creates.
(svn_subst_stream_translated): Now a wrapper for stream_translated().
(translate_cstring): New static function. Its implementation is the old
implementation of svn_subst_translate_cstring2(), but modified to accept
another parameter, TRANSLATED_EOL, that is passed to stream_translated().
(svn_subst_translate_cstring2): Now a wrapper for translate_cstring().
(svn_subst_translate_string): Move to deprecated.c.
(svn_subst_translate_string2): New function. It takes three additional
parameters: TRANSLATED_TO_UTF8, TRANSLATED_LINE_ENDINGS, and another pool
parameter. The task of recording whether it translates a line ending is
delegated to translate_cstring().
* subversion/libsvn_subr/deprecated.c
(svn_subst_translate_string): Now a wrapper for svn_subst_translate_string2().
* subversion/tests/libsvn_subr/subst_translate-test.c
New test suite for the svn_subst_translate_* functions.
Patch by: Danny Trebbien <dtrebbien{_AT_}gmail.com>
r1051864 | julianfoad | 2010-12-22 11:52:11 +0000 (Wed, 22 Dec 2010)
Simplify the new test file 'subst_translate-test.c' added in r1051322.
* subversion/tests/libsvn_subr/subst_translate-test.c
(s_buf, strtocsrc): Delete.
(translate_string2_data_t, translate_cstring2_data_t): New structs.
(test_svn_subst_translate_string2, test_svn_subst_translate_cstring2):
Re-write in a data-driven manner, use helpers such as
SVN_TEST_STRING_ASSERT(), and other changes to maximize readability.
Review by: Danny Trebbien <dtrebbien{_AT_}gmail.com>
r1054320 | danielsh | 2011-01-01 23:23:41 +0000 (Sat, 01 Jan 2011)
* subversion/tests/cmdline/svnsync_tests.py
(copy_bad_line_endings): Tweak test shortname.
Patch by: Danny Trebbien <dtrebbien@gmail.com>
(extracted by me from a larger patch)
r1063320 | julianfoad | 2011-01-25 15:34:40 +0000 (Tue, 25 Jan 2011)
Extend svn_subst_translate_string2() with another parameter, REPAIR, to allow
the caller to customize whether line ending repairs are performed.
As discussed at:
http://thread.gmane.org/gmane.comp.version-control.subversion.devel/125050
* subversion/include/svn_subst.h
(svn_subst_translate_string2): Add a REPAIR parameter. Update the
documentation of the function.
* subversion/libsvn_subr/subst.c
(svn_subst_translate_string2): Add a REPAIR parameter. Pass the value through
to translate_cstring().
* subversion/libsvn_subr/deprecated.c
(svn_subst_translate_string): Call svn_subst_translate_string2() with REPAIR
set to FALSE.
* subversion/svn/util.c
(svn_cl__edit_string_externally, svn_cl__get_log_message): Call
svn_subst_translate_string2() with REPAIR set to FALSE.
* subversion/svn/propset-cmd.c
(svn_cl__propset): Call svn_subst_translate_string2() with REPAIR set to
FALSE.
* subversion/svn/lock-cmd.c
(get_comment): Call svn_subst_translate_string2() with REPAIR set to FALSE.
* subversion/svnadmin/main.c
(set_revprop): Call svn_subst_translate_string2() with REPAIR set to FALSE.
* subversion/tests/libsvn_subr/subst_translate-test.c
(test_svn_subst_translate_string2): Call svn_subst_translate_string2() with
REPAIR set to FALSE. Also test that inconsistent line endings result in
SVN_ERR_IO_INCONSISTENT_EOL when REPAIR is FALSE.
(test_repairing_svn_subst_translate_string2): New test case that tests a
repairing translation.
(test_funcs): Add test_repairing_svn_subst_translate_string2.
Patch by: Danny Trebbien <dtrebbien{_AT_}gmail.com>
r1073377 | danielsh | 2011-02-22 16:13:19 +0000 (Tue, 22 Feb 2011)
Add a test of svn_subst_translate_string2() to the subst_translate test suite.
As discussed at:
http://thread.gmane.org/gmane.comp.version-control.subversion.devel/125782
Message-ID: <AANLkTimo=NpF_FqB+PBPkeifXjbnsORGYkZ5npCAxyVz@mail.gmail.com>
Patch by: Danny Trebbien <dtrebbien@gmail.com>
* subversion/tests/libsvn_subr/subst_translate-test.c
(locale.h, string.h): Include these.
(ARRAY_LEN): New macro.
(test_svn_subst_translate_string2_null_encoding_helper): New function. It is
the core of the new svn_subst_translate_string2_null_encoding() test.
(test_svn_subst_translate_string2_null_encoding): New test that tests
svn_subst_translate_string2() with ENCODING set to NULL.
(test_funcs): Add test_svn_subst_translate_string2_null_encoding().
r1084283 | cmpilato | 2011-03-22 18:27:26 +0000 (Tue, 22 Mar 2011)
* subversion/tests/cmdline/svnrdump_tests.py
(copy_bad_line_endings_dump): Minor docstring tweak.
Patch by: Danny Trebbien <dtrebbien@gmail.com>
r1084330 | cmpilato | 2011-03-22 20:00:22 +0000 (Tue, 22 Mar 2011)
* subversion/tests/svnsync/main.c
(copy_revprops): Document the 'quiet' parameter.
Patch by: Danny Trebbien <dtrebbien@gmail.com>
r1084335 | cmpilato | 2011-03-22 20:08:57 +0000 (Tue, 22 Mar 2011)
Add a command line option (--source-prop-encoding) to the svnsync
init, sync, and copy-revprops subcommands that allows the user to
specify the character encoding of translatable properties from the
source repository. This is needed to allow svnsync to sync some older
Subversion repositories that have properties that were not encoded in
UTF-8.
As discussed at:
http://thread.gmane.org/gmane.comp.version-control.subversion.user/100020
Message-ID: loom.20100909T000542-92@post.gmane.org
http://thread.gmane.org/gmane.comp.version-control.subversion.devel/122518
Message-ID: AANLkTimYFxPkOs9OkCd3TV8tDJZnHB6Y0AwBXNT+r-PO@mail.gmail.com
http://thread.gmane.org/gmane.comp.version-control.subversion.devel/122550
Message-ID: AANLkTik11JLJxnNQGBUnZwenyJJ5_Yutut0wkSbEyPp5@mail.gmail.com
http://thread.gmane.org/gmane.comp.version-control.subversion.devel/124731
Message-ID: AANLkTikJD3bWBigqWKJdeAKUb49-WjaWSZj8iYZAEwE8@mail.gmail.com
http://thread.gmane.org/gmane.comp.version-control.subversion.devel/125057
Message-ID: AANLkTin48EYeJiG4TYVpTOVELYGR1RFXk-_tKjHwoJEX@mail.gmail.com
http://thread.gmane.org/gmane.comp.version-control.subversion.devel/125783
Message-ID: AANLkTimjj48xt4s=zOqC6GxoPPEdLpfSB9YmBY=7B4-5@mail.gmail.com
Most of the work is just to pass the value of the --source-prop-encoding
option through to the functions that need it, the foremost of which is
subversion/svnsync/sync.c:normalize_string().
* subversion/svnsync/main.c
(svnsync__opt) Add svnsync_opt_source_encoding.
(svnsync_cmd_table): Add svnsync_opt_source_encoding to the list of
acceptable options for the init, sync, and copy-revprops subcommands.
(svnsync_options): Add a description of the --source-prop-encoding option.
(opt_baton_t, subcommand_baton_t): Add the SOURCE_PROP_ENCODING field.
(copy_revprops): Add the SOURCE_PROP_ENCODING parameter. Pass it
through to svnsync_normalize_revprops().
(make_subcommand_baton): Set the SOURCE_PROP_ENCODING field of the
resulting subcommand_baton_t object to the value of
SOURCE_PROP_ENCODING from the opt_baton_t object.
(do_initialize, do_synchronize, do_copy_revprops,
replay_rev_started, replay_rev_finished): Pass SOURCE_PROP_ENCODING
to svnsync_* functions and copy_revprops().
(main): Handle the case when the command line option is
--source-prop-encoding. Set the SOURCE_PROP_ENCODING field of the
opt_baton_t object to either OPT_ARG or NULL.
* subversion/svnsync/sync.c
(normalize_string): Add the SOURCE_PROP_ENCODING parameter. Always
call svn_subst_translate_string2(). Switch to the "two pools"
(result/scratch) pattern.
(svnsync_normalize_revprops): Add the SOURCE_PROP_ENCODING
parameter. Pass the value through to normalize_string().
(edit_baton_t): Add the SOURCE_PROP_ENCODING field.
(change_file_prop, change_dir_prop): Pass SOURCE_PROP_ENCODING from
the edit baton to normalize_string().
(svnsync_get_sync_editor): Add the SOURCE_PROP_ENCODING parameter.
* subversion/svnsync/sync.h
(svnsync_normalize_revprops): Add the SOURCE_PROP_ENCODING
parameter. Update the documentation of the function.
(svnsync_get_sync_editor): Add the SOURCE_PROP_ENCODING
parameter. Update the documentation of the function.
* subversion/tests/cmdline/svnrdump_tests.py
(copy_bad_line_endings2_dump): New test case.
(test_list): Add copy_bad_line_endings2_dump.
* subversion/tests/cmdline/svnsync_tests.py
(run_sync): Add the SOURCE_PROP_ENCODING parameter. Build up the
command line arguments to `svnsync synchronize`.
(run_copy_revprops): Add the SOURCE_PROP_ENCODING parameter. Build
up the command line arguments to `svnsync copy-revprops`.
(run_init): Add the SOURCE_PROP_ENCODING parameter. Build up the
command line arguments to `svnsync initialize`.
(setup_and_sync): Add the SOURCE_PROP_ENCODING parameter. Pass the
value through to run_init(), run_sync(), and run_copy_revprops().
(run_test): Add the SOURCE_PROP_ENCODING parameter. Pass the value
through to setup_and_sync().
(copy_bad_line_endings2, copy_bad_encoding, identity_copy): New test
cases.
(test_list): Add reference to new test cases.
* subversion/tests/cmdline/svnrdump_tests_data/copy-bad-line-endings2.dump,
* subversion/tests/cmdline/svnrdump_tests_data/copy-bad-line-endings2.expected.dump,
* subversion/tests/cmdline/svnsync_tests_data/copy-bad-encoding.dump,
* subversion/tests/cmdline/svnsync_tests_data/copy-bad-encoding.expected.dump,
* subversion/tests/cmdline/svnsync_tests_data/copy-bad-line-endings2.dump,
* subversion/tests/cmdline/svnsync_tests_data/copy-bad-line-endings2.expected.dump
Data files for new tests.
Patch by: Danny Trebbien <dtrebbien@gmail.com>