/[Apache-SVN]
ViewVC logotype

Revision 1807836


Jump to revision: Previous Next
Author: kotkov
Date: Fri Sep 8 22:36:38 2017 UTC (6 years, 7 months ago)
Changed paths: 13
Log Message:
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:

    https://subversion.apache.org/faq.html#fix-nonLF-log
    https://issues.apache.org/jira/browse/SVN-3404
    https://issues.apache.org/jira/browse/SVN-4263

* 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.

* tools/client-side/bash-completion
  (_svnadmin): Extend completion info.


Changed paths

Path Details
Directorysubversion/trunk/subversion/include/private/svn_repos_private.h modified , text changed
Directorysubversion/trunk/subversion/include/svn_repos.h modified , text changed
Directorysubversion/trunk/subversion/libsvn_repos/deprecated.c modified , text changed
Directorysubversion/trunk/subversion/libsvn_repos/fs-wrap.c modified , text changed
Directorysubversion/trunk/subversion/libsvn_repos/load-fs-vtable.c modified , text changed
Directorysubversion/trunk/subversion/svnadmin/svnadmin.c modified , text changed
Directorysubversion/trunk/subversion/svnrdump/load_editor.c modified , text changed
Directorysubversion/trunk/subversion/svnrdump/svnrdump.h modified , text changed
Directorysubversion/trunk/subversion/svnrdump/util.c modified , text changed
Directorysubversion/trunk/subversion/tests/cmdline/svnadmin_tests.py modified , text changed
Directorysubversion/trunk/subversion/tests/cmdline/svntest/actions.py modified , text changed
Directorysubversion/trunk/subversion/tests/libsvn_repos/dump-load-test.c modified , text changed
Directorysubversion/trunk/tools/client-side/bash_completion modified , text changed

infrastructure at apache.org
ViewVC Help
Powered by ViewVC 1.1.26