第1节 Version Control System
推荐给好友
打印
加入收藏
更新于2008-05-15 18:17:16

VCS的分类

1. 集中式模型
     • 文件锁定(锁定-修改-解锁)
          VSS
     • 版本合并
          CVS/SVN
2. 分布式模型
     • Bazaar/Git/Mercurial
  *. 手工作坊式:rar+msn:土八路


What is CVS?

 • CVS = Concurrent Versions System
 • Open source
 • Client/server design
 • Client and servers available for just about any platform OS X, Windows, and Linux
 • Traditionally command line based but there are several excellent GUI clients

Terminology

 • Repository - area on the server where the files are stored
 • Sandbox - a local copy of the code which you work on and then commit to the repository
 • Checkout - act of getting a local a copy of the latest version of the code from the repository
 • Commit - saving the changes to your local file(s) to the cvs repository


术语

 • CVSROOT: 代码库 
 • Repository: 项目仓库
 • Version(revision): 版本号
 • Branch: 版本分支 

Terminology (part 2)

 • Update - getting code changes that have been committed since you checked out the project
 • Merge - combining changes between two versions of the same file
 • History - shows a list of commit messages, times and, who committed for a particular file
 • Revision - cvs assigned version number for a file
 • Tagging - a way to mark a group of files and revisions
 • Branching - a way to work on multiple copies of your application


Other CVS Tools

 • ViewCVS - http://viewcvs.sourceforge.net/
 • CVSMonitor - http://ali.as/devel/cvsmonitor/

 

多人协同开发中的问题

 • 同步的最新修改
 • 文件的版本回溯
 • 多人同时修改同一个文件产生的冲突
 • 项目的分支开发
 • 文件权限控制

 

正确的运行模式

 • 用一个代码管理库集中管理代码同步


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 vs VSS

 • CVS update/commit
CVS没有锁定机制edit/unedit


 • VSS get_lastest_version /check_in
checkout/undo checkout


 • 通用的标记

$Header$

$Author$

$Date$

 $Revision$

WinCVS

http://www.wincvs.org/
 Cvs Folders->Macros folder->Change Root
 Cvs Admin->Preferences cvs server: username@server.ip.address:/path/to/cvsroot Authenitication: passwd at cvs server
 Cvs Admin->Login…
 Cvs Admin->Checkout module…

CVSTrac

 WEB界面的
 • CVS用户管理
 • CVS WEB浏览
 • BUG TRACKING
 • Wiki讨论版


What cvs isn’t/doesn’t...

 • build system
 • project management
 • talking to your friends
 • change control:
     all changes are isolated vs. single logical change
     bug fix tracking
     track change verification
 • testing program (regression testing)
 • work flow or process model


SVN

 • CVS的替代产品
 • 使用SVN客户端从http://esdbook.googlecode.com/svn/trunk/
      下载第二章,阅读版本控制一节
 • 要求会用svn管理自己的代码和文档
 • 要求结合google管理项目组的代码和文档

 

<<上一节         下一节 >> 




 
关于我们 | 诚邀加盟 | 客户服务 | 相关法律 | 网站地图 | 友情链接 | 服务信箱:service@eefocus.com
© 2006 与非门科技信息咨询(北京)有限公司 All Rights Reserved.