How to create a subversion server hook script that prevents people from committing changes if they don't own the lock on the file first?
Svn server is on windows.
Thanks.
P.S. Additional info in this question
How to create a subversion server hook script that prevents people from committing changes if they don't own the lock on the file first?
Svn server is on windows.
Thanks.
P.S. Additional info in this question
You can use
<your repos directory>/hooks/pre-commit
and use some batch scripting (or even a full blown program, as long as it's executable it will be fine). If it returns 0 the commit will be successful; otherwise it will fail.See
post-lock.tmpl
in that same directory for an example.Use a pre-commit hook. Pre-commit hook receives 2 arguments:
You need to use
svnlook
to determine if there are svn:needs-lock files that aren't locked.To determine the paths changed by this commit:
Loop through the files (
$PATH
as loop item) in 'changed' and determine svn:needs-lock, and if they're currently locked:Write an to stderr and return non-zero to abort this commit when needed.