NAME

SVN::Simple::Hook::PreCommit - Role for Subversion pre-commit hooks

VERSION

version 0.213

SYNOPSIS

package MyHook::Cmd;
use Moose;
extends 'MooseX::App::Cmd';

package MyHook::Cmd::Command::pre_commit;
use Moose;
extends 'MooseX::App::Cmd::Command';
with 'SVN::Simple::Hook::PreCommit';

sub execute {
    my ( $self, $opt, $args ) = @_;
    my $txn = $self->txn();

    warn $self->author, ' changed ',
        scalar keys %{ $self->root->paths_changed() }, " paths\n";

    return;
}

DESCRIPTION

This Moose::Role gives you access to the current Subversion transaction for use in a pre-commit hook. It's designed for use with MooseX::App::Cmd::Command classes, so consult the main MooseX::App::Cmd documentation for details on how to extend it to create your scripts.

ATTRIBUTES

txn_name

Full name of the transaction to check in the repository.

transaction

The current Subversion transaction, automatically populated at object creation time when the txn_name is set.

author

The author of the current transaction as required by all SVN::Simple::Hook consumers.

root

The Subversion root node as required by all SVN::Simple::Hook consumers.

Example hooks/pre-commit hook script

#!/bin/sh

REPOS="$1"
TXN="$2"

perl -MMyHook::Cmd -e 'MyHook::Cmd->run()' pre_commit -r "$REPOS" -t "$TXN" || exit 1
exit 0

BUGS

Please report any bugs or feature requests on the bugtracker website https://github.com/mjgardner/svn-simple-hook/issues

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

AUTHOR

Mark Gardner <mjgardner@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2011 by GSI Commerce.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.