Adam or Anyone in the forum,
I finally had a chance to tweak this script and get it to work for users to
be enforced to start with a bug number but I just realized this is going to
enforce everyone using Subversion to input a number associated with a
comment even for non-essential projects which are not kept in our bug
tracking system, therefore, not requiring a bug#. How can I modify the
value of REPO="$1" to target only certain projects? Could I do something
like: REPO="$1/project1/branches/"?
[rez@svn hooks]$ sudo vi pre-commit
#!/bin/bash
# A pre-commit hook script to ensure that no changes are commited to the
# repository without a valid comment
#
# $Id: pre-commit 830 2006-05-08 00:20:06Z ram $
# arguments
REPO="$1"
TXN="$2"
# binary locations
SVNLOOK=/usr/bin/svnlook
GREP=/bin/grep
# make sure that the log message contains some text.
$SVNLOOK log $REPO -t $TXN | $GREP '^[[:digit:]]' >> /dev/null
err=$?
if [ $err -ne 0 ]; then
echo -n "You must start your comment with a bug number, aborting..."
1>&2
exit 1
fi
----Original Message Follows----
From: "Adam Mercer" <ramercer@gmail.com>
To: "Subversion Users" <users@subversion.tigris.org>
Subject: Re: Admin Scripts
Date: Wed, 7 Mar 2007 12:35:50 -0500
On 07/03/07, Res Pons <pons32@hotmail.com> wrote:
>Hi eveyrone
>
>I need to try to write a pre-commit script so developers are enforced to
>enter a comment for each checkin and all their comments must be preceded
>with a bug#. e.g. 1234 Fixing Javadocs blah blah.
>
>I'm not sure if this is accomplished via a pre or post commit. I know
>Perl
>and shell scripting -- NO Python or Ruby. Our SVN runs on a linux server.
>Could someone please give me some examples or URL's how to do this. The
>SVN
>manual provides no examples just vague descriptions or references.
>
>I appreciate all the help.
I attached a bash script which checks that a log message has been
specified, it doesn't check for the bug number like you want but this
should provide a starting point.
Cheers
Adam
<< pre-commit >>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
_________________________________________________________________
Get a FREE Web site, company branded e-mail and more from Microsoft Office
Live! http://clk.atdmt.com/MRT/go/mcrssaub0050001411mrt/direct/01/
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Wed Mar 14 23:31:25 2007