我知道这已经被问过很多次了,但我相信我的情况有所不同。
我正在尝试向我们的 SVN 存储库添加一个 pre-revprop-change 挂钩,以启用对日志消息的更改。
在我添加pre-revprop-change
文件之前,我收到了这个错误:
$ svn propset -r 557 --revprop svn:log "New message!" https://myserver/repos/myrepo
svn: DAV request failed; it's possible that the repository's pre-revprop-change hook either failed or is non-existent
svn: At least one property change failed; repository is unchanged
svn: Error setting property 'log':
Repository has not been enabled to accept revision propchanges;
ask the administrator to create a pre-revprop-change hook
没问题,我想。我会添加它:
$ cd /var/www/svn/myrepo/hooks
$ # Create the simplest hook possible
$ echo '#!/bin/sh' > pre-revprop-change
$ echo 'exit 0' >> pre-revprop-change
$ # Check that it looks correct
$ cat pre-revprop-change
#!/bin/sh
exit 0
$ # Looks good, now make it executable
$ chmod a+x pre-revprop-change
$ # Check the permissions
$ ls -al pre-revprop-change
-rwxr-xr-x 1 apache apache 17 2012-05-24 12:05 pre-revprop-change
$ # Run it, to make sure it runs, and check the error code
$ ./pre-revprop-change
$ echo $?
0
因此,根据我在 SO 上阅读的所有其他内容,这应该是我让它工作所需的全部内容。但是,当我再次尝试编辑日志消息时,我仍然得到一个错误(这次不同):
$ svn propset -r 557 --revprop svn:log "New message!" https://myserver/repos/myrepo
svn: DAV request failed; it's possible that the repository's pre-revprop-change hook either failed or is non-existent
svn: At least one property change failed; repository is unchanged
svn: Error setting property 'log':
Revprop change blocked by pre-revprop-change hook (exit code 255) with no output.
有几点需要注意:
1) 存储库托管在 SELinux 服务器(Fedora core 10)上。也许我需要对这些权限做些什么?以下是钩子的 SE 权限:
$ ls -alZ pre-revprop-change
-rwxr-xr-x apache apache unconfined_u:object_r:httpd_sys_content_rw_t:s0 pre-revprop-change
2) 正在通过 WebDAV 访问存储库(请注意https://
存储库名称中的 )。我需要在 WebDAV 端设置什么以允许 pre-revprop-change 更改吗?