You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Alexander Malic <Al...@workflow.at> on 2006/08/22 12:59:49 UTC

Where to find good Documentation how to write Hook-Scripts for SVN on Windows

Hi,

I was looking around for good Documentation describing development of 
Hook-Scripts for Subversion.
SVN is our first Version-Management-System, so there is no Experience with 
Versioning-Systems.

The Documentation in the SVN-Book is also not very good and the sample 
Hook-Scripts are written for Linux/Unix-Systems.

I want to create Hook-Scripts for this two use-cases:
- prevent commits without comments (min. 20 characters)
- append the comments into a text-file (with actual date) for daily mail 
to all developers

thanx in advance.

Mit freundlichen Grüßen / Best regards
Alexander Malic

Re: Where to find good Documentation how to write Hook-Scripts for SVN on Windows

Posted by si <ss...@gmail.com>.
Hi Alexander,

> I was looking around for good Documentation describing development
> of Hook-Scripts for Subversion.

It's not that different, most of the documentation still applies:
- ensure subversion user has permission to programs/paths
- ensure you log to a file or similar, at least during testing,
this will make tracking any problems a lot easier.

One difference is that environment variables are not cleared in
a hook in Windows (they are in Linux, etc), and of course you
need to use different arguments: %1 instead of $1, etc.

> I want to create Hook-Scripts for this two use-cases:
> - prevent commits without comments (min. 20 characters)

I like the idea of setting a minimum length instead of just
preventing a commit when no log message is entered.

So if you're interested in a ready-made solution, I just
committed an update to subnant which does that.

http://svn.berlios.de/viewcvs/*checkout*/subnant/trunk/README.txt

So in your example, the post-commit.bat could be

@echo off
start /b subnant commit-message -D:repos=%1 -D:txn=%2 -D:min-length=20

Although i'd recommend you make use of a small workaround
for an issue with windows hooks not spawning background processes
properly, a drop-in replacement would look like:

hookstart commit-message -D:repos=%1 -D:txn=%2 -D:min-length=20

(hookstart.bat just loads subnant, but allows commit to immediately
return to client)

> - append the comments into a text-file (with actual date) for daily mail to
> all developers

The typical approach is to send out emails in the post-commit hook,
subnant can also do that for you, it uses Subversion properties stored
in directories to determine who and what information.

http://svn.berlios.de/viewcvs/*checkout*/subnant/trunk/doc/commit-email.html

However if you wanted it daily, google around and there may be some
existing solutions...For a quick and dirty hack, modify the commit-email
target to append the ${svnlook-file} to your daily file, then have your
scheduled task do the mailing and then clean the file.

Hope that helps!

peace
si

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