我想阻止我的 SVN 存储库的用户检查对某些文件的更改。我通过使用以下预提交钩子脚本完成了这项工作。然而,受限文件的数量正在增长,提交更改变得非常缓慢。我想知道是否有更有效的编码方式,我玩过变更列表,但我无法做到这一点。
提前致谢
预提交挂钩脚本(基于 Windows 的 SVN 存储库):
setlocal
:: Inputs from Subversion
set REPOS=%1%
set TXN=%2%
:: Checks if one of the reference files
Rem Check if the commit contains reference files
svnlook changed %REPOS% -t %TXN% | findstr /r /i "^.*referenceparts/part1.txt" > nul
if %errorlevel%==0 (goto RefPart)
svnlook changed %REPOS% -t %TXN% | findstr /r /i "^.*referenceparts/part2.txt" > nul
if %errorlevel%==0 (goto RefPart)
......
.....
etc etc
exit 0
:: Blocks the commit if part are reference
: RefPart
echo. 1>&2
echo ---------------------------------------------------------------------- 1>&2
echo Your commit has been cancelled because you are trying to change a 1>&2
echo part for a reference turbine! Please make a copy of this part and 1>&2
echo save it under a different name. 1>&2
echo ---------------------------------------------------------------------- 1>&2
echo. 1>&2
exit 1