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/02 14:14:48 UTC

how to "hook" a executable program?

Hi, 

	Is the "hook" working in this way?
	 step1. Any activity (commit, ...) will trigger a hook, for example,
post_commit.
	 step2	--> Within post_commit, you can put any "executable" program
to do whatever you want.
		--> so that the executable program will be executed once if
there is any trigger.	
	                 For example, in each commit, it will call
"send_mail" to do something.

	Is it correct to interpret "hook" functionality?
	

            When I create a repository, the "hook" directory will be created
automatically with following temp files:

	 5/02/2003   9:24           1,406  post-commit.bat
 	5/02/2003   8:12           1,297  post-commit.tmpl
 	4/24/2003  15:00           1,475  post-revprop-change.tmpl
 	4/24/2003  15:00           2,093  pre-commit.tmpl
 	4/24/2003  15:00           1,952  pre-revprop-change.tmpl
 	4/24/2003  15:00           1,377  start-commit.tmpl 

	And following is the procedure for me to test hook functions:
	(I am running subversion on Window NT)
	1. rename the post-commit.tmpl to post-commit.bat (it should be
converted to "bat" format)
	2. within the post-commit.bat, I execute a command "test.bat", which
is very simple, to rename e-text to x.txt

	Following is the post-commit.bat:
	/**** Begin post-commit.bat
	rem !/bin/sh
	echo off
	test.bat
	/**** end of post-commit.bat ****/

	Theoretically, if I commit a file, the post-commit.bat will be
triggered, and then the test.bat will be executed
            once. That means the e-text will be renamed to be x.txt.

	Unfortunately, this don't happen. Anything wrong with this
procedure?
	Before I hook up any executable program, do I need to do any other
things?

	Following the document (chapter 5 --repository hooks), there is a
perl program called commit-email.pl. 
	As I install Subversion on Window NT, I can not find it there. But I
can get it from subversion's source code 
	(tools/hook-scripts/). It seems to me that it works on Unix/Linux
environment. Are there any other program 
            working on window? or do I need to convert for running in
Window? (sorry, I do not familiar with perl.)

	Appreciate your help. Thanks.


	-- Chien-Lung

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

Re: how to "hook" a executable program?

Posted by kf...@collab.net.
Chien-Lung Wu <cw...@deltartp.com> writes:
> 	Following is the post-commit.bat:
> 	/**** Begin post-commit.bat
> 	rem !/bin/sh
> 	echo off
> 	test.bat
> 	/**** end of post-commit.bat ****/
> 
> 	Theoretically, if I commit a file, the post-commit.bat will be
> triggered, and then the test.bat will be executed
>             once. That means the e-text will be renamed to be x.txt.
> 
> 	Unfortunately, this don't happen. Anything wrong with this
> procedure?

You're doing things right, there's just some small problem (I don't
know what).

Maybe it can't find test.bat?  Perhaps you should give a full path to
test.bat?

Try a simpler test first -- just make your hook create a file
somewhere, so you know it ran.  That is, instead of running test.bat,
the hook script *itself* will do something visible.

-Karl


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