centos svn 一些配置
阿新 • • 發佈:2018-11-11
新增提交時必須寫註釋功能
1.進入相應工程的hooks目錄下,例如我的倉庫名是game,那我的目錄就是/svnrepository/MicroGame/hooks,在這個下面找到pre-commit.tmpl檔案,拷貝一份到當前目錄,並去掉tmpl字尾,並設定其可執行許可權chmod +x pre-commit
2.在pre-commit內新增指令碼,其餘指令碼都註釋掉
#svn呼叫指令碼時傳入的兩個引數,REPOS倉庫路徑和TXN本次事務的事務號,REPOS為倉庫根路徑,不包含子目錄 REPOS="$1" TXN="$2" # Make sure that the log message contains some text. SVNLOOK=/usr/bin/svnlook LOGMSG=`$SVNLOOK log -t "$TXN" "$REPOS" | grep "[a-zA-Z0-9]" | wc -c` if [ "$LOGMSG" -lt 5 ] then echo -e "\n請填寫日誌,最少為5個字元!" 1>&2 exit 1 else exit 0 fi
3.第二步為倉庫所有目錄都添加註釋,如果要在指定目錄添加註釋,則需要使用svnlook dirs-changed:列印修改過的目錄命令
REPOS="$1" TXN="$2" SPATH="test/doc" # Make sure that the log message contains some text. SVNLOOK=/usr/bin/svnlook LOGMSG=`$SVNLOOK log -t "$TXN" "$REPOS" | grep "[a-zA-Z0-9]" | wc -c` #此處指定為在已修改過的目錄中匹配是否包含SPATH目錄 FOUND=$($SVNLOOK dirs-changed "$REPOS" -t "$TXN" | grep -E "^$SPATH") if [ "$LOGMSG" -lt 5 ] && [ "$FOUND" != "" ] then echo -e "\n請填寫日誌,最少為5個字元!" 1>&2 exit 1 else exit 0 fi
新建專案功能
到svn根目錄下執行命令
mkdir -p /svnrepository/project1
svnadmin create /svnrepository/project1
修改許可權
在project1/conf/svnserve.conf中新增如下配置
[general]
anon-access = read
auth-access = write
password-db = /svnrepository/conf/passwd
authz-db = /svnrepository/conf/authz
realm = project1
在/svnrepository/conf/auzh中新增如下配置
[project1:/]
* = rw