[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: commit-email.py and MOTD

From: <kfogel_at_collab.net>
Date: 2005-05-16 17:46:00 CEST

Paul <elegant_dice@yahoo.com> writes:
> Here is the diff

Thanks. Can you repost this to dev@, following the guidelines in
http://subversion.tigris.org/mailing-list-guidelines.html#patches ?

-Karl

> Paul wrote:
> > Hi,
> > I quickly hacked commit-email.py to add a MOTD option.
> > See attached, I hope you find it useful. Maybe it can be added to
> > the standard subversion release?
> >
> --- /usr/lib/subversion/hook-scripts/commit-email.pl 2005-04-10 06:37:31.000000000 +0800
> +++ /tmp/commit-email.pl 2005-05-16 12:44:12.000000000 +0800
> @@ -1,5 +1,7 @@
> #!/usr/bin/env perl
>
> +my $the_motd = '';
> +
> # ====================================================================
> # commit-email.pl: send a commit email for commit REVISION in
> # repository REPOS to some email addresses.
> @@ -99,6 +101,7 @@
> # project. If a key exists but has a false value (''), then the
> # command line option is allowed but requires special handling.
> my %opt_to_hash_key = ('--from' => 'from_address',
> + '--motd' => 'the_motd',
> '-h' => 'hostname',
> '-l' => 'log_file',
> '-m' => '',
> @@ -387,6 +390,7 @@
> my $reply_to = $project->{reply_to};
> my $subject_prefix = $project->{subject_prefix};
> my $subject;
> + $the_motd = $project->{the_motd};
>
> if ($commondir ne '')
> {
> @@ -447,13 +451,17 @@
>
> push(@head, "\n");
>
> + my @proj_body;
> + push(@proj_body, "$the_motd\n\n");
> + push(@proj_body, @body);
> +
> if ($sendmail =~ /\w/ and @email_addresses)
> {
> # Open a pipe to sendmail.
> my $command = "$sendmail $userlist";
> if (open(SENDMAIL, "| $command"))
> {
> - print SENDMAIL @head, @body;
> + print SENDMAIL @head, @proj_body;
> close SENDMAIL
> or warn "$0: error in closing `$command' for writing: $!\n";
> }
> @@ -468,7 +476,7 @@
> {
> if (open(LOGFILE, ">> $log_file"))
> {
> - print LOGFILE @head, @body;
> + print LOGFILE @head, @proj_body;
> close LOGFILE
> or warn "$0: error in closing `$log_file' for appending: $!\n";
> }
> @@ -492,6 +500,7 @@
> " -m regex Regular expression to match committed path\n",
> " -r email_address Email address for 'Reply-To:'\n",
> " -s subject_prefix Subject line prefix\n",
> + " --motd message Message of the day\n",
> "\n",
> "This script supports a single repository with multiple projects,\n",
> "where each project receives email only for commits that modify that\n",
> @@ -523,6 +532,7 @@
> log_file => '',
> match_regex => '.',
> reply_to => '',
> + the_motd => '',
> subject_prefix => ''};
> }
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Mon May 16 18:25:57 2005

This is an archived mail posted to the Subversion Users mailing list.