Hook-Scripts

in jedem Repository gibt es ein hooks-Verzeichnis. Darin liegen Templates für post-commit, start-commit, ... Aktionen. Zum Verwenden einfach post-commit.tmpl ummoven in post-commit. Danach wird der Inhalt des Skripts automatisch nach jedem commit ausgeführt.

Beispiel für Commit-Emails

Ein funktionierendes (und für die svn46 vorkonfiguriertes) commit-email.pl Skript findet sich unter https://svn46.in.tum.de/intern/commit-email.pl

# cd ~svn/svnroot/<RepositoryName>/hooks
# mv post-commit.tmpl post-commit
# wget https://svn46.in.tum.de/intern/commit-email.pl
# chmod ug+x commit-email.pl
# chmod ug+x post-commit

Außerdem muessen im post-commit absolute Pfade verwendet werden. Die Standard-Angaben funktionieren also nicht.

Also:

commit-email.pl "$REPOS" "$REV" commit-watchers@example.org

&aauml;ndern in:

$REPOS/hooks/commit-email.pl "$REPOS" "$REV" -s "[SVN-Commit]" "<LOGIN>@in.tum.de"

Optional kann dem commit-email.pl Skript mit -m RegEx ein regulärer Ausdruck übergeben werden. Matcht dieser reguläre Ausdruck auf den Pfad des Commits wird eine Mail verschickt, sonst nicht!.

Weitere Optionen:

usage (commit mode):
  ./commit-email.pl REPOS REVNUM [[-m regex] [options] [email_addr ...]] ...
usage: (revprop-change mode):
  ./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)
  --stdout              Spit the message in mbox format to stdout.

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.