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

Re: pre-commit hook newbie: enforcing ChangeLog updates

From: Ryan Schmidt <subversion-2008c_at_ryandesign.com>
Date: Fri, 22 Aug 2008 03:48:18 -0500

On Aug 22, 2008, at 01:54, Janek Kozicki wrote:

> I would like to learn about pre-commit hooks in SVN. And first thing
> that I would like to do is following:
>
> - Check if this commit modifies /trunk/ChangeLog
>
> - if yes: let it happen
>
> - if no:
> - Check how many commits ago this user modified /trunk/
> ChangeLog
> (counting only commits of this user, and skipping all other
> users who did commits in between)
>
> - if less than 5: let it happen
>
> - if more than 5: return "Error, it is your 5th commit
> without updating ChangLog, please update it". FAILURE
>
>
> Can anybody direct me to, what are the necessary SVN tools to do that?
>
> - checking if /trunk/ChangeLog is being modified

Consult the output of "svnlook changed -t $TXN $REPOS" and see if
trunk/ChangeLog is listed.

> - checking how long time ago THIS user modified /trunk/ChangeLog

Subversion doesn't have a command that directly answers that
question, so you'll have to parse the output of "svn log" to get it.

> Also: is it possible to write those pre-commit hooks in bash? I don't
> know perl or python, but I'm quite proficient with bash.

Sure. Just make the first line of the pre-commit hook "#!/bin/bash".
And of course set its execute bit.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: users-help_at_subversion.tigris.org
Received on 2008-08-22 10:48:46 CEST

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.