为什么我的提交后 Apache Subversion 钩子会失败?

为什么我的提交后 Apache Subversion 钩子会失败?

因此,我尝试在 Apache Subversion 服务器上运行提交后钩子,具体来说,我尝试按照所述向我的 Google 帐户发送电子邮件此链接

将脚本和工作副本的权限设置为同一个用户并赋予其读/写访问权限后,当用户尝试提交时,它会开始导致 MERGE 错误。

经过一番阅读,我发现这是因为提交后钩子不起作用,并发现通过输入

svn - ./post-commit commit  ../ 250 mailer.conf

我收到此错误:

> annerajb@annerajb-desktop:~/Desktop/TotEM_SVN/hooks$ env - ./post-commit.test commit ../ 250

/var/lib/python-support/python2.6/svn/fs.py:27: DeprecationWarning: The popen2 module is deprecated.  Use the subprocess module.

  import sys as _sys, os as _os, popen2 as _popen2, tempfile as _tempfile

Traceback (most recent call last):

  File "/usr/share/subversion/hook-scripts/mailer/mailer.py", line 1351, in <module>
    svn.core.run_app(main, cmd, config_fname, repos_dir, sys.argv[3:3+expected_args])

  File "/var/lib/python-support/python2.6/svn/core.py", line 288, in run_app
    return apply(func, (application_pool,) + args, kw)

  File "/usr/share/subversion/hook-scripts/mailer/mailer.py", line 80, in main
    revision = int(cmd_args[0])

ValueError: invalid literal for int() with base 10: ''

./post-commit.test: 5: ../: Permission denied

我不知道为什么如果我向 cmd_args[0] 传递一个值,它就会是空的。

#!/bin/sh
REPOS="$1"
REV="$2"
/usr/share/subversion/hook-scripts/mailer/mailer.py commit "$REPOS" \
        "$REV" /usr/share/subversion/hook-scripts/mailer/mailer.conf

答案1

不应为工作副本设置权限,而应为存储库访问设置权限。此外,运行 svn 服务器(或 httpd 服务器 - 取决于您的解决方案)的用户应设置脚本的执行权限。

从上面的错误来看,运行脚本的用户没有直接存储库访问权限,无法获取修订号。

相关内容