標籤:
目的
找 到SVN Server中的倉庫(Repositories)檔案夾的位置,在相應的專案檔夾中找到hooks檔案夾。在該檔案夾中添加一個post- commit檔案;當有commit動作發生時(提交到SVN Server時)就會執行這個post-commit檔案,在該檔案實現資料的複製、
步驟
1.找到svn伺服器端某個項目倉庫目錄下(本例中服務端已建立一個test項目):
2.在hooks目錄下建立post-commit.bat 檔案,內容如下:
@echo off
SET REPOS=%1
SET REV=%2
SET DIR=%REPOS%/hooks
SET PATH=%PATH%;
SET WORKING_COPY=E:/myweb //此處是你的項目路徑
svn update %WORKING_COPY% --username tianyl --password 111111 //輸入svn使用者名稱密碼
3.web目錄下一定要用TortoiseSVN checkout出Repositories的代碼
4..還有一個注意問題——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
簡單操作 windown下在運行中輸入 services.msc 找到visual svn server 服務 右鍵屬性 登陸面板 設定案頭互動或者管理員權限再試
windows下svn鉤子實現每次提交更新至web目錄