| SVN-Hooks documentation | Contained in the SVN-Hooks distribution. |
SVN::Hooks::CheckCapability - Check the svn client capabilities.
This SVN::Hooks plugin checks if the Subversion client implements the required capabilities.
It's active in the start-commit hook.
It's configured by the following directive.
This directive enables the checking, causing the commit to abort if it doesn't comply.
The arguments are a list of capability names. Every capability specified must be supported by the client in order to the hook to succeed.
Example:
CHECK_CAPABILITY('mergeinfo');
Gustavo Chaves, <gnustavo@cpan.org>
Please report any bugs or feature requests to
bug-svn-hooks-checkproperty at rt.cpan.org, or through the web
interface at
http://rt.cpan.org/NoAuth/ReportBug.html?Queue=SVN-Hooks. I will
be notified, and then you'll automatically be notified of progress on
your bug as I make changes.
You can find documentation for this module with the perldoc command.
perldoc SVN::Hooks
You can also look for information at:
Copyright 2008-2009 CPqD, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| SVN-Hooks documentation | Contained in the SVN-Hooks distribution. |
package SVN::Hooks::CheckCapability; use strict; use warnings; use Carp; use SVN::Hooks; use Exporter qw/import/; my $HOOK = 'CHECK_CAPABILITY'; our @EXPORT = ($HOOK); our $VERSION = $SVN::Hooks::VERSION;
my @Capabilities; sub CHECK_CAPABILITY { push @Capabilities, @_; START_COMMIT(\&start_commit); return 1; } sub start_commit { my ($repo_path, $user, $capabilities) = @_; $capabilities ||= ''; # pre 1.5 svn clients don't pass the capabilities # Create a hash to facilitate the checks my %supported; @supported{split /:/, $capabilities} = undef; # Grok which required capabilities are missing my @missing = grep {! exists $supported{$_}} @Capabilities; if (@missing) { croak "$HOOK: Your subversion client does not support the following capabilities:\n\n\t", join(', ', @missing), "\n\nPlease, consider upgrading to a newer version of your client.\n"; } }
1; # End of SVN::Hooks::CheckCapability