需求一,svn提交時必須填寫log日誌的需求,如何進行配置呢?請看下面。web
須要在版本庫目錄下找到hooks文件夾,個人版本庫是dxoffice,因此是這個目錄,你要找本身的目錄sql
而後進入,建立一個pre-commit.bat文件,提交以前要作的一個hooks文件,編輯,將如下內容拷貝到文件中並進行保存。服務器
@echo off :: :: Stops commits that have empty log messages. :: @echo off set svnlook="D:/Program Files/VisualSVN Server/bin/svnlook.exe" //此處是你的svnanzhu 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
若是您有最少提交多少字的需求,只需在%svnlook% log %REPOS% -t %TXN% | findstr . > nul這行代碼中找到findstr .在這裏有一個 點表示最少輸入1個字符,若是是10個點表明最少輸入10個字符,以此類推。保存以後,不用重啓服務器就能夠進行嘗試svn
需求二:提交svn後,須要同步web目錄post
方法同上面差很少,建立post-commit.bat文件,而後將下面代碼拷貝到裏面spa
@echo off SET REPOS=%1 SET REV=%2 SET DIR=%REPOS%/hooks SET PATH=%PATH%; SET WORKING_COPY=E:/svn_test //此處是你的項目路徑,此路徑必須是一個svn的路徑,這意味着你已經checkout出了源碼 svn update %WORKING_COPY% --username name --password password //輸入svn用戶名密碼
還有一個注意問題——Visual SVN Server的權限,不然可能會出現下列錯誤:
post-commit hook failed (exit code 1) with output:
svn: E155004: Working copy 'D:\www\Test' locked
svn: E200031: sqlite: attempt to write a readonly database
svn: E200031: sqlite: attempt to write a readonly database
svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for details)
緣由是Visual SVN Server服務的執行權限不夠,不能對指定目錄作讀寫操做。解決辦法,修改Visual SVN Server
簡單操做 win+R 運行 services.msc 找到visual svn server 服務 右鍵屬性 先中止服務以後,再設置登錄,設置桌面交互或者管理員權限.net
注:http://blog.csdn.net/ght521/article/details/52355778日誌