SVN 服务器镜像

来源:互联网 发布:xbox one 知乎 编辑:程序博客网 时间:2024/06/11 10:00

已经试用过svnsync工具,非常强大,简单的讲就是一个SVN的拷贝,关于遇到的问题做一个整理。

 

windows版本:

1.把要同步的SVN(目的SVN)的Repository下的pre-revprop-change.tmpl改为pre-revprop-change.bat

目的是为了保护目的服务器的提交用户只能使SVNMaster。

内容如下:

 

Windows bat file:

  1. IF "%3" == "SVNMaster" (goto :label1) else (echo "Only the SVNMaster user can change revision properties" >2 ) 
  2. exit 1 
  3. goto :eof 
  4. :label1 
  5. exit 0 

Linux sh file(别忘了分配执行权限):

 

 

  1. REPOS="$1"
  2. REV="$2"
  3. USER="$3"
  4. PROPNAME="$4"
  5. ACTION="$5"
  6. if [ "$USER" = "SVNMaster" ]; then exit 0; fi
  7. echo "Only the SVNMaster user can change revision properties." >&2
  8. exit 1

2. 把要同步的SVN的Repository下的start-commit.tmpl改为start-commit.bat,只允许SVNMaster可以提交。
Windows bat file:

  1. IF "%2" == "SVNMaster" (goto :label1) else (echo "Only the SVNMaster user can commit new revisions" >2 ) 
  2. exit 1 
  3. goto :eof 
  4. :label1 
  5. exit 0 

Linux sh file(别忘了分配执行权限):

 

 

  1. REPOS="$1"
  2. USER="$2"
  3. if [ "$USER" = "SVNMaster" ]; then exit 0; fi
  4. echo "Only the SVNMaster user can change revision properties." >&2
  5. 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