You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Lars Klonowski <La...@software-friends.de> on 2012/02/23 10:42:40 UTC

How to recognize commit failure via hooks

Hello guys,

We are running a web application with subversion and database access.
The normal workflow is to make changes on the web surface,
which will then trigger further changes in subversion and the database.
This way we can easily assure consistency between these two systems.

Now, we are requested to also carry subversion changes to the database.
A pre-commit hook will assure that these changes are database conform.
It will also determine which changes should be made in the database.
These will be triggered in the post-commit hook,
to be sure the subversion commit was successful.


But here the problems start:

The post-commit hook gets a revision parameter and I don't see a
possibility how to determine which transaction it came from.
(This is necessary, as we have to apply the right database changes
determined in the pre-commit hook.)

So we decide to use internal locks for specific elements.
The pre-commit hook determines the elements to be updated, locks them,
checks database confirmity and maps the database changes.
The post-commit hook determines the elements to be updated,
performs the mapped database operations and releases the locks.

But if the commit fails, the elements stay locked.
The application now has to decide if it is just a lengthy commit
or if it failed and the locks have to be released.


So is there any possibility to notify the application about the
commit failure via hooks?
Or has anyone ever dealt with triggering database changes based on
subversion commits and has found a solution for it?


Best regards,
Lars Klonowski

Re: How to recognize commit failure via hooks

Posted by Daniel Shahaf <da...@elego.de>.
Lars Klonowski wrote on Thu, Feb 23, 2012 at 10:42:40 +0100:
> The post-commit hook gets a revision parameter and I don't see a
> possibility how to determine which transaction it came from.

This has been implemented for 1.8.0:

http://subversion.apache.org/docs/release-notes/1.8#hooks-post-commit