Subject: [PATCH] allow svnsync to translate non-UTF-8 log messages to UTF-8 (v. 2) [[[ 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 * subversion/include/svn_subst.h Added documentation of the new public API function svn_subst_translate_string2(). * subversion/libsvn_subr/subst.c (translation_baton): Added TRANSLATED_EOL field. It's where translate_chunk() records that it translated a line ending. (create_translation_baton): Added a new parameter TRANSLATED_EOL. Initialize the TRANSLATED_EOL field of the resulting translation_baton to this value. (translate_chunk): After translating a line ending, set the value that is pointed to by TRANSLATED_EOL (from the translation baton) to TRUE. (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_cstring2): 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_cstring2(). (svn_subst_translate_string2): New function. It does what svn_subst_translate_string() does, but also records whether it translated a line ending or performed re-encoding. * subversion/svnsync/main.c (svnsync__opt) Added svnsync_opt_source_encoding. (svnsync_cmd_table): Added svnsync_opt_source_encoding to the list of acceptable options for the init, sync, and copy-revprops subcommands. (opt_baton_t, subcommand_baton_t): Added SOURCE_ENCODING field. (copy_revprops): Added a parameter to receive the subcommand_baton_t*. Removed the QUIET parameter as this can be found from the subcommand baton. (make_subcommand_baton): Set the SOURCE_ENCODING field of the resulting subcommand_baton_t object to the value of SOURCE_ENCODING from opt_baton_t. (do_initialize, do_synchronize, do_copy_revprops, replay_rev_started, replay_rev_finished): Pass SOURCE_ENCODING to svnsync_* functions and copy_revprops(). (main): Handled the case when the command line option is --source-encoding. Set the SOURCE_ENCODING field of the opt_baton_t* to either the ARG of --source-encoding or NULL. * subversion/svnsync/sync.c (normalize_string): Renamed WAS_NORMALIZED to LE_NORMALIZED to make clear that the counter only counts line ending normalizations. Added the ENCODING parameter. Handle the case when ENCODING is not NULL by calling svn_subst_translate_string2(). (svnsync_normalize_revprops): Renamed NORMALIZED_COUNT to NORMALIZED_LE_COUNT. Added the ENCODING parameter. Moved the call to apr_hash_set() outside of the if block (if (le_normalized)), as the property value may have been changed even when no line ending was normalized. (edit_baton_t): Added the PROP_ENCODING field. Renamed 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): Added a PROP_ENCODING parameter, the value of which is set in the PROP_ENCODING field of the edit_baton_t. Renamed the NORMALIZED_NODE_PROPS_COUNTER parameter to NORMALIZED_LE_NODE_PROPS_COUNTER. * subversion/svnsync/sync.h Updated the declarations and documentation of the svnsync_* functions. ]]]