[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 assistance

From: Branko Čibej <brane_at_apache.org>
Date: Fri, 30 Aug 2019 15:15:13 +0200

On 30.08.2019 15:01, William Muriithi wrote:
> Morning, 
> I am attempting to write a pre-commit hook that enforces a policy to
> some group and warns the rest of the team. The hook is in python and
> it just check that jira ticket exist on the commit log.
> The problem I am facing is I am not able to both warn and error for
> some reason. If I exit, the failure reason is displayed to the user.
> If I don't exit, but attempts to send a warning to the client, 
> nothing show up even in the logs.
> I am using sys.stderr.write and sys.stdout.write for error and warning
> respectively. Is it technically possible to do this? Would be grateful
> for your help on this.

This is clearly documented in the pre-commit hook template:

# If the hook program exits with success, the txn is committed; but
# if it exits with failure (non-zero), the txn is aborted, no commit
# takes place, and STDERR is returned to the client.

So, no, you can't send "warnings" by writing to stdout, and stderr is
only piped to the client if the hook fails.

For warnings, you'll have to use some other channel.

-- Brane
Received on 2019-08-30 15:15:17 CEST

This is an archived mail posted to the Subversion Users mailing list.