centos6.4安装svn yum -y install mod_dav_svn httpd # 注:可去这里下载安装脚本 http://www.wandisco.com/subversion/download # mod_dav_san模块就是作为Subversion与Apache之间的接口,通过它,Apache就可以访问版本库,并且可以让客户端也使用HTTP的扩展协议WebDAV/DeltaV进行访问。 # 创建一个工程 svnadmin create /workspace/game1 # 添加game1工程的访问路径 vim /etc/httpd/conf.d/subversion.conf <VirtualHost *:80> KeepAlive On ServerName svn.game.com <Location /game1> DAV svn SVNPath "/workspace/game1_repos" AuthType Basic AuthName "项目 仓库" Require valid-user AuthUserFile "/workspace/passwd" AuthzSVNAccessFile "/workspace/game1_repos/authz" Order deny,allow Allow from all SVNAutoversioning On </Location> </VirtualHost> # 定义日志的格式 cat /workspace/game1_repos/hooks/pre-commit #!/usr/bin/python #coding=utf-8 import sys, os, string #os.environ['LANG']="zh_CN.utf8" SVNLOOK='"/usr/bin/svnlook"' LOG_LEN=10 if len(sys.argv) < 3: sys.stderr.write("system error!\n") sys.exit(1) pass Repos=sys.argv[1] Txn=sys.argv[2] # 判断日志长度 log_str_arr=os.popen('%s log -t %s %s' % (SVNLOOK, Txn, Repos)).readlines() if len(log_str_arr[0]) < LOG_LEN: sys.stderr.write("write log and word num >10.(%s)\n"%len(log_str_arr[0])) sys.exit(1) pass sys.exit(0) # 添加可执行权限 chmod +x /workspace/game1_repos/hooks/pre-commit # 重启apache service httpd restart # 添加用户 cd /workspace/ htpasswd passwd 用户1 cat /workspace/game1_repos/authz [groups] client=用户1,用户2 server=用户3,用户4 planner=用户5,用户6 [/] *= autosvn=rw [game1:/] *= autosvn=rw # 策划 [game1:/trunk/plan] @planner=rw 用户1=r # 客户端 [game1:/trunk/client] @client=rw # 服务端 [game1:/trunk/server] @server=rw (责任编辑:IT) |