Concurrent Versions System
(CVS)
版本控制系统简介
车东 chedong@bigfoot.com
多人协同开发中的问题
同步的最新修改
文件的版本回溯
多人同时修改同一个文件产生的冲突
项目的分支开发
文件权限控制
正确的运行模式
用一个的代码管理库集中管理代码同步
版本库
user1
user3
user2
什么是 CVS
Concurrent Version System
并发版本控制系统
Unix端服务器
http://www.cvshome.org
其他平台的客户端
http://www.wincvs.org/
FAQ
http://www.loria.fr/~molli/cvs-index.html
术语
CVSROOT: 代码库
Repository: 项目包
Version: 版本号
Branch: 版本分支
CVS开始第一个项目
环境变量$CVSROOT:
– bash: CVSROOT=/home/cvsroot ; export CVSROOT
– tcsh: setenv CVSROOT /home/cvsroot
CVSROOT库初始化:cvs init
项目包首次导入:cvs import
– cvs import -m "write some comments here" project_name vender_tag release_tag
CVS的使用命令
cvs checkout proj_name 导出项目包
cvs commit –m “write comments” file_name 提交更新
cvs update –m “write comments” file_name 同步库
cvs log file_name查看修改日志
cvs diff –r1.2 –r1.3 file_name 查看文件版本区别
cvs add file_name 添加新文件到项目包
cvs remove file_name 从项目包里删除文件
CVS的使用流程
cvs checkout(首次导出) cvs up(同步代
码)cvs commit(提交修改)cvs up(同
步代码)cvs commit(提交修改)…..
恢复到一个旧的版本:
如果用cvs update -r1.2 file.name
这个命令是给file.name加一个STICK TAG: "1.2" ,虽然你的本意只是想将
它恢复到1.2版本
正确的恢复版本的方法是:cvs update -p -r1.2 file.name >file.name
如果不小心忘了-p加成STICK TAG的话:用cvs update –A 解决
CVS的远程用户认证
通过SSH远程登陆CVS:
CVSROOT=:ext:$USER@test.server.address#port:/path/to/cvsroot CVS_RSH=ssh; export CVSROOT CVS_RSH
CVS服务器端SSH端口不在缺省的22
假设服务器端的ssh端口是34567,客户端,创建ssh_cvs
#!/usr/bin/sh
ssh -p 34567 $*
然后:chmod +x ssh_cvs
设置CVS_RSH=ssh_cvs; export CVS_RSH
CVS Web界面访问
方便文件版本跟踪
– http://www.freebsd.org/~fenner/cvsweb/
– 一个功能更丰富的版本
http://www.spaghetti-code.de/software/linux/cvsweb/
CVS vs VSS
CVS VSS
update/commit get_lastest_version
/check_in
CVS没有锁定机制 checkout/undo
edit/unedit checkout
通用的标记
$Header$
$Author$
$Date$
$Revision$
WinCVS
http://www.wincvs.org/
1. Cvs Folders->Macros folder->Change Root
2. Cvs Admin->Preferences
cvs server:
username@server.ip.address:/path/to/cvsroot
Authenitication:
passwd at cvs server
3. Cvs Admin->Login…
4. Cvs Admin->Checkout module…
CVSTrac
WEB界面的
CVS用户管理
CVS WEB浏览
BUG TRACKING
Wiki讨论版
相关资源
CVS HOME:
http://www.cvshome.org
CVS FAQ:
http://www.loria.fr/~molli/cvs-index.html
相关网站:
http://directory.google.com/Top/Computers/Software/Configuration_Management/To
ols/Concurrent_Versions_System/
CVS 免费书:
http://cvsbook.red-bean.com/
CVS 命令的速查卡片:
http://www.refcards.com/about/cvs.html
WinCVS:
http://www.wincvs.org
CVSTrac: A Web-Based Bug And Patch-Set Tracking System For CVS
http://www.cvstrac.org
感谢