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

Re: strange reaction from post-commit hook

From: Ryan Schmidt <subversion-2009b_at_ryandesign.com>
Date: Thu, 4 Jun 2009 17:01:08 -0500

On Jun 4, 2009, at 01:08, J. Bakshi wrote:

>>> It repeated again and again even after " svn cleanup". I also
>>> tried " chmod -R 777 .svn" once more but the same error.
>>
>> Please confirm: even after running "svn cleanup", running "svn
>> update" tells you the working copy is locked? Is this only when
>> running "svn update" from the hook script or also when running "svn
>> update" from the command line?
>
> "svn up" from command line is working well
>
> `````````````````````````````````````````````````
> [root_at_192 POSTCOMMIT]# vim newfile
> [root_at_192 POSTCOMMIT]# svn commit -m "check 24" newfile
> Sending newfile
> Transmitting file data .
> Committed revision 24.
>
> Warning: 'post-commit' hook failed with error output:
> svn: Working copy '/var/www/html/POSTCOMMIT' locked
> svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for
> details)
>
> [root_at_192 POSTCOMMIT]# svn cleanup
> [root_at_192 POSTCOMMIT]# svn up newfile
> At revision 24.

Wait. You are committing from within the POSTCOMMIT directory! So of
course the working copy will be locked -- a commit is currently in
progress in it.

You should not be committing from the POSTCOMMIT directory. That
working copy should only be manipulated by the post-commit hook, and
not by you.

Get a different working copy, somewhere else, and commit in it. Your
post-commit hook should be working fine.

>> Note also that hook scripts run in an empty environment. When you
>> manually execute the hook script, it inherits the environment (PATH,
>> etc.) from your shell and is thus not necessarily a good test. You
>> can get closer by running the hook script through the env command to
>> clear the environment:
>>
>> env -i ./post-commit /path/to/repo $REV
>
> Ok, I have done it
>
> ````````````````````````````
> env -i ./post-commit https://192.168.1.1:/repos/test
> svn post commit called
> At revision 24.
> ~~~~~~~~~~~~~~~~~

It's not really relevant here, since your post-commit hook doesn't
use any of the parameters given to it, but note that the first
parameter to the post-commit script is the path to the repository on
disk, not its URL; and the second parameter is the revision that was
just committed.

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2359544

To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_subversion.tigris.org].
Received on 2009-06-05 00:02:09 CEST

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