SVN客户端钩子脚本窗口

时间:2017-10-27 08:21:26

标签: windows svn hook pre-commit-hook

我在Windows上有bat脚本,这个脚本会检查一条空的日志消息, 这个代码钩子脚本(bat窗口):

@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ìnhenter image description here

我想知道,为什么它会警告空日志消息并有日志消息。 图片错误enter image description here

谢谢& BR!

1 个答案:

答案 0 :(得分:0)

我尝试时似乎工作正常。 尝试在o / p中回显%errorlevel%,即

echo%errorlevel%1>& 2

另外,检查是否可以在“repo”所在的位置实现此挂钩。 即内部\ hooks \ pre-commit.bat

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

之类的东西