我在一台惠灵服务器上运行带有Apache 2.2.22的svn 1.8.10。我已经安装了phpcs-svn-pre-commit,它正在通过pre-commit钩子工作。除了预提交挂钩的输出之外,所有操作都正常。当钩子通过检查时,提交更改。当钩子失败时,没有提交更改,但我明白了:
$ svn -F svn-commit.tmp commit Mailer.php
Sending Mailer.php
Transmitting file data .svn: E165001: Commit failed (details follow):
svn: E165001: A repository hook failed
错误不会返回到subversion客户端,而是记录在apache日志文件中。有没有人知道在哪里查找为什么stderror会进入apache error.log而不是通过客户端返回?
存储库位于远程服务器上,而不是本地服务器上。
== apache error.log ==
[Fri Mar 27 13:18:05 2015] [error] [client 66.79.106.82] Could not MERGE resource "/claven/svn/!svn/act/a76ca493-7302-48b3-8cff-39b0abb2bc08" into "/claven/svn/trunk/system/classes/Claven". [409, #0]
[Fri Mar 27 13:18:05 2015] [error] [client 66.79.106.82] Commit blocked by pre-commit hook (exit code 1) with output:\nExamining trunk/system/classes/Claven/Mailer.php for PHP Syntax\n\n\x1b[1mFILE: trunk/system/classes/Claven/Mailer.php\x1b[0m\n----------------------------------------------------------------------\n\x1b[1mFOUND 1 ERROR AFFECTING 1 LINE\x1b[0m\n----------------------------------------------------------------------\n 49 | \x1b[31mERROR\x1b[0m | Parameter comment must end with a full stop\n----------------------------------------------------------------------\n\nTime: 134ms; Memory: 4.75Mb\n\n [409, #165001]
== pre-commit hook ==
REPOS="$1"
TXN="$2"
PSPC=/usr/bin/scripts/phpcs-svn-pre-commit
SVNLOOK=/usr/bin/svnlook
$SVNLOOK log -t "$TXN" "$REPOS" | \
grep "[a-zA-Z0-9]" > /dev/null || exit 1
CHANGED=`$SVNLOOK changed -t "$TXN" "$REPOS" | grep "^[U|A]" | awk '{print $2}' | grep \\.php$`
for FILE in $CHANGED
do
echo "Examining $FILE for PHP Syntax" >&2
if [ $? -ne 0 ]
then
echo 1>&2
echo "***********************************" 1>&2
echo "PHP error in: $FILE:" 1>&2
echo `echo "$MESSAGE" | sed "s| -| $FILE|g"` 1>&2
echo "***********************************" 1>&2
exit 1
fi
done
"$PSPC" --extensions=php --standard=Claven --tab-width=4 -n "$REPOS" -t "$TXN" >&2 || exit 1
set -e
"$REPOS"/hooks/commit-access-control.pl "$REPOS" $TXN "$REPOS"/hooks/commit-access-control.cfg
exit 0
答案 0 :(得分:0)
在我的ruleset.xml中,我添加了一个参数名称,用于将命令行变量硬编码到我的自定义标准中。一旦我删除它,我收到了phpcs的预期输出。
我不确定它是错误的标识符还是错误的值,但删除它修复了问题。
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>