您的位置主页 > SVN配置

Subversion快速入门教程(SVN vs CVS)

Subversion快速入门教程(SVN vs CVS)<br />文中提及的Subversion动画教程并不可用,如有任何Subversion相关问题可以一起探讨。<br /><br />Subversion是新一代的版本控制工具,不仅仅应用于程序源代码管理,也可以广泛应用于其他需要协作管理数据的工作,例如有人使用Subversion来合作写乐谱,美工用来共同作图,文档写作人员一起写一篇大作。<br />对于希望学习Subversion的新手,可以看看这一篇最快速的Subversion入门教程。<br /><br />如何快速建立Subversion服务器,并且在项目中使用起来,这是大家最关心的问题,与CVS相比,Subversion有更多的选择,也更加的容易,几个命令就可以建立一套服务器环境,可以使用起来,这里配套有动画教程。<br /><br />本文是使用Subversion最快速的教程,在最短的时间里帮助您建立起一套可用的服务器环境,只需略加调整就可以应用到实际项目当中。<br />本教程分为以下几个部门,不仅仅是快速入门,最后我们还有一些高级功能的说明,为了说明简单,教程是在windows下使用的方式,以方便资源有限的项目使用,对于UNIX环境下,区别并不大。<br />软件下载 <br />服务器和客户端安装<br />建立版本库(Repository) <br />配置用户和权限<br />运行独立服务器 <br />初始化导入 <br />基本客户端操作 <br /><br />1,软件下载<br />下载Subversion服务器程序。 到官方网站的下载二进制安装文件,来到二进制包下载部分 ,找到 Windows NT, 2000, XP and 2003部分,然后选择"this directory",这样我们可以看到许多下载的内容,目前可以下栽 svn-1.2.3-setup.exe。<br />下载Subversion的Windows客户端TortoiseSVN。 TortoiseSVN是扩展Windows Shell的一套工具,可以看作Windows资源管理器的插件,安装之后Windows就可以识别Subversion的工作目录。<br />官方网站是TortoiseSVN,下载方式和前面的svn服务器类似,在Download页面的我们选择Official version for Win2k/XP or higher的版本,然后在sourceforge的下载页面选择目前的最高稳定版本的安装文件TortoiseSVN-1.2.4.4479-svn-1.2.3.msi。<br /><br />2,服务器和客户端安装<br />服务器安装,直接运行svn-1.2.3-setup.exe,根据提示安装即可,这样我们就有了一套服务器可以运行的环境。 <br />安装TortoiseSVN,同样直接运行TortoiseSVN-1.2.4.4479-svn-1.2.3.msi<br />按照提示安装即可,不过最后完成后会提示是否重启,其实重启只是使svn工作拷贝在windows中的特殊样式生效,与所有的实际功能无关,这里为了立刻看到好的效果,还是重新启动机器。<br /><br />3,建立版本库(Repository)<br />运行Subversion服务器需要首先要建立一个版本库(Repository),可以看作服务器上存放数据的数据库,在安装了Subversion服务器之后,可以直接运行,如:<br />svnadmin create E:svndemorepository<br />就会在目录E:svndemorepository下创建一个版本库。<br />我们也可以使用TortoiseSVN图形化的完成这一步:<br />在目录E:svndemorepository下"右键->TortoiseSVN->Create Repository here…“, 然后可以选择版本库模式, 这里使用默认即可, 然后就创建了一系列目录和文件。<br />4,配置用户和权限<br />来到E:svndemorepositoryconf目录,修改svnserve.conf:<br /># [general]<br /># password-db = passwd<br />改为:<br />[general]<br />password-db = passwd然后修改同目录的passwd文件,去掉下面三行的注释:<br /># [users]<br /># harry = harryssecret<br /># sally = sallyssecret<br />最后变成:<br />[users]<br />harry = harryssecret<br />sally = sallyssecret<br />5,运行独立服务器<br />在任意目录下运行:<br />svnserve -d -r E:svndemorepository 我们的服务器程序就已经启动了。<br />6,初始化导入<br />来到我们想要导入的项目根目录,在这个例子里是E:svndemoinitproject,目录下有一个readme.txt文件:<br />右键->TortoiseSVN->Import… <br />URL of repository输入“svn://localhost/trunk” <br />ok 完成之后目录没有任何变化,如果没有报错,数据就已经全部导入到了我们刚才定义的版本库中。<br />7,基本客户端操作<br /><br />取出版本库到一个工作拷贝:<br />来到任意空目录下,在本例中是E:svndemowc1,运行右键->Checkout,在URL of repository中输入svn://localhost/trunk,这样我们就得到了一份工作拷贝。<br />在工作拷贝中作出修改并提交:<br />打开readme.txt,作出修改,然后右键->Commit…,这样我们就把修改提交到了版本库,我们可以运行。<br />察看所作的修改:<br />readme.txt上右键->TortoiseSVN->Show Log,这样我们就可以看到我们对这个文件所有的提交。在版本1上右键->Compare with working copy,我们可以比较工作拷贝的文件和版本1的区别。<br />最后,所有的内容都已经录制为动画文件,大家可以参考。<br />关于本教程大家有什么意见,可以在这里回复。<br /><br />CVS与SVN性能的比较<br />今天看到这个测试结果,效果惊人阿。<br />Action                                                      CVS               SVN <br />Check out small file set         1 m 17.32 s         26.96 s <br />Check out large file set          7 m 16.92 s  5m 35.01 s <br />Tag small file set                     1m 29.30 s            0.88 s <br />Tag large file set                   18 m 52.45 s            0.86 s <br />Update small file set                      44.46 s            4.91 s <br />Update large file set               8 m 53.39 s          38.62 s <br />Create branch (small set)     1 m 27.99 s            0.80 s <br />Create branch (large set)      21 m 2.93 s            0.69 s <br /><br />

引用
As it is known, before getting acquainted with SVN, our company had worked with CVS for long enough. We know CVS from both user and developer points of view. Approximately at the same level we had got acquainted with SVN, and undoubtedly we have an opinion to share with you concerning the question "what system is better?". <br /><br />It is worth noting, that the work on the creation of the IDE plug-in for SVN had started at numerous user requests. However, our own motivation had also played a considerable role in starting work with SVN, since publications appeared that SVN is a substitute for CVS, which eliminates all its problems and shortcomings. Unfortunately, to our point of view, SVN is not a substitute for CVS and all the more it does not eliminate its shortcomings. Moreover, it even yields to CVS. Figuratively, CVS and SVN can be compared as C ++ and Java. Obviously, both CVS and SVN are more powerful than SourceSafe, as well as C ++ and Java are more powerful than Basic. CVS represents almost all functionalities of a source control system, though not always in a convenient and apparent manner. SVN, patching and expanding some CVS functionalities, simply does not contain some important functions. For example, the creation of tags and branches is dubious, and no means are provided to notify others that you are editing a file. It is similar to what the developers of Java have done: they have decided for you that pointers are not necessary, and there is no need in operator overloading etc.<br /><br />Thus, as for now SVN cannot be considered a CVS substitute. It is a different system, similar to CVS. It has unique functions, which can serve as a reason for its usage. These functions make it more suitable for some development environments, for example for PowerBuilder. Below you can find comparative advantages and disadvantages of these systems. It is assumed that in relation to the remaining items the systems are similar. On the green background "advantages" of a system in relation to its competitor are presented, and "disadvantages" are presented on the pink ground. If you are facing the problem of choice, it is recommended to try both systems, paying special attention to the items below. You may also look to some discussion between Subversion developers and Pushok staff.

<br /><br /><br />Why does this project exist?<br />To take over the CVS user base. Specifically, we're writing a new version control system that is very similar to CVS, but fixes many things that are broken. See our front page.<br /><br />Is Subversion proprietary? I heard that it belongs to CollabNet.<br />No, Subversion is open source / free software. CollabNet pays the salaries of several full-time developers, and holds the copyright on the code, but that copyright is an Apache/BSD-style license which is fully compliant with the Debian Free Software Guidelines. In other words, you are free to download, modify, and redistribute Subversion as you please; no permission from CollabNet or anyone else is required.<br /><br />What is Subversion's client/server interoperability policy?<br />The client and server are designed to work as long as they aren't more than one major release version apart. For example, any 1.X client will work with a 1.Y server. However, if the client and server versions don't match, certain features may not be available.<br /><br />

<br>

<br>