svnadmin: Introduce the `--normalize-props` option for the load and load-revprops commands.
Currently, the only performed normalization is the automatic translation of non-LF line endings in the svn: property values. Apparently, this is a common issue reported by our users, as Subversion versions prior to 1.6 allowed such values for properties like svn:log and so they can be present in the dump files. The behavior before this changeset is that a user can either force loading the dump with such invalid properties using the --bypass-prop-validation (that affects reading them in the future), manually repair the dump file or use a tool like svnsync that performs the property normalization. It would be better if the users had an option to fix this right in the svnadmin load command.
See also the corresponding FAQ entry and related issues that have been fixed in svnsync and svnrdump:
* subversion/include/svn_repos.h (svn_repos_load_fs6): New version of svn_repos_load_fs5() accepting the new `normalize_props` argument. (svn_repos_load_fs5): Deprecate. (svn_repos_load_fs_revprops): Accept the new `normalize_props` argument. (svn_repos_get_fs_build_parser6): New version of svn_repos_get_fs_build_parser5() accepting the new `normalize_props` argument.
* subversion/include/private/svn_repos_private.h (svn_repos__normalize_prop): New private helper. The `normalized_p` argument will be currently unused by all calling sites, but it's added as the groundwork to simplify implementing the notifications about normalized properties in the future.
* subversion/libsvn_repos/deprecated.c (svn_repos_load_fs5, svn_repos_get_fs_build_parser5): Implement by forwarding to the new versions of these functions.
* subversion/libsvn_repos/fs-wrap.c (): Include svn_subst.h. (svn_repos__normalize_prop): Implement this new helper function. The implementation is close to how svn_rdump__normalize_prop() is written, but this function accepts two pools and handles the new `normalized_p` output argument.
* subversion/libsvn_repos/load-fs-vtable.c (struct parse_baton): Add new `normalize_props` field. (change_rev_prop): Accept new `normalize_props` argument, call the new helper function if it's set. (close_revision): Normalize the revision properties if necessary. (svn_repos_get_fs_build_parser6): New, replacing ... (svn_repos_get_fs_build_parser5): ...this function. (svn_repos_load_fs6): New, replacing ... (svn_repos_load_fs5): ...this function. (revprops_close_revision): Update call to change_rev_prop(). (build_revprop_parser): Accept new `normalize_props` argument, use it to initialize the new field in the parse_baton. (svn_repos_load_fs_revprops): Handle the new `normalize_props` argument by forwarding it to build_revprop_parser().
* subversion/svnadmin/svnadmin.c (svnadmin__cmdline_options_t, options_table): Add svnadmin__normalize_props. (cmd_table): Enable the new option for load and load-revprops commands. (struct svnadmin_opt_state): Add new `normalize_props` field and ... (sub_main): ...initialize it here. (subcommand_load, subcommand_load_revprops): Normalize properties when running with --normalize-props. Use separate hints when encountering invalid properties with non-LF line endings and all other kinds of invalid properties.
* subversion/svnrdump/svnrdump.h (svn_rdump__normalize_prop): Remove this declaration. This function is now superseded by the new svn_repos__normalize_prop() helper.
* subversion/svnrdump/util.c (): Include svn_repos_private.h, drop other includes. (svn_rdump__normalize_prop): Remove. This function is now superseded by the new svn_repos__normalize_prop() helper. (svn_rdump__normalize_props): Use the new svn_repos__normalize_prop() helper function.
* subversion/svnrdump/load_editor.c (set_revision_property, set_node_property): Use the new svn_repos__normalize_prop() helper function.
* subversion/tests/libsvn_repos/dump-load-test.c (test_load_bad_props): Use the new svn_repos_load_fs6() function, keep the previous behavior unchanged, i.e., do not normalize the properties.
* subversion/tests/cmdline/svntest/actions.py (run_and_verify_load, load_repo): Accept new `normalize_props` argument.
* subversion/tests/cmdline/svnadmin_tests.py (load_bad_props): Test loading with --normalize-props. Check for the error codes reported during load with non-LF line endings and without the new option. In cases when the load is successful, check the resulting svn:log property value in the repository.
Implement the new 'svnadmin dump-revprops' sub-command.
The implementation uses a bumped version of svn_repos_dump_fs that can now be told what kind of information to include in the dump. These new flags are "positive" and non-restrictive, e.g. INCLUDE_REVPROPS instead of REVPROPS_ONLY. That way, future revisions may easily extend this scheme.
* subversion/include/svn_repos.h (svn_repos_dump_fs4): Declared API revision. (svn_repos_dump_fs3): Deprecate the old one.
* subversion/libsvn_repos/dump.c (write_revision_record): Make dumping revprops an option. (svn_repos_dump_fs3): Replaced by ... (svn_repos_dump_fs4): ... the new API revision. Dump contents depending on the two new flag parameters.
* subversion/libsvn_repos/deprecated.c (svn_repos_dump_fs3): Implement here now as forwarding to the latest API.
* subversion/bindings/javahl/native/SVNRepos.cpp (dump): Call latest API version.
* subversion/svnadmin/svnadmin.c (svn_opt_subcommand_t): Declare new sub-command. (cmd_table): Define its UI. (get_dump_range): Factored out from ... (subcommand_dump): ... this. (subcommand_dump_revprops): Implement new sub-command. Code taken from subcommand_dump.