源:http://192.168.1.100/svn/hunt/
目标:file:///data/hunt/svn_backup/Project01/
方法:
目标端:
1、创建项目:
svnadmin create /data/hunt/svn_backup/Project01/
2、改pre-revprop_change
进入到hooks目录,
cp pre-revprop-change.tmpl pre-revprop-change
chmod 755 pre-revprop-change
echo "exit 0" >pre-revprop-change
3、初始化
复制相应的conf文件到对应的目录下,如user.conf、authz等
svnsync init file:///data/hunt/svn_backup/Project01/ http://192.168.1.100/svn/hunt/
语法:svnsync init 目标端svn目录 源端svn目录
同步过程会要求输入root密码,随便输入,然后是svn用户/密码,正常会显示如下内容:
Copied properties for revision 0.
4、执行同步
svnsync sync file:///data/hunt/svn_backup/Project01/ --username admin --password admin
过程会显示如下内容:
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过程可能因网络问题导致同步失败,报以下错误:
Failed to get lock on destination repos...
此时可能被加锁了,更改锁:
svn propdel svn:sync-lock --revprop -r 0 file:///data/hunt/svn_backup/Project01/(目的同步库)
本文名称:svn同步镜像:svnsync
当前地址:
http://dzwzjz.com/article/jceicg.html