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

SVN Post Commit Email Notifications

From: S I <xiamak_at_hotmail.com>
Date: 2005-08-30 00:31:57 CEST

Hi Everyone,

Thanks for all your help. I'm still unable to turn on SVN post-commit
notifications.

1. I found & downloaded the files in the distribution source code and placed
them under svn/hooks.

2. Created post-commit and made both files (commit-email.pl too )
executable: chomd ugo+x 'd it. And since our SVN is running under Apache's
www group; I chown'd all the files to www:www. Could this be the cause of
the problem?

3. Had my Unix/Linux Admin guy to enable mail/sendmail on the server.

4. I can run things manually at the command prompt, however, the repository
is not triggered by the commits.

5. By the way, I have to run everything at the command prompt as 'sudo'!
Could this be another source of problem?

I tell you SVN is NOT easy to set up and configure. It was created to
overcome the idiosyncrasies of CVS, but does it? This has not been my
experience so far and I'm getting to really dislike it. I shouldn't be
spending days administering it.

Here's the content of my 2 files under hooks:

post-commit:

-----------------------------------------------------------------------------------------------------
#! /bin/sh

# POST-COMMIT HOOK
#
# The post-commit hook is invoked after a commit. Subversion runs
# this hook by invoking a program (script, executable, binary, etc.)
# named 'post-commit' (for which this file is a template) with the
# following ordered arguments:
#
# [1] REPOS-PATH (the path to this repository)
# [2] REV (the number of the revision just committed)
#
# The default working directory for the invocation is undefined, so
# the program should set one explicitly if it cares.
#
# Because the commit has already completed and cannot be undone,
# the exit code of the hook program is ignored. The hook program
# can use the 'svnlook' utility to help it examine the
# newly-committed tree.
#
# On a Unix system, the normal procedure is to have 'post-commit'
# invoke other programs to do the real work, though it may do the
# work itself too.
#
# Note that 'post-commit' must be executable by the user(s) who will
# invoke it (typically the user httpd runs as), and that user must
# have filesystem-level permission to access the repository.
#
# On a Windows system, you should name the hook program
# 'post-commit.bat' or 'post-commit.exe',
# but the basic idea is the same.
#
# The hook program typically does not inherit the environment of
# its parent process. For example, a common problem is for the
# PATH environment variable to not be set to its usual value, so
# that subprograms fail to launch unless invoked via absolute path.
# If you're having unexpected problems with a hook program, the
# culprit may be unusual (or missing) environment variables.
#
# Here is an example hook script, for a Unix /bin/sh interpreter.# For more
examples and pre-written hooks, see those in
# the Subversion repository at
# http://svn.collab.net/repos/svn/trunk/tools/hook-scripts/ and
# http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/

REPOS="$1"
REV="$2"

/local1/svn/hooks/commit-email.pl "$REPOS" "$REV" -s "SVN Notification: "
myemail@mydomain.com
#log-commit.py --repository "$REPOS" --revision "$REV"

exit 2

-----------------------------------------------------------------------------------------------------

EXCERPTS OF commit-email.pl:

-----------------------------------------------------------------------------------------------------

#!/usr/bin/env perl #This is the original shebang & I left it
intact, do I need to change it?

# ====================================================================
# commit-email.pl: send a commit email for commit REVISION in
# repository REPOS to some email addresses.
#
# For usage, see the usage subroutine or run the script with no
# command line arguments.
#
# $HeadURL:
http://svn.collab.net/repos/svn/branches/1.2.x/tools/hook-scripts/commit-email.pl.in
$
# $LastChangedDate: 2005-02-22 04:24:08 -0500 (Tue, 22 Feb 2005) $
# $LastChangedBy: maxb $
# $LastChangedRevision: 13107 $
#
# ====================================================================
# Copyright (c) 2000-2004 CollabNet. All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://subversion.tigris.org/license-1.html.
# If newer versions of this license are posted there, you may use a
# newer version instead, at your option.
#
# This software consists of voluntary contributions made by many
# individuals. For exact contribution history, see the revision
# history and logs, available at http://subversion.tigris.org/.
# ====================================================================

# Turn on warnings the best way depending on the Perl version.
BEGIN {
  if ( $] >= 5.006_000)
    { require warnings; import warnings; }
  else
    { $^W = 1; }
}

use strict;
use Carp;

######################################################################
# Configuration section.

# Sendmail path.
my $sendmail = "/usr/sbin/sendmail";

# Svnlook path.
my $svnlook = "/usr/bin/svnlook";

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Tue Aug 30 00:33:47 2005

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.