[[[ Add a command line option (--source-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 http://thread.gmane.org/gmane.comp.version-control.subversion.devel/122518 http://thread.gmane.org/gmane.comp.version-control.subversion.devel/122550 Around half of the changes are to rename the "normalized count" variables so that it is more clear that the counters only count line ending normalizations and not re-encoding normalizations. The other half of the changes are cosmetic (adding comments or trimming trailing whitespace in lines) or exist to pass the argument to --source-encoding through to the functions that need it (mainly normalize_string() in subversion/svnsync/sync.c). * 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-encoding option. (opt_baton_t, subcommand_baton_t): Add the SOURCE_ENCODING field. (log_properties_normalized): Rename the NORMALIZED_REV_PROPS_COUNT parameter to LE_NORMALIZED_REV_PROPS_COUNT and the NORMALIZED_NODE_PROPS_COUNT parameter to LE_NORMALIZED_NODE_PROPS_COUNT. (copy_revprops): Add the PROP_ENCODING parameter. Rename the NORMALIZED_COUNT parameter to LE_NORMALIZED_COUNT. (make_subcommand_baton): Set the SOURCE_ENCODING field of the resulting subcommand_baton_t object to the value of SOURCE_ENCODING from the opt_baton_t object. (do_initialize, do_synchronize, do_copy_revprops, replay_rev_started, replay_rev_finished): Pass SOURCE_ENCODING to svnsync_* functions and copy_revprops(). (replay_baton_t): Rename the NORMALIZED_REV_PROPS_COUNT field to LE_NORMALIZED_REV_PROPS_COUNT and the NORMALIZED_NODE_PROPS_COUNT field to LE_NORMALIZED_NODE_PROPS_COUNT. (main): Handle the case when the command line option is --source-encoding. Set the SOURCE_ENCODING field of the opt_baton_t object to either OPT_ARG or NULL. * subversion/svnsync/sync.c (normalize_string): Rename WAS_NORMALIZED to WAS_LE_NORMALIZED to make clear that the counter only counts line ending normalizations. Add the ENCODING parameter. Handle the case when ENCODING is not NULL by calling svn_subst_translate_string2(). Switch to the "two pools" (result & scratch pools) pattern. Use memchr() instead of strchr() because the length of (*STR)->data is known. (svnsync_normalize_revprops): Rename NORMALIZED_COUNT to NORMALIZED_LE_COUNT. Add the ENCODING parameter. Move the call to apr_hash_set() outside of the if block (if (le_normalized)), as the property value may have been changed because of re-encoding even when no line ending was normalized. (edit_baton_t): Add the PROP_ENCODING field. Rename the NORMALIZED_NODE_PROPS_COUNTER field to NORMALIZED_LE_NODE_PROPS_COUNTER. (change_file_prop, change_dir_prop): Pass in PROP_ENCODING to normalize_string(). (svnsync_get_sync_editor): Add the PROP_ENCODING parameter. Rename the NORMALIZED_NODE_PROPS_COUNTER parameter to NORMALIZED_LE_NODE_PROPS_COUNTER. * subversion/svnsync/sync.h (svnsync_normalize_revprops): Add the ENCODING parameter. Rename the NORMALIZED_COUNT parameter to NORMALIZED_LE_COUNT. (svnsync_get_sync_editor): Add the PROP_ENCODING parameter. Rename the NORMALIZED_NODE_PROPS_COUNTER parameter to LE_NORMALIZED_NODE_PROPS_COUNTER. * subversion/tests/cmdline/svnsync_tests.py (copy_bad_line_endings2): New test case. (test_list): Add copy_bad_line_endings2. * subversion/tests/cmdline/svnsync_tests_data/copy-bad-line-endings2.dump A dump of a repository with the following features: 1. The log message (`svn:log` revision property) of revision 1 has CRLF line endings. 2. The log message of revision 2 has CR line endings. 3. Revision 3 introduces an `svn:ignore` node property with CRLF line endings. 4. Revision 4 introduces a custom node property, `x:related-to`, with CRLF line endings. * subversion/tests/cmdline/svnsync_tests_data/copy-bad-line-endings2.expected.dump A dump of the expected result of using svnsync to sync copy-bad-line-endings2.dump. ]]]