reference: http://www.duduwolf.com/post/setting_up_subversion.asp

http://www.subversion.org.cn/svnbook/nightly/svn.basic.in-action.html

 

version: Setup-Subversion-1.6.6.msi

 

创建repository

svnadmin create d:\svnReps

其中d:\svnReps是repository的储存位置。

repository创建完毕后会在目录下生成若干个文件和文件夹,dav目录是提供给Apache与mod_dav_svn使用的目录,让它们存储内部数据;db目录就是所有版本控制的数据文件;hooks目录放置hook脚本文件的目录;locks用来放置Subversion文件库锁定数据的目录,用来追踪存取文件库的客户端;format文件是一个文本文件,里面只放了一个整数,表示当前文件库配置的版本号;

 

简单的权限配置

打开/conf/目录,打开svnserve.conf找到一下两句:

# [general]
# password-db = passwd

去之每行开头的#,其中第二行是指定身份验证的文件名,即passwd文件
同样打开passwd文件,将

# [users]
# harry = harryssecret
# sally = sallyssecret

这是设置用户,一行一个,存储格式为“用户名 = 密码”,如可插入一行:admin = admin888,即为系统添加一个用户名为admin,密码为admin888的用户

 

运行SVN服务

方式一,run svnserve as daemon:

svnserve –d -r d:\svnReps

使用-r可以有效地改变文件系统的根位置,客户端可以使用去掉前半部分的路径,留下的要短一些的(更加有提示性)URL:

比如:$ svn checkout svn://host.example.com/project1

方式二:run svnserver as a service:

1.使用svnserve通过inetd(for *nix)

2.Run svnserve as a Microsoft Windows service.

C:\> sc create svn
binpath= "\"C:\Program Files\Subversion\bin\svnserve.exe\" --service -r d:\svnReps"
displayname= "Subversion Server"
depend= Tcpip
start= auto
这段命令注册了一个service,会自动启动subversion svnserver
Be careful about spaces in your commandline to be invoked. If a directory name contains spaces (or other characters that need escaping),
place the entire inner value of binpath in double-quotes, by escaping them。
 
然后启动服务:
C:\> net start svn
可以通过删除其定义删除服务:sc delete svn,只需要确定首先停止服务

 

权限配置

svnserve.conf有两个或多个参数需要设置:它们确定未认证(匿名)和认证用户可以做的事情,参数anon-accessauth-access可以设置为noneread或者write,设置为none会限制所有方式的访问,read允许只读访问,而write允许对版本库完全的读/写权限

简单配置的信息如下:

anon-access = none
auth-access = write

password-db = passwd

realm = my first responsity

 

到此,svn 已经可以很好的工作了,下面的内容主要是与eclipse相关的。 访问svn可以使用svn://hostname

 

 

 

 

 

附录:

理解Subversion的混合修订版本机制

作为一个普遍原理,Subversion努力做到尽可能的灵活,一个特殊的灵活特性就是让工作拷贝包含不同工作修订版本的文件和目录,不幸的是,这个灵活性会让许多新用户感到迷惑。如果上一个混合修订版本的例子让你感到困惑,这里是一个为何有这种特性和如何利用这个特性的基础介绍。

Updates and commits are separate

One of the fundamental rules of Subversion is that a “push” action does not cause a “pull,” nor the other way around. Just because you're ready to submit new changes to the repository doesn't mean you're ready to receive changes from other people. And if you have new changes still in progress, then svn update should gracefully merge repository changes into your own, rather than forcing you to publish them.

The main side effect of this rule is that it means a working copy has to do extra bookkeeping to track mixed revisions as well as be tolerant of the mixture. It's made more complicated by the fact that directories themselves are versioned.

For example, suppose you have a working copy entirely at revision 10. You edit the file foo.html and then perform an svn commit, which creates revision 15 in the repository. After the commit succeeds, many new users would expect the working copy to be entirely at revision 15, but that's not the case! Any number of changes might have happened in the repository between revisions 10 and 15. The client knows nothing of those changes in the repository, since you haven't yet run svn update, and svn commit doesn't pull down new changes. If, on the other hand, svn commit were to automatically download the newest changes, then it would be possible to set the entire working copy to revision 15—but then we'd be breaking the fundamental rule of “push” and “pull” remaining separate actions. Therefore, the only safe thing the Subversion client can do is mark the one file—foo.html—as being at revision 15. The rest of the working copy remains at revision 10. Only by running svn update can the latest changes be downloaded and the whole working copy be marked as revision 15.

 

混合版本的限制

无论你如何在工作拷贝中利用混合修订版本,这种灵活性还是有限制的。

First, you cannot commit the deletion of a file or directory that isn't fully up to date. If a newer version of the item exists in the repository, your attempt to delete will be rejected in order to prevent you from accidentally destroying changes you've not yet seen.

Second, you cannot commit a metadata change to a directory unless it's fully up to date. You'll learn about attaching “properties” to items in 第 3 章 高级主题. A directory's working revision defines a specific set of entries and properties, and thus committing a property change to an out-of-date directory may destroy properties you've not yet seen.