【IT168 技术文章】
服务器端Subversion
Subversion是一个自由/开源版本控制系统,和VSS相比,它的特点有:
·采用复制-修改-合并模型
允许多人同时编辑一个文件,在提交的时候,有服务器进行合并,发生冲突的时候需要手工解决。
·目录结构纳入版本控制
支持目录结构的修改和文件改名等操作,并且这些操作都将进行版本管理。
·原子提交
一系列的改动,要么全部提交到版本库,要么一个也不提交,这样可以让用户构建一个所要提交修改的逻辑块,防止部分修改提交到版本库。
·可选的网络层
Subversion可以作为一个扩展模块与Apache结合,这给了Subversion在稳定性和交互性方面很大的好处,可以直接使用服务器的特性—认证、授权和传输压缩等等。也有一个轻型的,单独运行的Subversion服务,这个服务使用自己的协议可以轻松的用SSH封装。
·有效率的分支和标签
分支与标签的代价不与工程的大小成比例,Subversion建立分支与标签时只是拷贝整个工程,使用了一种类似于硬链接的机制,因而这类操作通常只会花费很少并且相对固定的时间。
·多种存储方式
Subversion可以采用数据库进行代码的存储,也可以使用文件存储。
·更有效的处理二进制文件
只记录变化的部分,使得Subversion处理二进制文件更加有效。
·……
资源
Subversion服务器端:http://subversion.tigris.org/files/documents/15/31465/svn-1.3.1-setup.exe
安装
执行安装包,不需要特别的修改,假设安装在“C:\Program Files\Subversion”
配置
1. 确认环境变量
安装会自动在系统环境变量的Path变量中加入“C:\Program Files\Subversion\bin”,如不存在请手工编辑。
2. 建立一个源代码仓库
在windows控制台中运行“svnadmin create d:\data\subversion”,这样就会在指定的目录中建立代码仓库。
3. 设置全局访问权限
进入代码仓库的conf文件夹(d:\data\subversion\conf),编辑其中的svnserve.conf文件
[general]
### These options control access to the repository for unauthenticated
### and authenticated users. Valid values are "write", "read",
### and "none". The sample settings below are the defaults.
# anon-access = read
# auth-access = write
### The password-db option controls the location of the password
### database file. Unless you specify a path starting with a /,
### the file's location is relative to the conf directory.
### Uncomment the line below to use the default password file.
# password-db = passwd
其中#起始的行表示注释,因此在修改anon-access和auth-access属性后要删除行首的#。一般来说设置为anon-access = none,auth-access = none,即未验证的用户不能进行读写,通过验证的用户可以读写。password-db = passwd把行首的#去掉,表示密码文件为passwd。
4. 添加用户
进入代码仓库的conf文件夹(d:\data\subversion\conf),编辑其中的passwd文件
### This file is an example password file for svnserve.
### Its format is similar to that of svnserve.conf. As shown in the
### example below it contains one section labelled [users].
### The name and password for each user follow, one account per line.
[users]
# harry = harryssecret
# sally = sallyssecret
[users]节下定义了用户,等号前是用户名,等号后面是密码,注意删除行首的#。