Julian Foad wrote:
Sergey Raevskiy wrote:
I've attached a patch that adds '--include/--exclude' options to
'svnadmin
dump'. These options work similarly to 'svndumpfilter include/exclude'
but provide proper handling of 'copy from' paths.
This is really important. I'm going to make some time to review it.
The functionality, and even the coding style, all looks perfect.
Committed as revision 1811992.
Thank you, Sergey!
I only noticed one little error: in svnadmin_tests.py test_list one of
the pre-existing tests was duplicated as well as adding the new tests.
Good follow-ups would be:
* update the help text to say: this functionality is equivalent to
using authz exclusions, and unlike svndumpfilter, using these options
does not break copies
* update the help text for "--pattern" to match svndumpfilter (I
added an explanation of the glob syntax there in r1783741, which was
after you wrote your patch)
* update tools/client-side/bash_completion
* update the 1.10 release notes and changelog to mention this
I will do the first three of these soon.
- Julian
Consider the following example with svndumpfilter:
[[
$ svnadmin create /repo
$ svn mkdir -m "" file:///repo/A
$ svn copy -m "" file:///repo/A file:///repo/B
$ svnadmin dump /repo | svndumpfilter include /B > dump
...
Revision 0 committed as 0.
Revision 1 committed as 1.
svndumpfilter: E200003: Invalid copy source path '/A'
]]
The 'svnadmin dump' with proposed include/exclude options can handle
this use
case properly:
[[
$ svnadmin dump /repo --include /B > dump
* Dumped revision 0.
* Dumped revision 1.
* Dumped revision 2.
]]
The proposed options are implemented using 'svn_repos_authz_func_t'
and the
not-included copy sources are hidden by the 'svn_repos' layer.
Some usage examples for the proposed options:
[[
$ svnadmin dump repos --include /calc > calc-dumpfile
...
$ svnadmin dump repos --include /calc --include /calendar > dumpfile
...
$ svnadmin dump repos --exclude /secret > dumpfile
...
$ svnadmin dump repos --include /calc --exclude /calendar > dumpfile
svnadmin: E205000: Try 'svnadmin help' for more info
svnadmin: E205000: '--exclude' and '--include' options cannot be used
simultaneously
$ svnadmin dump repos --include /cal* --pattern > dumpfile
...
]]
Log message:
[[
Add '--include' and '--exclude' options to 'svnadmin dump'.
* include/svn_repos.h
(svn_repos_dump_filter_func_t): New.
(svn_repos_dump_fs4): Update function signature and comment.
(svn_repos_dump_fs3): Update comment.
* libsvn_repos/deprecated.c
(svn_repos_dump_fs3): Update caller.
* libsvn_repos/dump.c
(write_revision_record): Call to svn_repos_fs_revision_proplist()
(with
AUTHZ_FUNC) instead of svn_fs_revision_proplist2() to filter revision
properties as well as revisions. Update comment.
(dump_filter_baton_t,
dump_filter_authz_func): New.
(svn_repos_dump_fs4): Initialize and pass AUTHZ_FUNC and
AUTHZ_BATON to
the repos layer API if FILTER_FUNC is specified by caller.
* subversion/svnadmin/svnadmin.c
(svnadmin__cmdline_options_t): Add enum values for new options.
(options_table): Add new options.
(cmd_table): Add new options to 'dump' subcommand.
(svnadmin_opt_state): Add new fields to represent new options.
(ary_prefix_match): New. Copied from svndumpfilter.
(dump_filter_baton_t,
dump_filter_func): New.
(subcommand_dump): Initialize FILTER_BATON. Pass DUMP_FILTER_FUNC
and a
pointer to FILTER_BATON to svn_repos_dump_fs() if any filtering
prefixes
specified.
(sub_main): Handle new options.
* subversion/tests/cmdline/svnadmin_tests.py
(dump_exclude,
dump_exclude_copysource,
dump_include,
dump_not_include_copysource,
dump_exclude_by_pattern,
dump_include_by_pattern,
dump_exclude_all_rev_changes,
dump_invalid_filtering_option): New.
(test_list): Add new tests to table.
* subversion/tests/libsvn_repos/dump-load-test.c
(test_dump_bad_props): Update caller.
Patch by: sergey.raevskiy{_AT_}visualsvn.com
]]