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

Re: Can the commit message be changed by a hook?

From: Ryan Schmidt <subversion-2006d_at_ryandesign.com>
Date: 2006-11-02 21:20:56 CET

On Nov 2, 2006, at 07:53, Erik Forsberg wrote:

> Can I change the commit message written into the repository using a
> hook?
>
> I would like to extract the bug title from the bug database given a
> bug reference, and add it to the commit message automatically.

You should be able to do that in the post-commit hook, yes. Your post-
commit hook is given the repository path and revision number, so you
can issue an "svn propset" command to set the svn:log property of the
revision. Here's a nice one:

#!/bin/sh

REPO="$1"
REV="$2"

SVN=/usr/local/bin/svn

$SVN propset --revprop -r $REV svn:log \
"haha, I'm changing your log message" \
file://$REPO

Note that you also need to install a pre-revprop-change hook to allow
revision properties to be changed, e.g.:

#!/bin/sh

REPO="$1"
REV="$2"
USER="$3"
PROPNAME="$4"
ACTION="$5"

if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:log" ]; then exit 0; fi

echo "Changing revision properties other than svn:log is prohibited" >&2
exit 1

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Thu Nov 2 21:21:43 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.