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

Re: using/creating hooks within subversion...

From: m christensen <dfs_at_xmission.com>
Date: 2004-08-26 00:36:38 CEST

We talked about this a bit offline and I'd like to clarify a few of my
points alluded to and
to try and clarify his question a bit....

bruce wrote:

>in exploring the subversion docs, the concept of hooks is discussed. i'm
>interested in understanding how a given hook/template is called. the docs
>discussed the sample hooks, and the naming of the hooks, but i couldn't find
>information on how i could write a hook of my own, and have it be called.
As I stated place the scripts with the appropriate names at the
appropriate path and they will be called
by the subversion server.
In the directory <Your repository>/hooks, ON THE SERVER place an
executable with one of the 5
defined names:

On windows they would be *.EXE or *.BAT.

My question was:
"IF my windows machine is configured such that I, from a command line
can type "foo.pl" and have
windows automagically know it's a perl script and call perl with this
script as a parameter"
THAN does it follow that I can
place a 'pre-commit.pl' in the hooks directory and have it execute
OR Must I have a pre-commit..BAT that calls my pre-commit.pl' ?

>as an example, if i wrote a hook and called it foo.pl, how would i tell the
>svn/svnserve functions to use it.
>i'm considering something where a user would use a hook when attempting to
>access the svn repository. the client would 'send' a username/passwd. the
>hook would access a db based upon the usernam/passwd to determine what
>dirs/files the user has access to. the hook would either grant/deny access
>to the user.
As I said, look at the .tmpl files in the above mentioned directory.
They Tell you what parameters each script is called with, this in
The 'client' is not really part of the picture.

Look at "pre-commit.tmpl"

# The pre-commit hook is invoked before a Subversion txn is
# committed. Subversion runs this hook by invoking a program
# (script, executable, binary, etc.) named 'pre-commit' (for which
# this file is a template), with the following ordered arguments:
# [1] REPOS-PATH (the path to this repository)
# [2] TXN-NAME (the name of the txn about to be committed)

That is what you get for your 2 command line parameters in this case.
any other info you need will need to come from subversion itself and the
assumption is this is enough unique
info to look up any other details.

>but i have no idea as to how to integrate this kind of function within the
>framework of subversion...
>the reaon i'm looking at this kind of soln is that i'm considering an app
>that will have alot of dirs/files that will be created/added/deleted from
>the repository. using apache to provide the access control would probably
>entail a great deal of editing the httpd.conf file as dirs are changed,
>which isn't something i'd want to maintain over time...
>searching through the docs/google hasn't shed any light on this issue...
>any assistance/comments/pointers/samples/etc... would be greatly
>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 Thu Aug 26 00:37:13 2004

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.