为更好地对项目进行版本控制,经过反复对比,最终选定使用SubVersion用作项目总管:开源、标准、使用者众,技术和思想要先进些,易于理解和实施…..搜集了相关的文档供参照。
在项目中引入Subversion
?
为更好地对项目进行版本控制,经过反复对比,最终选定使用SubVersion用作项目总管:开源、标准、使用者众,技术和思想要先进些,易于理解和实施…..
首先下载并安装服务器端和客户端软件,然后设定项目库目录,进行简单的权限配置,规划好目录结构,在项目组中公布服务器地址,很快第一批代码和文档被导入系统,初始化工作宣告结束。仅用了约一个小时,就大功告成--我们的版本控制系统投入试运行了。
这项工作进行地如此顺利,不禁感慨颇多:这一切均受益于互联网络,受益于开源软件开发者、研究者和参与者们的辛勤努力,受益于在网上无私奉献自己的经验和体会的朋友们。虽然,我们中国的开源软件开发比欧美的开发者要落后许多,但是我们正在努力,已经看到越来越多的开源软件和先进开放的理念被介绍和引进,被更多的人接受,被更多地尝试。
以下是收集的Subversion相关资料。
1:Subversion快速入门教程
2:配置Subversion
3:integration with eclipse (在eclipse中整合subversion)
4:SVN Service Wrapper for Windows(把subversion配置成windown的服务)
5:Keep Track of Your Documents(另一篇入门文档)
6:整合Subversion与Apache
推荐网站:Subversion中文站
1:Subversion快速入门教程
?
作者: Rock Sun
2005-10-20
原文地址:http://www.subversion.org.cn/
如何快速建立Subversion服务器,并且在项目中使用起来,这是大家最关心的问题,与CVS相比,Subversion有更多的选择,也更加的容易,几个命令就可以建立一套服务器环境,可以使用起来,这里配套有动画教程。
本文是使用Subversion最快速的教程,在最短的时间里帮助您建立起一套可用的服务器环境,只需略加调整就可以应用到实际项目当中。
本教程分为以下几个部门,不仅仅是快速入门,最后我们还有一些高级功能的说明,为了说明简单,教程是在windows下使用的方式,以方便资源有限的项目使用,对于UNIX环境下,区别并不大。
1. 软件下载
2. 服务器和客户端安装
3. 建立版本库(Repository)
4. 配置用户和权限
5. 运行独立服务器
6. 初始化导入
7. 基本客户端操作
1,软件下载
· 下载Subversion服务器程序。
到官方网站 的下载二进制安装文件,来到二进制包下载部分 ,找到 Windows NT, 2000, XP and 2003部分,然后选择"this directory",这样我们可以看到许多下载的内容,目前可以下栽 svn-1.2.3-setup.exe。
· 下载Subversion的Windows客户端TortoiseSVN。
TortoiseSVN是扩展Windows Shell的一套工具,可以看作Windows资源管理器的插件,安装之后Windows就可以识别Subversion的工作目录。
官方网站是TortoiseSVN,下载方式和前面的svn服务器类似,在Download页面的我们选择Official version for Win2k/XP or higher的版本,然后在sourceforge的下载页面选择目前的最高稳定版本的安装文件TortoiseSVN-1.2.4.4479-svn-1.2.3.msi。
2,服务器和客户端安装
· 服务器安装,直接运行svn-1.2.3-setup.exe,根据提示安装即可,这样我们就有了一套服务器可以运行的环境。
· 安装TortoiseSVN,同样直接运行TortoiseSVN-1.2.4.4479-svn-1.2.3.msi按照提示安装即可,不过最后完成后会提示是否重启,其实重启只是使svn工作拷贝在windows中的特殊样式生效,与所有的实际功能无关,这里为了立刻看到好的效果,还是重新启动机器。
3,建立版本库(Repository)
运行Subversion服务器需要首先要建立一个版本库(Repository),可以看作服务器上存放数据的数据库,在安装了Subversion服务器之后,可以直接运行,如:
svnadmin create E:svndemorepository
就会在目录E:svndemorepository下创建一个版本库。
我们也可以使用TortoiseSVN图形化的完成这一步:
在目录E:svndemorepository下"右键->TortoiseSVN->Create Repository here...“, 然后可以选择版本库模式, 这里使用默认即可, 然后就创建了一系列目录和文件。
?
4,配置用户和权限
来到E:svndemorepositoryconf目录,修改svnserve.conf:
# [general]
# password-db = passwd
改为:
[general]
password-db = passwd
然后修改同目录的passwd文件,去掉下面三行的注释:
# [users]
# harry = harryssecret
# sally = sallyssecret
最后变成:
[users]
harry = harryssecret
sally = sallyssecret
5,运行独立服务器
在任意目录下运行:
svnserve -d -r E:svndemorepository
我们的服务器程序就已经启动了。
6,初始化导入
来到我们想要导入的项目根目录,在这个例子里是E:svndemoinitproject,目录下有一个readme.txt文件:
1. 右键->TortoiseSVN->Imp
2.?????? URL of repository输入“svn://localhost/trunk”
3.?????? ok
完成之后目录没有任何变化,如果没有报错,数据就已经全部导入到了我们刚才定义的版本库中。
7,基本客户端操作
取出版本库到一个工作拷贝:
来到任意空目录下,在本例中是E:svndemowc1,运行右键->Checkout,在URL of repository中输入svn://localhost/trunk,这样我们就得到了一份工作拷贝。
在工作拷贝中作出修改并提交:
打开readme.txt,作出修改,然后右键->Commit...,这样我们就把修改提交到了版本库,我们可以运行。
察看所作的修改:
readme.txt上右键->TortoiseSVN->Show Log,这样我们就可以看到我们对这个文件所有的提交。在版本1上右键->Compare with working copy,我们可以比较工作拷贝的文件和版本1的区别。
最后,所有的内容都已经录制为动画文件,大家可以参考。
?
?
2:配置Subversion
原文地址:http://blog.nona.name/archives/134.html
采用Subversion作为版本控制,配置方式如下:
配置Subversion
版本控制选用Subversion,它对重构的支持比CVS要好。例如改名,原子提交等CVS无法支持的操作。
下载Subversion的Win32自动安装包,安装至D:Subversion。安装包会自动添加Path等变量。建立D:SVNRepo文件夹,作为代码的根目录。可安装TortoiseSVN作为Client。
执行命令:svnadmin create D:svnrepo或通过TortoiseSVN建立repo根目录。立即就可以使用client通过file:///d:/svnRepo来访问该目录。
SVN有3种常用访问方式。通过file://, svn://,http:// 等不同的协议来访问。对于协作开发,这三种都可以胜任:如果在同一局域网内,可通过windows的文件共享协议来访问其他机器上的文件,例如file://server/d/svnrepo。svn协议使用3690端口,如果防火墙无法打开端口,可与Apache整合使用http协议。
采用svn协议的好处是安全性比较强,可任意更改服务监听端口。运行%SVN_HOME%binsvnserve –d –r d:svnrepo,即可按照daemon方式来运行一个后台进程,监听svn协议的请求。-r的作用是声明root目录。
在linux下运行一个daemon进程非常简单,但是在windows中想让进程在后台运行就需要做成服务才行。下载并安装SVN Service Wrapper,将svnserve包装为服务。
http://dark.clansoft.dk/~mbn/svnservice/
执行:svnservice -install -d -r d:svnrepo,在控制面板->服务中手动开启。用TortoiseSVN浏览svn://localhost/,注意要带上最后的“/”指明root才能正确访问。
使用版本控制必须要进行权限控制,svn协议的权限控制可通过ssh来控制,访问协议则改为:svn+ssh://localhost/,windows下这种方式需要安装ssh客户端。
另一种简易的版本控制为使用passwd文件。修改%REPO_HOME%/conf/ svnserve.conf,包含如下几句:
[general] # 指定匿名可读,授权后才可写入 anon-access = read auth-access = write # 指定密码文件为当前目录下passwd password-db = passwd |
Passwd文件内容如下,用户名 = 密码:
[users] user1 = 123456 |
Subversion的Eclipse插件为:Subclipse,对SVN支持比较完善。一般的操作均可胜任。Subclipse和TortoiseSVN结合使用能发挥更大的威力。
相关网站
http://subversion.tigris.org SVN官方网站
http://tortoisesvn.tigris.org TortoiseSVN,很好的SVN客户端
http://dark.clansoft.dk/~mbn/svnservice/ SVN?Service Wrapper
http://subclipse.tigris.org SVN eclipse插件
参考资料
http://svn.ntcu.net/kwiki/ 中文的SVN资料
http://svnbook.red-bean.com/ Book: Version Control with SVN
http://sun.cis.scu.edu.tw/~nms9115/articles/softeng/scm/svn/2-install/svn_install.htm SVN for Windows中文安装指南
http://svn.ntcu.net/svnbook/ SVN Book中文翻译
39 Responses to “配置Subversion”
kingfish Says:
October 21st, 2004 at 10:04 am
ide工具怎么支持这个东西呢?
zhaohui Says:
October 22nd, 2004 at 6:24 pm
在我看来,使用subversin目前还不成熟,基于以下原
因:
1)svnserve方式不支持目录级的访问控制,用的话来说就是只支持Blanket
Access Control,而非Per-Directory Access Control。
当然使用http://方式可以,但使用apache增加了用户
的负担。目录级的访问控制也许可以在1.2版中实现,但
以subversion开发的速度之慢(从2000-2004才只1个版
本),不知道什么时候才能实现。
2)GUI客户端工具还不成熟。RapidSVN太容易崩溃;
TortoiseSVN则只能在windows中使用,而且与文件浏览器
集成不见的是好事。
3).svn不符合windows .net的规则,无法在.net项目中
使用(AnkhSVN这个.net插件采用的方式是改为_svn,但
造成了不兼容的结果),作为公司级部署subversion,这
是必须要考虑的。
一点不成熟的想法。
?
?
?
3:标题 integration with eclipse
原文来自:http://subversion.tigris.org/
回复到: integration with eclipse (Michael Cornell)
?
From: Mark Phippard <MarkP@softlanding.com>
Date: Wed, 27 Apr 2005 09:31:35 -0400
Content-Type: text/plain; charset="US-ASCII"
Subject: integration with eclipse
?
"Michael Cornell" <michael.cornell@estafet.com> wrote on 04/27/2005
09:26:14 AM:
?
> I have been looking at all the opensource alternatives for source
control, and
> subversion (with tortoise) comes out tops. I have on
before
> assessing this product fully:
>
> Will subversion integrate with Eclipse 3.0.1 (ie the same as any
standard CVS
> repository with a p server etc), or has anybody tried this?
?
Yes.
?
?
Mark
?
原文来自:http://wjl.cn/blog/blog.php?do=showone&tid=1257
add this to eclipse update site:http://subclipse.tigris.org/update_1.0.x
---------------------------------------------------------------------
?
4:SVN Service Wrapper for Windows
http://clanlib.org/~mbn/svnservice/
This is my Win32 Service wrapper for SVN. Source is included, and its in the public domain. No need to copyright this stuff.
Usage instructions:
?
? SVNService -??????????????????????????????? to display this list
? SVNService -install <svnserve parameters>?? to install the service
? SVNService -setup <svnserve parameters>???? to change command line parameters for svnserve
? SVNService -remove????????????????????????? to remove the service
? SVNService -debug?????????????????????????? to run as a console app for debugging
?
Example:
?
? SVNService -install -d -r c:svnrepo
? SVNService -setup -d -r c:otherplacesvnrepo
?
IMPORTANT:
?
? Make sure you place SVNService.exe in the same directory as svnserve.exe
-Magnus Norddahl
?
5:Keep Track of Your Documents
原文地址:http://www.pcmag.com/print_article2/0,1217,a=157801,00.asp
ARTICLE DATE: 08.17.05
By?John Clyman
If you're a typical knowledge worker, you know the frustration of trying to stay afloat amidst a raging torrent of documents. When multiple people edit documents, or when you divide your work between a desktop and a notebook, it's hard to keep track of where the most current version of a file lives, and all too easy to lose critical information. But with Subversion and TortoiseSVN, a pair of open-source software programs, you can worry less about overwriting a critical file or inadvertently making destructive changes.
Software developers have long used version control to keep all of their files in a central repository. Individuals can "check out" these files, make changes locally, and then "check in" or "commit" the modified files to the repository. (Checking out a file doesn't remove it from the repository; instead, it creates a local copy for the user.)
More sophisticated than a simple folder-sharing arrangement, the version-control system manages all access to the repository. It prevents conflicts among users who try to modify the same file, and tracks changes between successive check-ins, so you can roll back to earlier versions—even for files that have since been deleted.
Subversion's developers specifically intend it as an improved successor to CVS (Concurrent Versions System), which is the dominant source-control system in the open-source world. CVS has limitations that make it appealing on
In a production environment, you'll likely install Subversion on a server. But to get started, you can just download the binary package from http://subversion.tigris.org and install it on your system.
By itself, Subversion (aka SVN) uses a command-line interface. TortoiseSVN ( http://tortoisesvn.tigris.org ) adds a more intuitive interface to the SVN client that integrates with Windows Explorer and common file dialogs. You'll still use the command line for some administrative tasks, but the majority of your day-to-day work can be handled with the GUI.
On
svnadmin create /path/to/repository
Next, run the Subversion server, which responds to commands from Subversion clients. At the command prompt, enter:
svnserve -d -r /path/to/repository
The server listens on port 3690 (open this port on your local firewall if necessary). By default, the server permits on
[general] anon-access = write
To begin managing your documents, open Windows Explorer and pick a directory to put under version control. Right-click, and you'll notice that the context menu includes new Subversion-oriented commands (see Figure 1 at the top of the page). Choose TortoiseSVN | Imp
Now you can check out files from any machine with TortoiseSVN installed. Pick a convenient location, right-click, and select SVN Checkout. Again, specify the repository URL. Subversion downloads copies of all the files stored in the repository.
Notice that file icons are overlaid with a green checkmark, indicating that the files haven't been modified. If you make changes, the overlay icons will change accordingly (Figure 2). To upload your changes to the repository, right-click and select SVN Commit. Subversion will object if someone else has already updated the same file in the repository; otherwise, it will check in the file but preserve previous versions, so you can always undo changes. As long as you use the TortoiseSVN context menu to rename and delete files, Subversion can even track those operations.
On
Continue on to http://go.pcmag.com/subversion for a more detailed, illustrated walkthrough.
John Clyman is a contributing editor of PC Magazine.
Subversion and TortoiseSVN: An Illustrated Walkthrough
ARTICLE DATE: 08.05.05
In our Solutions article "Keep Track of Your Documents," we describe how you can use version control to improve the way you and your team manage your documents. In this walkthrough, we provide step-by-step illustrations showing how to use Subversion and TortoiseSVN for basic version control. By the end of the walkthrough, you'll see some of the specific benefits version control provides, such as letting you roll back changes -- even deletions -- and helping you keep files synchronized between multiple users or multiple machines.—Continue Reading
Imp
On
Enter svn:// followed by the name or IP address of the machine where the Subversion server is running. If it's on your own machine, you can use the name "localhost".
TortoiseSVN instructs Subversion to imp
Checking Files Out
Now that you've uploaded files into the repository, you should no longer edit those files directly. Instead, you'll create a local "working copy" of a portion of the repository and do all your work on that working copy. Then when you're ready to share your changes or to make a permanent record of them, you can commit them to the repository.
To create a working copy, pick a location on your hard disk, right-click, and select SVN Checkout from the context menu.
Choose the repository URL from the pick list and make sure the directory where you want to create your working copy is indicated. (We'll call it c:work). Click OK.
TortoiseSVN shows the results of the checkout. Click OK. (Since these confirmation dialogs appear similar for most operations, we'll omit them for the remaining steps in this walkthrough.)
Updating the Working Copy
When you browse within the working directory or a subdirectory, you'll see that files are overlaid with a green check mark. This indicates that you haven't changed the file since you checked it out.
If you change some documents, the overlay icon on those documents changes to a red exclamation point. This indicates that the local copy contains alterations you'll need to check into the repository. Notice that there's also a new file, Sidebar.doc, which has no overlay icon because we haven't yet told Subversion about it.
You could check in documents on
(Note: By default, TortoiseSVN doesn't change the icons at higher levels of the directory hierarchy to reflect the status of files and directories at lower levels. You can change this beha
TortoiseSVN lists the files that are scheduled to be committed (checked in). We've checked the checkbox beside Sidebar.doc to ensure that it's included in the check-in, and entered a short log message.
Making More Changes: Deleting and Renaming Files
At this point, you're well on your way to being productive with Subversion and TortoiseSVN. Note that TortoiseSVN's capabilities are available not just in Windows Explorer, but also in common file dialogs.
On
To rename or delete a file, right-click and select TortoiseSVN | Delete or TortoiseSVN | Rename. (As when you change a file's contents, changing its name or location doesn't affect the repository until you commit.)
Rolling Back Changes
On
To take a look at the revision history for a file, right-click on it and choose either Revision Graph (for a purely graphical view) or Show Log (which provides more detail, including any log messages you entered). If you right-click on
You can choose Save Revision To if you want to recover an old version of the file and save it somewhere. Or you can select Update Item To Revision if you want to roll back the selected file to a specific prior version. If you're working with a text file, you can choose Compare with working copy to compare versions side-by-side using TortoiseSVN's built-in diff utility.
Or you can use this menu to undo a destructive change. If, for example, you delete an entire directory and later realize that was a mistake, you can use the Show Log command to determine when you deleted the directory (good log messages help!) and select Revert changes from this revision.
TortoiseSVN will put back all the files you deleted and otherwise roll back the changes you wish you hadn't made.
Supporting Multiple Users and Multiple Machines
So far we've on
To demonstrate this, let's start by creating a working copy on another machine that has TortoiseSVN installed. To create the working copy, right-click in Windows Explorer and choose SVN Checkout.
At any time, you can see if someone has updated the repository since you checked out your working copy. Right-click in a file view and select TortoiseSVN | Check For Modifications. Then click the Check Repository button. If there have been changes, you'll see a list something like this.
To retrieve those changes, right-click in a file view and select SVN Update.
Of course, if two people are working on the same files at the same time, the possibility for conflict exists. Subversion watches out for this, and if you try to check out a file that you've changed in your local copy, it will warn you and ask you to resolve the conflict. This isn't an automatic process; you'll need to determine which material from your version and which from the other person's version to keep. While that requires a bit of effort, it's certainly preferable to having on
? |
? |
Subversion's conflict detection ensures that checking out files will never cause you to lose changes you've made to your working copy. Similarly, if you try to check in a file that someone else has already checked in changes to, Subversion will prevent you from overwriting those changes inadvertently.
(Note that some version control systems take a different approach to preventing conflicts, requiring users to explicitly lock files they intend to edit and requiring other users to check out locked files in read-on
Even if you use it by yourself, Subversion can prove handy for synchronizing files between multiple machines. As long as you keep your most up-to-date da
For more information about how to use TortoiseSVN, which provides the graphical front-end interface to Subversion that we've seen, visit http://tortoisesvn.berlios.de/?q=support.
?
?
?
6:整合Subversion与Apache
原文地址:http://blog.nona.name/archives/135.html
整合Subversion与Apache是一种比较适合协作的方法,其配置方式如下:
整合SVN与Apache
另一种比较常用的使用SVN的方式是将其与apache整合。通过http协议来访问代码,通过web界面来浏览察看,通过http服务器的安全控制来进行权限认证。
蔡煥麟先生有一篇整合的详细教程,此处不再缀述,请参见:
http://sun.cis.scu.edu.tw/~nms9115/articles/softeng/scm/svn/2-install/svn_install.htm
安装要点记录如下:
0 假设安装Apache至D:Apache2
1 复制%SVN_HOME%binlibdb42.dll、libeay32.dll、以及 ssleay32.dll到%APACHE_HOME%bin
2 复制%SVN_HOME%httpd*.so到%APACHE_HOME%modules
3 修改%APACHE_HOME%confhttpd.conf,增加或修改:
LoadModule dav_module modules/mod_dav.so LoadModule dav_fs_module modules/mod_dav_fs.so LoadModule dav_svn_module modules/mod_dav_svn.so LoadModule authz_svn_module modules/mod_authz_svn.so |
4 在<VirtualHost>中增加/svn的<Location>
<Location /svn> DAV svn # 指向SVN Repository的ROOT SVNPath d:/svnrepo </Location> |
5 重起apache,通过浏览器访问http://localhost/svn 可看到Subversion的信息。
在访问控制的方面,蔡先生采用的是windows域用户身份验证。此处也可以用mysql,passwd文件,LDAP等其他任何Apache支持的验证方式。
此处我采用文件方式,首先建立一个保存密码的文件,如果不需要对密码加密,可增加-p参数生成plain text。
%APACHE_HOME%binhtpasswd –c -p d:passwdpasswords user1
生成的文件内容如下:
#格式username:password user1:123456 |
如果要按照Group的方式来控制权限,可同时建立一个groups文件,内容如下:
#格式:GroupName: username1 username2 svngroup: user1 user2 |
在httpd.conf中的/svn处增加权限控制部分:
<Location /svn> DAV svn # 指向SVN Repository的ROOT SVNPath d:/svnrepo ? AuthType Basic AuthName "Subversion Repository" AuthUserFile d:/passwd/passwords AuthGroupFile d:/passwd/groups Require group svngroup </Location> |
重起服务器,浏览http://localhost/svn,出现安全对话框,输入用户名密码即可成功。
相关网站
http://httpd.apache.org/ Apache Web Server 官方网站
参考资料
http://sun.cis.scu.edu.tw/~nms9115/articles/softeng/scm/svn/2-install/svn_install.htm 蔡煥麟 SVN for Windows的安装教程
http://www.douzhe.com/docs/ApacheManual/ Apache2.0 中文参考
http://httpd.apache.org/docs-2.0/ Apache2.0 文档
Responses to “整合Subversion与Apache”
liupeng Says:
December 29th, 2004 at 7:48 pm
我完全按照您描述的过程进行安装,但是进行完httpd.conf配置后Apache就不能启动了,并提示一下错误:
事件类型: 错误
事件来源: Apache Service
事件种类: 无
事件 ID: 3299
日期: 2004-12-29
事件: 18:23:30
用户: N/A
计算机: CDY
描述:
The Apache service named reported the following error:
>>> Cannot load C:/Program Files/Apache Group/Apache2/modules/mod_dav_svn.so into server: xd5xd2xb2xbbxb5xbdxd6xb8xb6xa8xb5xc4xc4xa3xbfxe9xa1xa3 .
事件类型: 错误
事件来源: Apache Service
事件种类: 无
事件 ID: 3299
日期: 2004-12-29
事件: 18:23:30
用户: N/A
计算机: CDY
描述:
The Apache service named reported the following error:
>>> Syntax error on line 173 of C:/Program Files/Apache Group/Apache2/conf/httpd.conf: .
是什么原因?请给予帮助,我的Email: liupeng_lp@163.com
冰云 Says:
December 29th, 2004 at 11:32 pm
好像是.so的版本不对吧,我好像也出过这问题
wbq Says:
December 30th, 2004 at 4:19 pm
我也出现与 icecloud 一样的问题,但是怎么样也搞不定,我也确性我的配置严格按照上述方法完成,apache可以单独跑起来,subversion也可以在本机通过file访问,但是二者整合却不行。
至于版本我用的是For Subversion 1.1,*.so也是从那里copy过来的。
我觉得好像是与环境有关,我的一台机器可以整合,但另一台机器却有问题,网上有人讲与硬盘的格式有关,不能使NTFS,不理解,请高手不惜赐教。
wbq Says:
January 11th, 2005 at 11:56 am
No body can answer this question?!
hqerl Says:
January 26th, 2005 at 3:10 pm
我按照配置方法都做好了,但输入用户名和密码后,却出现以下错误页面:
Forbidden
You don’t have permission to access /svn/ on this server.
哪位能告诉我怎么回事儿啊?
tlg Says:
January 31st, 2005 at 1:10 am
怎样控制各目录的权限
Jingle Says:
March 27th, 2005 at 11:50 am
把pathtosubversionintalledbinintl.dll拷贝到apache2modules目录下
Fwolf Says:
June 30th, 2005 at 11:53 pm
liupeng说的那种错误,我也遇到并解决了
就是重新安装了Apache 2.0.54,就可以了
http://www.fwolf.com/blog/post/1/30
希望对你有帮助
=====================================