mik*_*iku 59
你可以使用一个钩子(把它放入<repository>/hooks并命名pre-commit.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 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
exit 1
Run Code Online (Sandbox Code Playgroud)
src:http://www.anujgakhar.com/2008/02/14/how-to-force-comments-on-svn-commit/
pal*_*int 20
这是一个预提交钩子,其中包含@ miku的Linux详细错误消息:
#!/bin/sh
REPOS="$1"
TXN="$2"
SVNLOOK=/usr/bin/svnlook
$SVNLOOK log -t "$TXN" "$REPOS" | \
grep "[a-zA-Z0-9]" > /dev/null
GREP_STATUS=$?
if [ $GREP_STATUS -ne 0 ]
then
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
exit 1
fi
exit 0
Run Code Online (Sandbox Code Playgroud)
Eli*_*kan 18
实际上,当您创建Subversion存储库时,其hooks子目录已包含钩子样本.查看pre-commit.tmpl有关钩子参数的详细信息.它还包含您正在寻找的钩子的示例:
#!/bin/sh
REPOS="$1"
TXN="$2"
# Make sure that the log message contains some text.
SVNLOOK=/usr/local/bin/svnlook
$SVNLOOK log -t "$TXN" "$REPOS" | \
grep "[a-zA-Z0-9]" > /dev/null || exit 1
Run Code Online (Sandbox Code Playgroud)
你可以用任何脚本或语言编写钩子,只要它在Subversion机器上是可执行的.
Linux脚本超过15个字符 -
#!/bin/bash
REPOS="$1"
TXN="$2"
# Make sure that the log message contains some text.
SVNLOOK=/usr/bin/svnlook
# Comments should have more than 5 characters
LOGMSG=$($SVNLOOK log -t "$TXN" "$REPOS" | grep [a-zA-Z0-9] | wc -c)
if [ "$LOGMSG" -lt 15 ];
then
echo -e "Please provide a meaningful comment when committing changes." 1>&2
exit 1
fi
Run Code Online (Sandbox Code Playgroud)
来源http://java.dzone.com/articles/useful-subversion-pre-commit
小智 6
如果您只使用TortoiseSVN,那么您可以将TortoiseSVN的属性添加到根目录:属性名称:tsvn:logminsize
值:1
这将禁用TortoiseSVN提交窗口中的OK按钮,然后消息为空.请注意,此属性是TortoiseSVN特定,它可能无法与其他SVN客户端一起使用.
| 归档时间: |
|
| 查看次数: |
36467 次 |
| 最近记录: |