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

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

From: si <sshnug.si_at_gmail.com>
Date: 2006-08-24 16:57:18 CEST

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
Received on Thu Aug 24 17:00:57 2006

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.