SVN 客户端挂钩脚本 windows

SVN Client hook script windows

我在 windows 上安装了 bat 脚本,该脚本将检查空日志消息, 这段代码钩子脚本(bat windows):

@echo off
::
:: Stops commits that have empty log messages.
::

setlocal

rem Subversion sends through the path to the repository and transaction id
set REPOS=%1
set TXN=%2

rem check for an empty log message
svnlook log %REPOS% -t %TXN% | findstr . > nul
if %errorlevel% gtr 0 (goto err) else exit 0

:err
echo. 1>&2
echo ----ERROR_EN----
echo Your commit has been blocked because you didn't give any log message 1>&2
echo Please write a log message describing the purpose of your changes and 1>&2
echo then try committing again. -- Thank you! 1>&2
echo ----END ERROR_EN----
exit 1

我设置了钩子脚本 như hình enter image description here

我想知道,为什么它同时提示空日志消息和有日志消息。 图片错误enter image description here

谢谢&br!

我试过的时候好像没问题。 尝试在 o/p 中回显 %errorlevel% 即

echo %errorlevel% 1>&2

此外,请检查此挂钩是否可以在 "repo" 所在的位置实现。 即里面 \hooks\pre-commit.bat

另一种可能是svnlook命令失败。检查 svnlook 命令是否带有绝对路径。像 "E:\SVN\bin\svnlook.exe"