源代码版本维护

官方网站:http://subversion.apache.org/

Windows客户端 TortoiseSVN:http://tortoisesvn.net/

常见的版本控制软件
  CVS,逐渐被SVN取代,是CVX重写版和改写版
  SVN,Subversion
  Git,Git是一个开源的分布式版本控制系统,用以有效、高速的处理从很小到非常大的项目版本管理。Git 是 Linus Torvalds 为了帮助管理 Linux 内核开发而开发的一个开放源码的版本控制软件

SVN存储数据的方式
  BDB,Berkeley DB,一种事务安全型表类型
  FSFS,"FSFS" 采用文件系统的方式, 替代原来的基于Berkeley DB的实现.
  因为BDB方式在服务器中断时,有可能锁住数据,所以还是FSFS方式更安全一点

SVN的运行方式及端口
  独立服务器 3690端口 访问方式SVN:// C/S模式
  借助apache运行 80端口 访问方式 http://

安装svn:

[root@super67 ~]# yum install -y subversion

[root@super67 ~]# grep svn --color /etc/services
svn 3690/tcp # Subversion
svn 3690/udp # Subversion

存放版本库的主目录:
[root@super67 ~]# mkdir /myweb

创建两个版库:
[root@super67 ~]# svnadmin create /myweb/www.xiaofan.com
[root@super67 ~]# svnadmin create /myweb/www.xiaofan.cn

版本库文件介绍:
[root@super67 ~]# ll /myweb/www.xiaofan.com/
total 24
drwxr-xr-x 2 root root 4096 Sep 25 09:54 conf #创库的配置文件(账号、权限等)
drwxr-sr-x 6 root root 4096 Sep 25 09:54 db #版本库数据存放位置
-r--r--r-- 1 root root 2 Sep 25 09:54 format #当前文件库配置的版本号
drwxr-xr-x 2 root root 4096 Sep 25 09:54 hooks #放置hook脚本的位置
drwxr-xr-x 2 root root 4096 Sep 25 09:54 locks #放置subversion锁定数据的目录,追踪存取文件库的客户端
-rw-r--r-- 1 root root 229 Sep 25 09:54 README.txt
dav目录:是提供apache与mod_dav_svn使用的目录,让他们存储内部数据,刚开始新建时此目录没有

conf目录文件:

[root@super67 ~]# ll /myweb/www.xiaofan.com/conf/
total 12
-rw-r--r-- 1 root root 1080 Sep 25 09:54 authz #认证权限
-rw-r--r-- 1 root root 309 Sep 25 09:54 passwd #用户名和密码
-rw-r--r-- 1 root root 2279 Sep 25 09:54 svnserve.conf #服务器配置文件

修改配置文件:

[root@super67 ~]# grep -Ev "^$|^#" /myweb/www.xiaofan.com/conf/svnserve.conf
[general]
anon-access = read #匿名用户可以读,使用none的话就是匿名用户不可以访问
auth-access = write #认证用户可以写,可以是read,write,none
password-db = passwd #密码库文件,默认使用的是同一目录下的passwd文件作为用户密码库
authz-db = authz #认证权限文件
realm = www.xiaofan.com #登陆提示信息
[sasl]

[root@super67 ~]# grep -Ev "^$|^#" /myweb/www.xiaofan.com/conf/passwd
[users] #定义用户、密码
xiaofan = 123456
tt = 1234567
user = 12345678

[root@super67 ~]# grep -Ev "^$|^#" /myweb/www.xiaofan.com/conf/authz
[aliases]
[groups]
Check = xiaofan,tt #定义组
[/] #/表示我当前所在版本库目录
user = rw # user 用户有读写权限
@Check = r #@Check表示这个组的权限,就是上面定义的组的成员
* = #除了上面的有赋予权限成员之外,其他的成员都没有权限

SVN目录格式:
[/目录名]
@用户组名 = 权限
用户名 = 权限
* =

启动svn:
[root@super67 ~]# svnserve -d -r /myweb/

导入本地代码:

[root@super67 ~]# mkdir svn_local
[root@super67 ~]# cd svn_local/
[root@super67 svn_local]# touch 1.jsp 2.jsp 3.jsp
[root@super67 svn_local]# svn import /root/svn_local/ file:///myweb/www.xiaofan.com/ -m "one"
Adding /root/svn_local/1.jsp
Adding /root/svn_local/2.jsp
Adding /root/svn_local/3.jsp

Committed revision 1.

客户端提交代码:

[root@super67 svn_client]# touch 4.jsp 5.jsp
[root@super67 svn_client]# svn import /root/svn_client/ svn://192.168.1.67/www.xiaofan.com/ -m "two"
Authentication realm: <svn://192.168.1.67:3690> www.xiaofan.com
Password for 'root':
Authentication realm: <svn://192.168.1.67:3690> www.xiaofan.com
Username: user
Password for 'user': 12345678

-----------------------------------------------------------------------
ATTENTION! Your password for authentication realm:

<svn://192.168.1.67:3690> www.xiaofan.com

can only be stored to disk unencrypted! You are advised to configure
your system so that Subversion can store passwords encrypted, if
possible. See the documentation for details.

You can avoid future appearances of this warning by setting the value
of the 'store-plaintext-passwords' option to either 'yes' or 'no' in
'/root/.subversion/servers'.
-----------------------------------------------------------------------
Store password unencrypted (yes/no)? no
Adding /root/svn_client/5.jsp
Adding /root/svn_client/4.jsp

Committed revision 2.
[root@super67 svn_client]#

下载代码:

[root@super67 ~]# svn checkout svn://192.168.1.67/www.xiaofan.com svn_download
Authentication realm: <svn://192.168.1.67:3690> www.xiaofan.com
Password for 'user':
Authentication realm: <svn://192.168.1.67:3690> www.xiaofan.com
Username: xiaofan
Password for 'xiaofan':

-----------------------------------------------------------------------
ATTENTION! Your password for authentication realm:

<svn://192.168.1.67:3690> www.xiaofan.com

can only be stored to disk unencrypted! You are advised to configure
your system so that Subversion can store passwords encrypted, if
possible. See the documentation for details.

You can avoid future appearances of this warning by setting the value
of the 'store-plaintext-passwords' option to either 'yes' or 'no' in
'/root/.subversion/servers'.
-----------------------------------------------------------------------
Store password unencrypted (yes/no)? no
A svn_download/5.jsp
A svn_download/1.jsp
A svn_download/2.jsp
A svn_download/3.jsp
A svn_download/4.jsp
Checked out revision 2.

checkout:
check out导出获得文件后,导出的文件仍处于SVN版本控制中,与版本库保持关联,
比如你可以进行Svn Update或者Svn Commit操作,checkout是第一次用,后面的用法就是更新

修改、添加代码:

[root@super67 ~]# cd svn_download/
[root@super67 svn_download]# ls
1.jsp 2.jsp 3.jsp 4.jsp 5.jsp
[root@super67 svn_download]# cat 5.jsp
#
555555555
[root@super67 svn_download]# touch 6.html
[root@super67 svn_download]# svn add 6.html
A 6.html
[root@super67 svn_download]# svn add 5.jsp
svn: warning: '5.jsp' is already under version control

[root@super67 svn_download]# svn commit -m "three"
Authentication realm: <svn://192.168.1.67:3690> www.xiaofan.com
Password for 'xiaofan':
Authentication realm: <svn://192.168.1.67:3690> www.xiaofan.com
Username: user
Password for 'user': 12345678

-----------------------------------------------------------------------
ATTENTION! Your password for authentication realm:

<svn://192.168.1.67:3690> www.xiaofan.com

can only be stored to disk unencrypted! You are advised to configure
your system so that Subversion can store passwords encrypted, if
possible. See the documentation for details.

You can avoid future appearances of this warning by setting the value
of the 'store-plaintext-passwords' option to either 'yes' or 'no' in
'/root/.subversion/servers'.
-----------------------------------------------------------------------
Store password unencrypted (yes/no)? no
Sending 5.jsp
Adding 6.html
Transmitting file data ..
Committed revision 3.

add 功能:
向文件拷贝所在的文件夹中添加新的文件,并作出标识,是新添加的,
下一步提交时将一并提交到Subversion版本库中去。
简单的说就是将一新文件加入svn,你添加再提交后该文件就进入subversion版本中去了;

常见的选项:
import:将未版本化的文件纳入版本控制并提交
checkout:从版本库中检出一个修订版
update:更新工作拷贝
add,delete,copy, move:增、删、复制、移动文件或目录
status:检查状态差异
diff:检查文件行级详细差异
revert:恢复
resolve:解决冲突
switch:切换工作拷贝对应的版本库分支
log:查看历史记录
list:显示文件目录
cat:查看某个文件内容

svn服务器配置的更多相关文章

  1. linux下SVN服务器配置

    SVN服务器配置 1. 安装svn服务 yum install subversion 2. 新建一个目录用于存储SVN所有文件 mkdir /home/svn 3. 创建项目 在上面创建的文件夹中为项 ...

  2. SVN服务器配置实战

    [需求] 为公司多个部门建立的SVN仓库compay 公司部门和人员构成 A部门 (zhangsan,lisi,wanger,mazi) B部门(jia,yi,bing,ding) C部门(chun, ...

  3. Windows基于Apache的svn服务器配置

    参照 http://bbs.iusesvn.com/thread-158-1-1.html文章,经过svn的洗刷,终于把它配置成功,现在把我所配置的方法,记录下来,以供其他有需要的朋友参考,需要改进的 ...

  4. Windows 下 SVN 服务器配置

    1.下载文件,   下载最新版本subversion,我这里选择VisualSVN-Server-2.5.7.exe   2.安装Subversion 服务器   由于我下载的是setup.exe版本 ...

  5. svn服务器配置小记

    在这里/opt/svndata/repos1创建svn版本库svnadmin create /opt/svndata/repos1 创建成功后会在/opt/svndata/repos1目录下生成con ...

  6. svn服务器配置与客户端的使用

    1, Apache Subversion 官网下载地址: http://subversion.apache.org/packages.html#windows 官网下载提供的一般都是最新版本的,如果想 ...

  7. svn服务器配置以及自动同步到web服务器

    感觉再不用svn就真的老了. 安装 yum install subversion 新建repo mkdir -p /opt/svn/myrepo svnadmin create /opt/svn/my ...

  8. svn服务器配置 for mac

      本文转载至 http://blog.sina.com.cn/s/blog_5e42f31a010156z4.html 1.找到合适的目录,新建一个版本库的目录:mkdir svn 创建版本库:sv ...

  9. 简述SVN服务器配置和客户端操作

    有关SVN服务器的搭建见:http://www.cnblogs.com/DwyaneTalk/p/3997688.html 搭建好环境之后,服务器端需要完成如下操作: 1.需要新建Repository ...

随机推荐

  1. object-c 继承多态 动态数据类型

    在c#中我们知道有继承的.同样在object-c中也有继承. 例如我们写一个人类(父),一个学生类.我们可以这么写: demo: @interface Person:NSobject{ NSStrin ...

  2. scrapy爬虫成长日记之创建工程-抽取数据-保存为json格式的数据

    在安装完scrapy以后,相信大家都会跃跃欲试想定制一个自己的爬虫吧?我也不例外,下面详细记录一下定制一个scrapy工程都需要哪些步骤.如果你还没有安装好scrapy,又或者为scrapy的安装感到 ...

  3. iOS 和Android中的基本日期处理

    提到日期处理,主要有2个参数,一个是所在的时区,一个是所用的日历方法. 主要涉及2大类问题,一类是日期类型和字符串之间的转化,另一类是日期的计算问题.ios和android都提供了相应的类来处理问题. ...

  4. Linux系统排查2——CPU负载篇

    本随笔介绍CPU负载的排查手段. 查看系统负载的工具:uptime,w,都能查看系统负载,系统平均负载是处于运行或不可打扰状态的进程的平均数, 可运行:运行态,占用CPU,或就绪态,等待CPU调度. ...

  5. python 将pdf分页后插入至word中

    所用技术 1. python编程基础 2. 使用pyPdf 3. 使用python操作word 4. 正则表达式的使用 5. windows的bat编程 下面是一个pyPdf库使用的示例: from ...

  6. 6.django笔记之orm

    作者:刘耀 一.Django-orm 关系对象映射(Object Relational Mapping,简称ORM). 2.在django里 我们写的类表示数据库的表 如果根据这个类创建的对象是数据库 ...

  7. codeforces B. Xenia and Spies 解题报告

    题目链接:http://codeforces.com/problemset/problem/342/B 题目意思:有n个spy,编号从1-n,从左到右排列.现在的任务是,spy s要把信息传递到spy ...

  8. Extjs的数据读取器store和后台返回类型简单解析

    工作中用到了Extjs,从后台获取数据的时候,用到了extjs自己的Ext.data.store方法,然后封装了ExtGridReturn方法, 目的:前台用到Ext.data.store读取从后台传 ...

  9. MFC基于Dialog的工程中使用OSG

    osg的例子有osgviewerMFC,是MDI类型的MFC工程,我一般用基于对话框的MFC较多. 注意观察MFC_OSG.h文件中的cOSG构造函数,参数是一个窗口句柄hWnd,这里的窗口可以不只局 ...

  10. vmware安装linux.iso

    安装方法 : .进入Fedora后,在虚拟机选项栏中选VM->install vmware tools 拷贝VMware Tools.tar.gz到指定文件夹,解压缩 进入超级终端:在-> ...