我做了一点谷歌搜索,发现没有真正的Windows资源SVN挂钩.所以我想我会在这里开始一个wiki来集中它.
如果您贡献,请务必注明:
钩子的名字
脚本的功能
实际的脚本
注意:我怀疑发布一个史诗脚本将没有用.
预提交
阻止空评论的提交
资源:
"c:\Program Files\Subversion\bin\svnlook.exe" log -t %2 %1 | FindStr [a-zA-Z0-9] IF %ERRORLEVEL% EQU 0 GOTO OK echo "Commit Comments are Required" >&2 exit 1 :OK exit 0
的pre-revprop-change.bat
防止编辑除svn :: log之外的修订版属性
@ECHO OFF :: Set all parameters. Even though most are not used, in case you want to add :: changes that allow, for example, editing of the author or addition of log messages. set repository=%1 set revision=%2 set userName=%3 set propertyName=%4 set action=%5 :: Only allow the log message to be changed, but not author, etc. if /I not "%propertyName%" == "svn:log" goto ERROR_PROPNAME :: Only allow modification of a log message, not addition or deletion. if /I not "%action%" == "M" goto ERROR_ACTION :: Make sure that the new svn:log message is not empty. set bIsEmpty=true for /f "tokens=*" %%g in ('find /V ""') do ( set bIsEmpty=false ) if "%bIsEmpty%" == "true" goto ERROR_EMPTY goto :eof :ERROR_EMPTY echo Empty svn:log messages are not allowed. >&2 goto ERROR_EXIT :ERROR_PROPNAME echo Only changes to svn:log messages are allowed. >&2 goto ERROR_EXIT :ERROR_ACTION echo Only modifications to svn:log revision properties are allowed. >&2 goto ERROR_EXIT :ERROR_EXIT exit /b 1
*更新:这已不再适用,因为Twitter已弃用用户名/密码身份验证而支持OAuth.*
hook = post-commit的名称
脚本的作用=将修订,作者和提交消息发布到Twitter
将twitterUsername和twitterPassword替换为您的实际Twitter
这是针对VisualSVN进行测试的,我能让它工作的唯一方法是将所有内容转储到硬编码路径c:\ hook\post-commit中.您可以将其更改为VisualSVN具有读/写访问权限的任何路径.
需要安装Wget.安装程序可以在这里下载
欢迎评论和改进.这是我在Windows上的第一个SVN钩子,我的GAWD很痛苦.
echo status= > c:\hook\post-commit\msg.txt echo Rev#%2 by >> c:\hook\post-commit\msg.txt "%VISUALSVN_SERVER%\bin\svnlook.exe" author -r %2 %1 >> c:\hook\post-commit\msg.txt "%VISUALSVN_SERVER%\bin\svnlook.exe" log -r %2 %1 >> c:\hook\post-commit\msg.txt "c:\Program Files (x86)\GnuWin32\bin\wget.exe" --user=twitterUsername --password=twitterPassword --post-file=c:\hook\post-commit\msg.txt --append-output=c:\hook\post-commit\log.txt --output-document=c:\hook\post-commit\download.txt --delete-after http://twitter.com/statuses/update.xml