[z]windows下Svn伺服器之必須提交修改注釋篇

來源:互聯網
上載者:User
1. 強制添加註釋資訊

找到Respositories目錄下對應項目裡的hooks目錄下建立pre-commit.bat檔案,複製如下內容:

 

@echo offset SVNLOOK="C:\Program Files\VisualSVN\bin\svnlook.exe"setlocalset REPOS=%1set TXN=%2rem check that logmessage contains at least 10 characters%SVNLOOK% log "%REPOS%" -t "%TXN%" | findstr ".........." > nulif %errorlevel% gtr 0 goto errexit 0:errecho Empty log message not allowed. Commit aborted! 1>&2exit 1

 

 

 

2. 允許使用者修改注釋資訊

找到Respositories目錄下對應項目裡的hooks目錄下建立pre-revpos-change.bat,複製如下內容:

@ECHO OFF
set repos=%1
set rev=%2
set user=%3
set propname=%4
set action=%5
 
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Only allow changes to svn:log. The author, date and other revision
:: properties cannot be changed
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
if /I not '%propname%'=='svn:log' goto ERROR_PROPNAME
 
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Only allow modifications to svn:log (no addition/overwrite or deletion)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
if /I not '%action%'=='M' goto ERROR_ACTION
 
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Make sure that the new svn:log message contains some text.
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
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 properties are not allowed. >&2
goto ERROR_EXIT
 
:ERROR_PROPNAME
echo Only changes to svn:log revision properties 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

 

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.