You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by we...@tigris.org on 2009/03/05 01:31:58 UTC

pre/post command hook

Are there any plans to implement pre/post command hooks?  Or... is there any chance this could be added?

What I mean by "command" hook is a script that's called before ANY command is executed regardless if it changes the repository or not.   So... even a "checkout", "status" or "log" command would trigger this hook script.

NOTE: Access to all my repositories is via svn+ssh://, so even though some of the following may be possible vi apache, that's not an option for me.

The primary reasons I'd like to see this are:

  1. It would provide a way to temporarily disable a repository so off-line maintenance can be done.   I could rename the existing repository and create a temporary dummy repository of the same name that includes a "pre-command" hook script which disallows all access along with a message "System maintenance, try again in an hour".

  2. It would provide a way to do connection level logging.   I often need to know how busy a repository is or the last time it was accessed (not changed... but accessed).  With a pre-command (or possibly post-command) hook script, I believe I could create a log with at least the date,client ip, user and repository... hopefully also the command, command args and result of the command.

I think the only difference between the pre-command and post-command would be the post-command includes the result of the command (successful or not) and any specific error message, if that's possible.

If there's another way to accomplish either of the 2 goals above, given the restriction that it must work for svnserve (via svn+ssh://), I'd be happy to consider that as well.

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1269726

Re: pre/post command hook

Posted by Greg Stein <gs...@gmail.com>.
There are no plans. What you're requesting can easily be solved by
just replacing your "svnserve" binary with a shell script which does
the pre/post stuff and then calls the real svnserve binary.

Cheers,
-g

On Thu, Mar 5, 2009 at 02:31,  <we...@tigris.org> wrote:
> Are there any plans to implement pre/post command hooks?  Or... is there any chance this could be added?
>
> What I mean by "command" hook is a script that's called before ANY command is executed regardless if it changes the repository or not.   So... even a "checkout", "status" or "log" command would trigger this hook script.
>
> NOTE: Access to all my repositories is via svn+ssh://, so even though some of the following may be possible vi apache, that's not an option for me.
>
> The primary reasons I'd like to see this are:
>
>  1. It would provide a way to temporarily disable a repository so off-line maintenance can be done.   I could rename the existing repository and create a temporary dummy repository of the same name that includes a "pre-command" hook script which disallows all access along with a message "System maintenance, try again in an hour".
>
>  2. It would provide a way to do connection level logging.   I often need to know how busy a repository is or the last time it was accessed (not changed... but accessed).  With a pre-command (or possibly post-command) hook script, I believe I could create a log with at least the date,client ip, user and repository... hopefully also the command, command args and result of the command.
>
> I think the only difference between the pre-command and post-command would be the post-command includes the result of the command (successful or not) and any specific error message, if that's possible.
>
> If there's another way to accomplish either of the 2 goals above, given the restriction that it must work for svnserve (via svn+ssh://), I'd be happy to consider that as well.
>
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1269726
>

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1272870