Darcs-Notify

 view release on metacpan or  search on metacpan

darcs-notify  view on Meta::CPAN

#!/usr/bin/perl
# Copyright (c) 2007-2009 David Caldwell,  All Rights Reserved. -*- perl -*-

use warnings;
use strict;
use Getopt::Long;
use Darcs::Notify;
use Pod::Usage;

my $smtp_server = "localhost";
my $repo = '.';
GetOptions('smtp-server=s' => \$smtp_server,
           'r|repo=s'      => \$repo,
           'h|help'        => sub { pod2usage(0) })
    and scalar @ARGV or pod2usage();

my @group = @ARGV;


Darcs::Notify->new(repo => $repo,
                   Email => { smtp_server => $smtp_server, to => [@group] })
    ->notify;

__END__

=head1 NAME

darcs-notify - Report darcs repository changes to an email list

=head1 SYNOPSIS

darcs-notify [options] <email> [<email> ...]

  Options:
    --smtp-server=<server>    Use a server other than "localhost".
    -r | --repo=<repo-dir>    Use a repo other than the current directory.
    -h | --help               Show some help.

=head1 DESCRIPTION

B<darcs-notify> compares the list of patches in a darcs repository
against a saved backup copy and sends emails about the changes. The
backup copy is stored in the file
F<_darcs/third-party/darcs-notify/old-inventory>.

=head1 USAGE

One way to use darcs notify is to just run it periodically. Since it
just compares the current list of patches against it's stored set it
can run any time. If there is nothing to report, nothing will happen.

However, typical usage is to install it into your darcs repo's post
hooks so that it runs automatically when someone pushes, pulls, or
unpulls some patches. To do this, edit your F<_darcs/prefs/defaults>
file (you might need to create it if it's not there already) and add
the following lines:

  apply posthook darcs-notify <email>
  apply run-posthook
  pull posthook darcs-notify <email>
  pull run-posthook
  unpull posthook darcs-notify <email>
  unpull run-posthook

That assumes B<darcs-notify> is in your path. If it is not, then put
its absolute path there. One technique is to place darcs-notify inside
the F<_darcs/third-party/darcs-notify> directory (you might need to create it if
you haven't run darcs-notify yet) and then use its relative path in
the F<_darcs/prefs/defaults> file:

  apply posthook _darcs/third-party/darcs-notify/darcs-notify <email>
  apply run-posthook
  pull posthook _darcs/third-party/darcs-notify/darcs-notify <email>
  pull run-posthook
  unpull posthook _darcs/third-party/darcs-notify/darcs-notify <email>
  unpull run-posthook

You should run B<darcs-notify> once manually on a repo before pushing
or pulling to the repo. It won't do anything but set itself up.

=head1 OPTIONS

=over 4

=item B<--help>

Prints the help for the program and exits.

=item B<--smtp-server>=<server>

Use this option to choose which mailserver gets the notification
emails. The default is "localhost".

=item B<-r> <repo-dir>

=item B<--repo>=<repo-dir>

Operate on a specific repository. If this option is not specified then
the current directory is used.

You probably don't want to use this option, it's really only useful
for testing.



( run in 0.631 second using v1.01-cache-2.11-cpan-39bf76dae61 )