You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Michael Wallendahl <mw...@spikus.com> on 2005/01/17 01:55:12 UTC
Patch -- Made commit-email.pl work on both Windows and Unix.
I have refactored the /tools/hook-scripts/commit-email.pl.in script to
work with both Unix and Windows systems and would like to submit it for
acceptance into the source tree. I mainly just included code that I
found online from Ian Brockbank, Benjamin Garret, and Jeff Cave. Thanks
for your work people!
I would appreciate if others could test the script and let the list know
if it works or not.
I tested the script on both my Windows XP (ActivePerl 5.8.6) and FreeBSD
5.3 (Perl 5.8.5) systems. Coming from the Windows world, I tried to
keep the changes as small as possible, but the following two changes may
be judged too severe for Unix people (If so I would be open to any
suggestions on how to resolve them):
1. The script now requires the Net::SMTP, Cmd, and File::Temp packages.
These packages are included in the Windows ActiveState Perl install and
were found on my FreeBSD 5.3 box, but I don't know if they are included
with most other Perl distributions.
2. I removed the call to sendmail as the program does not exist on
Windows systems and plugged in code I found that uses Net::SMTP. The
script now requires the user to configure the name of a mailserver that
will accept the log e-mails. Setting $mailserver to "localhost" works on
my FreeBSD 5.3 system (as long as I also use the -h or --from options).
I am not sure if that is an acceptable solution to the Unix crowd here.
Attached is a diff against the most recent revision. I have also
attached the entire commit-email.pl.in script as well as the
post-commit.bat file that I use so that it makes it into the mailing
list archives for other Windows admins.
If this patch does get accepted, here is a log entry for it:
===== LOG MESSAGE =====
Included rewritten 'safe_read_from_pipe' subroutine found in
contrib/client-side/svn_load_dirs.pl submitted by Ian Brockbank. This
allows Windows systems to join the party while retaining existing
subroutine for compatible systems.
Included portable temporary filename/dir code from
'contrib/client-side/svn_load_dirs.pl' submitted by Ian Brockbank. This
removes the hard coded /tmp path in the script so that it plays nice
with Windows as well as Unix. Requires File::Temp and Cwd.
Replaced call to 'sendmail' with more portable Net::SMTP commands when
mailing log because Windows does not come with sendmail. Unix systems
may be able to just set $mailserver to "localhost". Requires Net::SMTP.
Included code submitted by Benjamin Garret and Jeff Cave to dev@ list (
http://subversion.tigris.org/servlets/ReadMsg?list=dev&msgNo=63184 ).
Set $mail_from to "subversion" if $author not defined (e.g. by an
anonymous commit). Still can be overridden by --from option as before.
Set $mail_from to "" if you want previous script behavior. Included code
submitted by Benjamin Garret and Jeff Cave to dev@ list (
http://subversion.tigris.org/servlets/ReadMsg?list=dev&msgNo=63184 ).
Added a $scriptDebug flag. If set to non-zero, script will print debug
messages to STDERR as it runs.
Updated copyright year to include 2005.
===== END LOG MESSAGE =====
Thanks,
-Mike