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

RE: Post Commit

From: Burgan, DeborahX <deborahx.burgan_at_intel.com>
Date: 2005-08-29 22:33:50 CEST

There were 2 things wrong with my setup. The perl script
(commit-email.pl) was looking in the wrong place (the first line) and
the call to the perl script in the post-commit file needed to be
expanded as noted below.

#! /bin/sh

# 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.
# Here is an example hook script, for a Unix /bin/sh interpreter:

set -xv


nfs/dp/proj/vt/itp/svn/repos/source/hooks/commit-email.pl "$REPOS"
"$REV" -s SVN: deborahx.burgan@intel.com
#log-commit.py --repository "$REPOS" --revision "$REV"

exit 2

-----Original Message-----
From: S I [mailto:xiamak@hotmail.com]
Sent: Monday, August 29, 2005 12:39 PM
To: qazwart@gmail.com; Burgan, DeborahX
Cc: haisenko@webport.de; users@subversion.tigris.org
Subject: Re: Post Commit

I need help with setting up the post commit email notifications. I am
reading this response from Mr. Weintraub and it specifies that the
has to be followed by the path of perl.

I just used my scripts out of the box and did not tweak them. Do I need
  I set up my post-commit starts with #!/bin/sh, and commit-email.pl
with #!/usr/bin/env perl. Running it at the linux prompt and providing
the repository path, a revision number, subject line and my email addr,
works manually. Post-commit can run via sh and it doesn't have to point
perl, does it?

Of course, no one has committed anything yet today, so I'm speaking
prematurely. I'm anxious to see if they work. I'm also curious what
#!/usr/bin/env perl does? Does it clear the environment and call perl?

Also, we're migrating 3 other projects under SVN this week, do I have to

tweak the .pl files per module or are they global?



----Original Message Follows----
From: David Weintraub <qazwart@gmail.com>
To: "Burgan, DeborahX" <deborahx.burgan@intel.com>
CC: Marc Haisenko <haisenko@webport.de>, users@subversion.tigris.org
Subject: Re: Post Commit
Date: Tue, 23 Aug 2005 15:00:35 -0400
MIME-Version: 1.0
Received: from tigris.org ([]) by mc9-f37.hotmail.com with

Microsoft SMTPSVC(6.0.3790.211); Tue, 23 Aug 2005 12:05:35 -0700
Received: (qmail 32762 invoked by uid 5000); 23 Aug 2005 19:00:41 -0000
Received: (qmail 32698 invoked from network); 23 Aug 2005 19:00:40 -0000
X-Message-Info: JGTYoYF78jFD1UWLBL++sWsBPNhXVoCBmzhCZDtN6Rs=
Mailing-List: contact users-help@subversion.tigris.org; run by ezmlm
Precedence: bulk
X-No-Archive: yes
list-help: <mailto:users-help@subversion.tigris.org>
list-unsubscribe: <mailto:users-unsubscribe@subversion.tigris.org>
list-post: <mailto:users@subversion.tigris.org>
Delivered-To: mailing list users@subversion.tigris.org
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta;
Return-Path: users-return-37329-xiamak=hotmail.com@subversion.tigris.org
X-OriginalArrivalTime: 23 Aug 2005 19:05:35.0649 (UTC)

Several things to look for:

* post-commit calls "commit-email.pl"
* post-commit has execute permission
* post-commit has the correct shebang on top (I had mine as #!
/usr/bin/perl, but it should have been #! /bin/perl).
* You have the full PATH in for your commit-email.pl program in the
post-commit script because Subversion clears out the PATH variable
before calling post-commit.

Here's a trick you can do: Make sure that the post-commit script exits
with a status of "2" instead of "0". That way, Subversion will detect
a failure and send you the output of STDERR.

On 8/23/05, Burgan, DeborahX <deborahx.burgan@intel.com> wrote:
> I have setup the commit-email.pl and the post-commit file with the
> appropriate information and if I enter this from a cmd line
> [servername:/nfs/dp/proj/vt/itp/svn/repos/source/hooks] >>perl
> commit-email.pl /nfs/dp/proj/vt/itp/svn/repos/source 800 -s
> SVN:project-source deborahx.burgan@intel.com
> It works great but when we checkin code it doesn't work
> Is there something else I need to do?
> commet-email.pl
> # Sendmail path.
> my $sendmail = "/usr/sbin/sendmail";
> # Svnlook path.
> my $svnlook = "/nfs/dp/proj/vt/itp/svn/SubVersion/bin/svnlook";
> post-commit
> REPOS="$1"
> TXN="$2"
> commit-email.pl "$REPOS" "$REV" -s SVN: deborahx.burgan@intel.com
> Thanks
> Debbie
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org

David Weintraub
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 Aug 29 22:37:56 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.