commit-email.pl
puede ser usado como post-commit
hook para enviar emails:
-bash-3.2$ uname -a Linux banot.etsii.ull.es 2.6.18-164.15.1.el5 #1 SMP Wed Mar 17 11:37:14 EDT 2010 i686 i686 i386 GNU/Linux -bash-3.2$ /usr/share/doc/subversion-1.4.2/tools/hook-scripts/commit-email.pl /usr/share/doc/subversion-1.4.2/tools/hook-scripts/commit-email.pl: too few arguments. usage (commit mode): /usr/share/doc/subversion-1.4.2/tools/hook-scripts/commit-email.pl REPOS REVNUM [[-m regex] [options] [email_addr ...]] ... usage: (revprop-change mode): /usr/share/doc/subversion-1.4.2/tools/hook-scripts/commit-email.pl --revprop-change REPOS REVNUM USER PROPNAME [-d diff_file] \ [[-m regex] [options] [email_addr ...]] ... options are: --from email_address Email address for 'From:' (overrides -h) -h hostname Hostname to append to author for 'From:' -l logfile Append mail contents to this log file -m regex Regular expression to match committed path -r email_address Email address for 'Reply-To:' -s subject_prefix Subject line prefix --diff y|n Include diff in message (default: y) (applies to commit mode only) This script supports a single repository with multiple projects, where each project receives email only for actions that affect that project. A project is identified by using the -m command line option with a regular expression argument. If the given revision contains modifications to a path that matches the regular expression, then the action applies to the project. Any of the following -h, -l, -r, -s and --diff command line options and following email addresses are associated with this project. The next -m resets the -h, -l, -r, -s and --diff command line options and the list of email addresses. To support a single project conveniently, the script initializes itself with an implicit -m . rule that matches any modifications to the repository. Therefore, to use the script for a single- project repository, just use the other command line options and a list of email addresses on the command line. If you do not want a rule that matches the entire repository, then use -m with a regular expression before any other command line options or email addresses. 'revprop-change' mode: The message will contain a copy of the diff_file if it is provided, otherwise a copy of the (assumed to be new) property value.
Estos son los contenidos del ejecutable post-commit
en el subdirectorio hooks
:
-bash-3.2$ uname -a Linux banot.etsii.ull.es 2.6.18-164.15.1.el5 #1 SMP Wed Mar 17 11:37:14 EDT 2010 i686 i686 i386 GNU/Linux bash-3.2$ pwd /home/casiano/newrepository/hooks -bash-3.2$ ls -ltra post-commit -rwxr-xr-x 1 casiano apache 280 abr 20 14:08 post-commit -bash-3.2$ cat post-commit #!/bin/sh REPOS="$1" REV="$2" /usr/share/doc/subversion-1.4.2/tools/hook-scripts/commit-email.pl "$REPOS" "$REV" --from 'aluXXX@ull.es' -r 'aluXXX@ull.es' 'aluXXX@gmail.com'Supongamos que modificamos nuestra copia de trabajo y hacemos un commit:
pp2@nereida:~/src/perl/subversion/banotnewrepproject2$ svn info Ruta: . URL: svn+ssh://banot/home/casiano/newrepository/project2/trunk Raíz del repositorio: svn+ssh://banot/home/casiano/newrepository UUID del repositorio: faf63038-71ca-4861-8080-6a701f9d687f Revisión: 11 Tipo de nodo: directorio Agendado: normal Autor del último cambio: casiano Revisión del último cambio: 11 Fecha de último cambio: 2010-04-20 09:17:16 +0100 (mar 20 de abr de 2010) pp2@nereida:~/src/perl/subversion/banotnewrepproject2$ vi Makefile.PL pp2@nereida:~/src/perl/subversion/banotnewrepproject2$ svn commit -m 'checking post-commit' Enviando Makefile.PL Transmitiendo contenido de archivos . Commit de la revisión 20.Ahora en nuestra cuenta de correo tenemos un mensaje:
from aluXXX@ull.es reply-to aluXXX@ull.es to aluXXX@gmail.com date 20 April 2010 14:09 subject r20 - project2/trunk mailed-by ull.es hide details 14:09 (21 minutes ago) Author: aluXXX Date: 2010-04-20 14:09:35 +0100 (Tue, 20 Apr 2010) New Revision: 20 Modified: project2/trunk/Makefile.PL Log: checking post-commit Modified: project2/trunk/Makefile.PL =================================================================== --- project2/trunk/Makefile.PL 2010-04-20 08:32:45 UTC (rev 19) +++ project2/trunk/Makefile.PL 2010-04-20 13:09:35 UTC (rev 20) @@ -1,11 +1,4 @@ use ExtUtils::MakeMaker; - - -# -# -# -# -# WriteMakefile( NAME => 'project2', VERSION_FROM => 'lib/project2.pm', # finds $VERSION
Casiano Rodríguez León