已经试用过svnsync工具,非常强大,简单的讲就是一个SVN的拷贝,关于遇到的问题做一个整理。
windows版本:
1.把要同步的SVN(目的SVN)的Repository下的pre-revprop-change.tmpl改为pre-revprop-change.bat
目的是为了保护目的服务器的提交用户只能使SVNMaster。
内容如下:
Windows bat file:
- IF "%3" == "SVNMaster" (goto :label1) else (echo "Only the SVNMaster user can change revision properties" >2 )
- exit 1
- goto :eof
- :label1
- exit 0
Linux sh file(别忘了分配执行权限):
- REPOS="$1"
- REV="$2"
- USER="$3"
- PROPNAME="$4"
- ACTION="$5"
- if [ "$USER" = "SVNMaster" ]; then exit 0; fi
- echo "Only the SVNMaster user can change revision properties." >&2
- exit 1
2. 把要同步的SVN的Repository下的start-commit.tmpl改为start-commit.bat,只允许SVNMaster可以提交。
Windows bat file:
- IF "%2" == "SVNMaster" (goto :label1) else (echo "Only the SVNMaster user can commit new revisions" >2 )
- exit 1
- goto :eof
- :label1
- exit 0
Linux sh file(别忘了分配执行权限):
- REPOS="$1"
- USER="$2"
- if [ "$USER" = "SVNMaster" ]; then exit 0; fi
- echo "Only the SVNMaster user can change revision properties." >&2
- exit 1
3.
重启目标SVN服务器
4.
到目标SVN服务器下运行 svnsync initialize http://dist-svn-host/svn/test http://192.168.0.1:80/svn/java --username xxx --password xxx
5.
svnsync sync http://dist-svn-host/svn/test --username xxx --password xxx
本文介绍了如何使用svnsync工具在Windows环境下创建SVN服务器镜像,详细阐述了预提交属性变更和开始提交的设置,以确保只有SVNMaster用户能进行操作。通过修改pre-revprop-change和start-commit脚本,以及执行初始化和同步命令,实现SVN服务器的镜像保护。

186

被折叠的 条评论
为什么被折叠?



