SVN::Hooks::UpdateConfFile(3pm) | User Contributed Perl Documentation | SVN::Hooks::UpdateConfFile(3pm) |
SVN::Hooks::UpdateConfFile - Maintain the repository configuration versioned.
version 1.36
This SVN::Hooks plugin allows you to maintain the repository configuration files under version control.
The repository configuration is usually kept in the directory "conf" under the directory where the repository was created. In a brand new repository you see there the files "authz", "passwd", and "svnserve.conf". It's too bad that these important files are usually kept out of any version control system. This plugin tries to solve this problem allowing you to keep these files versioned under the same repository where they are used.
It's active in the "pre-commit" and the "post-commit" hooks.
It's configured by the following directive.
This directive makes that after a successful commit in which the file FROM, under version control, have been added or modified, its newest version is copied to TO.
FROM can be a string or a qr/Regexp/ specifying the file path relative to the repository's root (e.g. "trunk/src/version.c" or "qr:^conf/(\w+).conf$:").
TO must be a relative path indicating where the original file must be copied to below the "/repo/conf" directory in the server. It can be an explicit file name or a directory, in which case the basename of FROM is used as the name of the destination file. Non-existing directory components of TO are automatically created.
Note that if the path doesn't exist the hook assumes that it should be a file. To make sure it's understood as a directory you may end it with a forward slash (/).
If FROM is a qr/Regexp/, TO is evaluated as a string in order to allow for the interpolation of capture buffers from the regular expression. This is useful to map the copy operation to a different directory structure. For example, this configuration "qr:^conf/(\w+).conf$: => '$1.conf'" updates any .conf file in the repository conf directory.
The optional @ARGS must be a sequence of pairs like these:
The function receives three arguments:
The command is called with three arguments:
The function receives the same three arguments as the validator's function above.
The command is called with the same three arguments as the validator's command above.
The function receives the same three arguments as the validator's function above.
The command is called with the same three arguments as the validator's command above.
UPDATE_CONF_FILE( 'conf/authz' => 'authz', validator => ['/usr/local/bin/svnauthcheck'], generator => ['/usr/local/bin/authz-expand-includes'], actuator => ['/usr/local/bin/notify-auth-change'], rotate => 2, ); UPDATE_CONF_FILE( 'conf/svn-hooks.conf' => 'svn-hooks.conf', validator => [qw(/usr/bin/perl -c)], actuator => sub { my ($contents, $file) = @_; die "Can't use Gustavo here." if $contents =~ /gustavo/; }, rotate => 2, ); UPDATE_CONF_FILE( qr:/file(\n+)$:' => 'subdir/$1/file', rotate => 2, remove => 1, );
Gustavo L. de M. Chaves <gnustavo@cpan.org>
This software is copyright (c) 2022 by CPqD <www.cpqd.com.br>.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
2022-09-11 | perl v5.34.0 |