You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by "Stawiszynski, Piotr" <Pi...@sabre.com> on 2008/03/03 08:59:50 UTC

RE: pre-revprop-change hook problem

I wasn't precise, sorry for that. Hooks works fine since it prevent to modify any properties but it doesn't display information I put in the echo command...

I'm on solaris 9 with old version of SVN 1.2.1

Regards 


--
Piotr StawiszyƄski
Configuration Manager
Sabre Airline Products & Services
Sabre Development Center Krakow Poland

-----Original Message-----
From: Ryan Schmidt [mailto:subversion-2008a@ryandesign.com] 
Sent: Friday, February 29, 2008 8:00 PM
To: Stawiszynski, Piotr
Cc: users@subversion.tigris.org
Subject: Re: pre-revprop-change hook problem

On Feb 29, 2008, at 08:01, Stawiszynski, Piotr wrote:

> I would like to show some information to the users when this hook  
> failed. In pre-commit hook I send message to STDERR and user can  
> see why commit failed. I would like to do the same in case of  
> properies change.
>
> Any advise?
>
> What I tried is:
>
> Excerpt from pre-revprop-change
>
> if [ "$ACTION" == "M" -a "$PROPNAME" == "svn:log" ]; then exit 0; fi
> exec 1>&2
> echo "Changing revision properties other than svn:log by user other  
> than admin is prohibited"
> exit 1
>
> But it doesn't work :(

The file pre-revprop-change.tmpl created in the hooks directory of an  
empty repository contains this:

-----------------------------

#!/bin/sh

REPOS="$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

-----------------------------

This script worked for me. It allowed me to modify svn:log but didn't  
allow me to modify svn:date, for example.

You didn't provide your full script, but I tried this:

-----------------------------

#!/bin/sh

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

if [ "$ACTION" == "M" -a "$PROPNAME" == "svn:log" ]; then exit 0; fi
exec 1>&2
echo "Changing revision properties other than svn:log by user other  
than admin is prohibited"
exit 1

-----------------------------

This also worked for me. In what way didn't it work for you? Does it  
prevent the commit but not output anything? Does it allow the commit  
to go through? What happens?

Also what version of Subversion do you have and what OS are you  
running on? I'm on Mac OS X 10.4.11 Intel with Subversion 1.4.6.


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