You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Chien-Lung Wu <cw...@deltartp.com> on 2003/05/14 19:54:10 UTC

post-commit/commit-email issue

Hi, there:

	I successfully install and run subversion (0.21.0) on Linux (redhat
7.2). However, I still have some questions
on post-commit/commit-email functionality.

	Followings are my detail test on Subversion:
	1. Install Suberversion server on machine 172.18.24.211 (linux) and
Subversion clients on window NT4.0
	    For the communication/access between server and clients, I set
up apache2.0.45/WebDAV. So I can 
	    access repository through http.
	
	2. Create a repository on Subversion server
		svn create /svn/repos/R3
	
	3. Retsrat httpd (web server)
	    On httpd.conf, I add following directive:
		<Location /svn/repos/R3>
			DAV svn
			SVNPath /svn/repos/R3
		</Location>
	    And then re-start webserver.

	4. On Subversion server (/svn/repos/R3/hooks), I do:
	    a. copy post-comit.tmpl to post-commit and make sure it is
executable.
	    b. check commit-email.pl and make sure it is executable

	      For verifying that post-commit is hooked, I modify the
post-commit to add one line:
		copy /svn/repos/R3/hooks/y.txt /sv/repos/R3/hooks/x.txt

	      Therefore, through checking the file x.txt, I can verify the
whether subversion server trigger
                   post-commit. (And "yes", it is)

	5. On subversion client (window NT 4.0), I checkout R3 to my working
directory:
		svn co http://172.18.24.211/svn/repos/R3

		(it works well. And now I have a copy of R3 on my local
working diretcory)

	6. edit and add a new file, called README
		svn add README    (it works.)

	7. commit this change.
		svn ci --force -m "commit README"     (Why do I need to use
--force?)

	8. Go back to subversion server. First, I get x.txt, that means
post-commit has been triggered.
	     BUT I DON"T receive any email, regarding this commit. Why?

	9. If I execute commit-email.pl from Subversion server on the
command line, 
	     perl commit-email.pl /svn/repos/R3 1 cwu@deltartp
	    
	    then I can receive e-mail from subersion server. Therefore, I
assume that commit-email.pl works


	10, Anything wrong between subversion server and post-commit? Any
configuration needs?


The post-commit hook is as following:
/********************************************
#!/bin/sh

# POST-COMMIT HOOK
#
# Here is an example hook script, for a Unix /bin/sh interpreter:

REPOS="$1"
REV="$2"
#echo "This is REPOS=$REPOS" >> y.txt
#echo "REV=$REV" >> y.txt
echo  $REPOS >> y.txt
echo  $REV >> y.txt
cp /svn/repos/R3/hooks/y.txt /svn/repos/R3/hooks/x.txt
#commit-email.pl "$REPOS" "$REV" commit-watchers@example.org
perl commit-email.pl "$REPOS" "$REV" cwu@deltartp.com
log-commit.py --repository "$REPOS" --revision "$REV"
/*******************************************************************

Anything wrong with post-commit?
I also try to make sure the input (REPOS and REV) from subversion server;
however, I find they are "empty".
Can anyone show me any hint to overcome this problem? Appreciate your help.


Regards,

Chien-Lung




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: post-commit/commit-email issue

Posted by cm...@collab.net.
Chien-Lung Wu <cw...@deltartp.com> writes:

> The post-commit hook is as following:
> /********************************************
> #!/bin/sh
> 
> # POST-COMMIT HOOK
> #
> # Here is an example hook script, for a Unix /bin/sh interpreter:
> 
> REPOS="$1"
> REV="$2"
> #echo "This is REPOS=$REPOS" >> y.txt
> #echo "REV=$REV" >> y.txt
> echo  $REPOS >> y.txt
> echo  $REV >> y.txt
> cp /svn/repos/R3/hooks/y.txt /svn/repos/R3/hooks/x.txt
> #commit-email.pl "$REPOS" "$REV" commit-watchers@example.org
> perl commit-email.pl "$REPOS" "$REV" cwu@deltartp.com
> log-commit.py --repository "$REPOS" --revision "$REV"
> /*******************************************************************
> 
> Anything wrong with post-commit?
> I also try to make sure the input (REPOS and REV) from subversion server;
> however, I find they are "empty".
> Can anyone show me any hint to overcome this problem? Appreciate your help.

I can't recall if hooks inherit the environment when they run, so try
passing the full path to 'perl' and 'log-commit.py' and such.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: post-commit/commit-email issue

Posted by Paul L Lussier <pl...@lanminds.com>.
In a message dated: Wed, 14 May 2003 15:54:10 EDT
Chien-Lung Wu said:

>perl commit-email.pl "$REPOS" "$REV" cwu@deltartp.com?

Why are you invoking this as 'perl commit-email.pl...' ?

The /bin/sh environment may or may not pick up the path to the perl 
executable (it should, but there are no guarantees), especially since 
the environment invoking the post-commit hook is not a real user
environment with a robust PATH configuration.

I'd re-write this as:

	/path/to/commit-email.pl  "$REPOS" "$REV" cwu@deltartp.com

I'm assuming here that the commit-email.pl script has a #!/path/to/perl
line at the top.  If that's not the case, then do:

	/path/to/perl /path/to/commit-email.pl  "$REPOS" "$REV" cwu@deltartp.com

just to be safe.

Of course, to avoid this in the future, you may want to create a 
env.sh file which has things like PATH and other environment settings 
in it, which then gets sourced by each pre/post commit-hook script.

That way, you can configure all your settings once for all your 
scripts (and, even make conditional decisions about the environment 
based on which hook is sourcing it).

Just my sysadmin $.000002 :)
-- 

Seeya,
Paul
--
Key fingerprint = 1660 FECC 5D21 D286 F853  E808 BB07 9239 53F1 28EE

	It may look like I'm just sitting here doing nothing,
   but I'm really actively waiting for all my problems to go away.

	 If you're not having fun, you're not doing it right!



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org