NAME

SVN::Simple::Hook::PostCommit - Role for Subversion post-commit hooks

VERSION

version 0.213

SYNOPSIS

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

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

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

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

    return;
}

DESCRIPTION

This Moose::Role gives you access to the Subversion revision just committed for use in a post-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

revision_number

Revision number created by the commit.

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/post-commit hook script

#!/bin/sh

REPOS="$1"
REV="$2"

perl -MMyHook::Cmd -e 'MyHook::Cmd->run()' post_commit -r "$REPOS" --rev "$REV" || 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.