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

Aw: a custom error message

From: Andreas Stieger <Andreas.Stieger_at_gmx.de>
Date: Tue, 12 Aug 2014 12:38:52 +0200

Hi,

> I don't suppose this would be possible without hacking the
> code, right?
> Reason I'm asking is simplicity and clearness in the message.
> eg. is when an attempt to lock fails for file is already
> locked by other user
> why bother users with the path to file on a remote resource?
> they usually only get confuse reading too many details
>
> there is probably more cases where it would be great to have
> some ways to configure these error messages

Write a pre-lock hook...
http://svnbook.red-bean.com/nightly/en/svn.ref.reposhooks.pre-lock.html

You will see that the default pre-lock.tmpl created with new repositories will actually do exactly what you want. Shortened...

#!/bin/sh
REPOS="$1"
PATH="$2"
USER="$3"

LOCK_OWNER=`svnlook lock "$REPOS" "$PATH" | \
            grep '^Owner: ' | sed 's/Owner: //'`
if [ "$LOCK_OWNER" = "" ]; then
  exit 0
fi
if [ "$LOCK_OWNER" = "$USER" ]; then
  exit 0
fi
echo "Error: $PATH already locked by ${LOCK_OWNER}." 1>&2
exit 1
Received on 2014-08-12 12:39:27 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.