svn禁止删除权限和日志长度限制的脚本书写
2017-06-01 15:33
417 查看
svn服务器分window版本和linux版本。
方法都是修改pre-commit脚本。
1、linux下脚本示例
REPOS="$1"
TXN="$2"
# Make sure that the log message contains some text.
SVNLOOK=/usr/bin/svnlook
if [ -z `$SVNLOOK log -t "$TXN" "$REPOS" |grep "[a-zA-Z0-9]"` ];then
echo "nLog message cann't be empty! you must input more than 5 chars as comment!." >&2
exit 1
fi
USER=`$SVNLOOK author -t $TXN $REPOS`
ADMINLIST=admin,helijie
if [ "`echo $ADMINLIST|grep -w $USER|wc -l`" -eq 0 ];then
if [ `$SVNLOOK changed -t $TXN $REPOS |grep "^D "|wc -l` -gt 0 ];then
echo "You Don't have the pemmision of delete!Please contact your administrator!" >&2
exit 1
fi
fi
exit 0
2、window下bat脚本示例
@echo off
setlocal
set REPOS=%1
set TXN=%2
rem check that logmessage contains at least 10 characters
rem .....代表5个字符
svnlook log "%REPOS%" -t "%TXN%" | findstr ".........." > nul
if %errorlevel% gtr 0 goto err
exit 0
:err
echo Empty log message not allowed. Commit aborted! 1>&2
exit 1
方法都是修改pre-commit脚本。
1、linux下脚本示例
REPOS="$1"
TXN="$2"
# Make sure that the log message contains some text.
SVNLOOK=/usr/bin/svnlook
if [ -z `$SVNLOOK log -t "$TXN" "$REPOS" |grep "[a-zA-Z0-9]"` ];then
echo "nLog message cann't be empty! you must input more than 5 chars as comment!." >&2
exit 1
fi
USER=`$SVNLOOK author -t $TXN $REPOS`
ADMINLIST=admin,helijie
if [ "`echo $ADMINLIST|grep -w $USER|wc -l`" -eq 0 ];then
if [ `$SVNLOOK changed -t $TXN $REPOS |grep "^D "|wc -l` -gt 0 ];then
echo "You Don't have the pemmision of delete!Please contact your administrator!" >&2
exit 1
fi
fi
exit 0
2、window下bat脚本示例
@echo off
setlocal
set REPOS=%1
set TXN=%2
rem check that logmessage contains at least 10 characters
rem .....代表5个字符
svnlook log "%REPOS%" -t "%TXN%" | findstr ".........." > nul
if %errorlevel% gtr 0 goto err
exit 0
:err
echo Empty log message not allowed. Commit aborted! 1>&2
exit 1
相关文章推荐
- svn提交日志长度限制脚本
- [转]windows下svn限制强制写日志及只能修改自己日志脚本
- SVN 提交限制日志长度
- windows下svn限制只能修改自己日志脚本
- windows下svn限制强制写日志及只能修改自己日志脚本
- SVN禁止删除和强制注释操作的钩子脚本 (Linux)
- [转]windows下svn限制强制写日志及只能修改自己日志脚本
- 经验分享之SVN禁止删除和强制注释操作的钩子脚本pre-commit
- Linux下svn只能修改自己日志脚本
- windows下svn只能修改自己日志脚本
- 如何拿回被恶意或者不小心删除硬盘所有者权限而导致的文件访问以及修改权限被限制(NTFS格式安全权限问题)
- Oracle 删除归档日志脚本
- 允许用户修改svn日志的钩子脚本
- SQL Server 2005(2000) 日志删除和日志文件限制(转)
- Oracle 删除归档日志脚本
- 删除SVN/CVS目录的bat脚本
- 编辑日志和删除日志都得有权限才能进行
- 查看硬件、删除日志脚本
- Windows下删除所有SVN目录的脚本
- 删除SVN/CVS目录的bat脚本