svn 同步鏡像:svnsync
源:http://192.168.1.100/svn/hunt/
目標(biāo):file:///data/hunt/svn_backup/Project01/
方法:
目標(biāo)端:
1、創(chuàng)建項(xiàng)目:
svnadmin create /data/hunt/svn_backup/Project01/
2、改pre-revprop_change
進(jìn)入到hooks目錄,
cp pre-revprop-change.tmpl pre-revprop-change
chmod 755 pre-revprop-change
echo "exit 0" >pre-revprop-change
3、初始化
復(fù)制相應(yīng)的conf文件到對(duì)應(yīng)的目錄下,如user.conf、authz等
svnsync init file:///data/hunt/svn_backup/Project01/ http://192.168.1.100/svn/hunt/
語法:svnsync init 目標(biāo)端svn目錄 源端svn目錄
同步過程會(huì)要求輸入root密碼,隨便輸入,然后是svn用戶/密碼,正常會(huì)顯示如下內(nèi)容:
Copied properties for revision 0.
4、執(zhí)行同步
svnsync sync file:///data/hunt/svn_backup/Project01/ --username admin --password admin
過程會(huì)顯示如下內(nèi)容:
Transmitting file data .
Committed revision 1.
Copied properties for revision 1.
Transmitting file data .
Committed revision 2.
Copied properties for revision 2.
Transmitting file data .
Committed revision 3.
Copied properties for revision 3.
...
源端:
1、修改post-commit:
cp post-commit.tmpl post-commit
chmod 755 pre-revprop-change
把 post-commit 中,最后兩行替換為
svnsync sync --non-interactive file:///data/hunt/svn_backup/Project01/ --username admin --password admin
注意:
svnsync過程可能因網(wǎng)絡(luò)問題導(dǎo)致同步失敗,報(bào)以下錯(cuò)誤:
Failed to get lock on destination repos...
此時(shí)可能被加鎖了,更改鎖:
svn propdel svn:sync-lock --revprop -r 0 file:///data/hunt/svn_backup/Project01/(目的同步庫)