subversion-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Raevskiy <>
Subject [PATCH] Add '--include' and '--exclude' options to 'svnadmin dump'
Date Wed, 12 Oct 2016 10:43:40 GMT

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.

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

$ 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_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_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
  (sub_main): Handle new options.

* subversion/tests/cmdline/
   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_}

View raw message