设置svnperms预提交钩子

时间:2009-05-27 16:34:16

标签: python svn unix pre-commit

我正在尝试将svnperms实现到存储库中,但是我遇到了一些困难:

预提交具有执行权限:

-rwxrwxr-x   1 svnadm     svn           3018 May 27 10:11 pre-commit

这是我在预提交中对svnperms的调用:

# Check that the author of this commit has the rights to perform
# the commit on the files and directories being modified.
SVNPERMS=/usr/local/svn/scripts/svnperms.py
$SVNPERMS -r $REPOS -t $TXN || exit 1

我在指定的位置安装了svnperms.py:

# ls -l /usr/local/svn/scripts
total 24
-rwxrwxr-x   1 svnadm     svn          11840 May 25 07:48 svnperms.py

svnperms.py是UNIX格式 - 没有^ M行结尾。

TortoiseSVN回复:

Command: Commit  
Modified: C:\projects\Sandbox\Trunk\Test.txt  
Sending content: C:\projects\Sandbox\Trunk\Test.txt  
Error: Commit failed (details follow):  
Error: 'pre-commit' hook failed with error output:  
Error: No such file or directory: python  

调用没有参数的svnperms显示:

/usr/local/svn/scripts/svnperms.py
missing required option(s): repository, either transaction or a revision
Usage: svnperms.py OPTIONS

Options:
    -r PATH    Use repository at PATH to check transactions
    -t TXN     Query transaction TXN for commit information
    -f PATH    Use PATH as configuration file (default is repository
               path + /conf/svnperms.conf)
    -s NAME    Use section NAME as permission section (default is
               repository name, extracted from repository path)
    -R REV     Query revision REV for commit information (for tests)
    -A AUTHOR  Check commit as if AUTHOR had commited it (for tests)
    -h         Show this message

UNIX管理员最近安装了python,但不确定是否存在所有依赖项。如果这是问题,我不知道如何确定,因为python似乎是基于上面的输出工作。

我错过了什么?

1 个答案:

答案 0 :(得分:6)

我的猜测是python二进制文件的位置不在$PATH的svn服务器中。 svnperms.py的shabang行写道:

#!/usr/bin/env python

但是假设可执行文件位于调用者的$PATH。如果您没有权限修改subversion服务器的运行时环境,请尝试以交互方式运行时使用python给出的路径替换shabang行中的which python