`
eyesmore
  • 浏览: 363942 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

cvs 概念和操作

阅读更多

Help:  Workbench User Guide -> Concepts -> Team programming with CVS

学会看官方资料很重要,理解帮助文档的组织形式。

 

一、CVS对于团队开发的重要性

 

我们的项目都是工程级的,一个project需要许多人共同完成,team member之间既相互独立又相互联系。独立的是独立完成一个project的某个module;联系的是最后要merge and share各自的module。这些工作需要借助CVS这样的源代码公里工具。

In the Concurrent Versions System (CVS) team programming environment, team members do all of their work in their own Workbenches, isolated from others. Eventually they will want to share their work . They do this via a CVS Repository.

 

 

二、CVS中Branche的概念

 

2.1 Branch能反映一个项目的推进历程

 

分支Braches

Branches <script type="text/javascript"><!----></script>

In CVS, teams share and integrate their ongoing work in branches .

Think of a branch as a shared work area that can be updated at any time by team members. In this way, individuals can work on a team project, share their work with others on the team, and access the work of others during all stages of the project. The branch effectively represents the current shared state of the project.

一个team的team member之间需要共享他们进行的工作。Branch就是这么一个东西,每个member能够update别人的成果,也能commit自己的成果。

 

 

Thus the branch is constantly changing, moving forward as team members submit new work.

(随着项目组成员不断提交新的工作,Branch其实是一直在变的,一直向前推进的。)

 

The branch effectively represents the current state of the project.(所以,一个Branch能够反映出一个项目推进的历程,而该历程上的里程碑就是个Version or Tag)

每个team member做的修改最终都提交到一个branch上。

At any point a team member can update their workspaces from the branch and know they are up to date.

 

不断变化推进的Branch

As team members produce new work, they share this work by committing those changes to the branch. Similarly, when they wish to get the latest available work, they update their local workspaces to the changes on the branch.

Branches <script type="text/javascript"><!----></script>

Resources can be changed in the Workbench without affecting the branch. Individuals must explicitly provide their changed resources to the branch.

 

 

2.2 一个项目可以有多个Branch,至少有一个

 

Every CVS repository has at least one branch, referred to as HEAD.(每个项目至少有一个Branch,该Branch被称为HEAD)

Under certain conditions, more than one branch may exist in a repository. For example, one branch may be for ongoing work, and another branch may be for maintenance work. 

(某些条件下,会有多个Branch,比如一个Branch是用来推进工作的,另一个是用来维护的。这个我们经常遇到,比如我们开发完了一个版本在生产系统上跑着;后来有了新的业务需求,我们需要增加新功能,同时还要能运维以前的版本。)

由Branch够成一个代码树。

 

开始的时候,任何一个module都有一个主枝被称为'HEAD'。Branch是一棵正常生长的代码树中的枝杈。

一个branch最终要么被合并到主干中去,要么被结束。branch通常用来debug,如果这个bug被fix了,修改bug的代码应该被合并到主枝上去。 一个branch也可能经历多次与主枝的合并。

 

Branches <script type="text/javascript"><!----></script>

As you make changes locally in your Workbench, you are working alone. When you are ready to make your local resource changes available to other team members, you'll need to commit your work to the branch. All such changes are classified as outgoing changes when you do a synchronization.

Ideally, you should update your local workspace with any changes others have made in a branch   ( before committing to it. )

This ensures that you have the very latest work from the other team members.

After you have updated from the branch , merged any conflicting changes in your local Workbench, and tested your changes locally, you can more easily commit your Workbench's changes to the branch. Branches <script type="text/javascript"><!----></script>

When you commit changes to the branch, your changes are copied from your local Workbench to the branch.

As a result, these changes are then seen as incoming changes when other developers update from the branch later. (其他member从Branch下update的时候,他们将会看到有incomming changes产生。)

 

 

当我们update了代码后,我们进行edit,这时候你work alone的,只有你commit你的changes时其他team member才能看到。但为了防止其他的team member也对同一个source code进行了修改,所以首先我们执行syn with repository,该工具会把比对的结果都表示出来,比如outgoing changes 和 incomming changes。

理想的情况就是,你在commit之前首先都把其他人做的修改都update了,这样提交就不会有冲突。

 

 

三、Sync with Repository 与CVS同步

 

Synchronizing with a CVS repository <script type="text/javascript"><!----></script>

In the CVS team programming environment, there are two distinct processes involved in synchronizing resources: updating with the latest changes from a branch and committing to the branch. 

(两个完全不同的操作  distinct

当我们使用cvs进行team programming时,两个操作前我们必须先进行sync with repository操作。一个是update the latest changes from a branch ,另一个是commit your local changes to the branch.

 

When you make changes in the Workbench, the resources are saved locally.  Eventually you will want to commit your changes to the branch so others can have access to them.  Meanwhile , others may have committed changes to the branch.  You will want to update your Workbench resources with their changes.

 

Important! : It is preferable to update before committing, in case there are conflicts with the resources in your Workbench and the resources currently in the branch.  

 

preferable  ['prefərəbl]  更好的;

in case   以防万一,以防止;

相当重要的是:在你commit你的工作前,进行下update。以防止你本地的资源和branch上的资源冲突。

 

 

Synchronizing with a CVS repository <script type="text/javascript"><!----></script>

The synchronize view contains filters to control whether you want to view only incoming changes or outgoing changes . (执行sync with repository之后,工具会报告两类changes,一个是outgoing changes(你需要commit的) 另一个是incomming changes(你需要update的))。

 

Incoming changes come from the branch . If accepted, they will update the Workbench resource to the latest version currently committed into the branch.

Outgoing changes come from the Workbench . If committed, they will change the branch resources to match those currently present in the Workbench.

如果某个时候,同步的结果在同一个文件上既出现了incomming changes又出现了outgoing changes,那么则称为confict 冲突。

 

 

【3.2  conflict产生的原因和解决办法】

Regardless of which mode (filter) you select, the Synchronize view always shows you conflicts that arise when you have locally modified a resource for which a more recent version is available in the branch.(这句话描述了什么情况下会产生一个conflict? 答案是: 你在本地修改了某个资源,也就是产生了一个outgoing changes; 与此同时对于该资源 ,此时在branch上却有了一个更新的版本出现(a more recent version)==那么我们想下,branch上什么情况下会出现一个 a more recent version呢? 很明显是有其他team member做了一次commit操作呗。最后的结论是: conflict出现于团队中有两个人同时都同一个资源进行了修改,那么早提交的那个人能够成功提交,后提交的人则被提示conflict。  a more recent version is available for that resource.)

 

 

In this situation you can choose to do one of three things: update the resource from the branch, commit your version of the resource to the branch, or merge your work with the changes in the branch resource. Typically you will want to merge, as the other two options will result in loss of work.

当产生冲突时,我们大概能做三件事情:

1、强制update and overwrite;2、强制commit and overwrite; 3、merge your work with the changes in the branch resource。

由于前两种都需要overwrite,会导致其中一个人的work被lost。所以,在eclipse中的cvs客户端提倡merge。当然也可以update and overwrite。

 

 

 

 

【3.3 sync 的报告以及解释】 VS Workspace Synchronization <script type="text/javascript"><!----></script>

Synchronization state

The synchronize view shows the synchronization state of resources 同步后产生的状态报告 ) in your workspace compared to those in the repository.

(所谓的同步就是和远程资源进行对比,对一个资源我们能有多少操作呢? 无非只有增、删、改、查 。查是不会改变资源的状态的,那么所谓的变化:为非就是增加、删除和修改)

change (add, delete , modify)

direction : local相对remote  还是 remote相对local 还是同时  :  incomming  ; outgoing 和  conflicting

 

This state is shown by using icons and can also be configured to show the state as text appended to the resource name. A description of the icons is shown in the table below:

 

sync state report

 

Note : in CVS directories are never really deleted from the repository. Instead, files are deleted and empty directories are pruned from your workspace.

注意:对于资源的删除权限应该是很敏感的,我们可以想象如果某个人不小心把某个资源删除了甚至整个项目给删除了,而且能反映到服务器上去,那是多么 不可思议的一件事情;意味着,整个工作的泡汤。所以cvs工具的设计者肯定不会这么干,所以这里的删除并不会从cvs上删除,只是files are deleted and empty directories are pruned from your workspace。  文件和空目录在你的workspace中删除了,cvs上还是有的。

prune  [pru:n]  v. 修剪,砍掉,删除    (prune an empty directory  删除一个空目录)

Important : It is preferable to update resources in the Workbench first, resolve any conflicts that exist by merging, then commit Workbench resources to the repository

 

 

CVS Workspace Synchronization <script type="text/javascript"><!----></script>

Update and Commit Operations

There are several flavours of update and commit operations available in the Synchronize view. You can perform the standard update and commit operation on all visible applicable changes or a selected subset. You can also choose to override and update , thus ignoring any local changes , or override and commit , thus making the remote resource match the contents of the local resource. You can also choose to clean the timestamps for files that have been modified locally (perhaps by an external build tool) but whose contents match that of the server. (对比时一个很重要的依据是依据timestamps)

Conflict Handling

When dealing with conflicts, you can first perform an update and any conflicting changes The update operation will correctly update conflicts that are auto-mergeable (i.e. files content changes do not overlap ) but will skip files that contain changes that overlap.

overlap  ['əuvə'læp]   
    n. 重叠,重复
    v. 重叠,重复

当我们处理confilcts时,我们首先执行下update,因为有些冲突是auto-mergealbe的(就是那些非overlap的修改);但是如果修改是overlap修改,那么必须手工进行merge。

alternatively  [ɔ:l'tə:nə,tivli]    替代地; 另一种办法。

 

Alternatively, conflicts can be handled using a Compare editor.  (通过Compare Editor进行处理,也就是update了  

 

A Compare editor can be opened by double-clicking (or single-clicking if you have change your open strategy in the preferences) on the conflict or by choosing Open in Compare Editor from the context menu. The Compare editor allows you to manually resolve the conflicts in the file. Once completed, perform a Mark as Merged on the conflict to indicate that you are done. This will change the conflict into an outgoing change.

注意: Compare Editor中我们只能编辑local file 不能编辑remote file;  当我们merge完毕后,我们执行 Mark as Merged on the conflict。 这样它就变成了outgoing changes。

 

 

 

 

 

 

 

分享到:
评论

相关推荐

    cvs 中文使用手册

    cvs中文手册,讲述基本的cvs概念,以及cvs服务的搭建等.

    WinCVS从入门到精通

    的工作方式和工作流程、创建Cvs 库的方法、导入Module 和Checkout 的操作。第 二章介绍了WinCvs 常用的版本控制操作,例如同步(Update)、 提交修改(Commit)、 添加/删除文件(目录)、查看文件版本历史沿革、比较...

    系统版本管理工具之wincvs从入门到精通1-3

    第一章介绍了CVS的基本概念、WinCvs的工作方式和工作流程、创建Cvs库的方法、导入Module和Checkout的操作。第二章介绍了WinCvs常用的版本控制操作,例如同步(Update)、提交修改(Commit)、添加/删除文件(目录)、...

    WinCvs从入门到精通

    第一章介绍了CVS的基本概念、WinCvs的工作方式和工作流程、创建Cvs库的方法、导入Module和Checkout的操作。第二章介绍了WinCvs常用的版本控制操作,例如同步(Update)、 提交修改(Commit)、添加/删除文件(目录)、...

    WinCvsGuide教程

    第一章介绍了CVS的基本概念、WinCvs的工作方式和工作流程、创建Cvs库的方法、导入Module和Checkout的操作。第二章介绍了WinCvs常用的版本控制操作,例如同步(Update)、提交修改(Commit)、添加/删除文件(目录)、...

    软件操作培训教程.pptx

    目 录 为什么需要使用配置管理软件 SVN相关的基本概念 TortoiseSVN的使用流程及图标说明 TortoiseSVN基本功能的介绍 Eclipse下SVN的使用 Visual Studio.Net下的SVN的使用 软件操作培训教程全文共60页,当前为第2页...

    ClearCase培训 配置管理工具 clearcase 概念 工作流程 日常操作 注意事项

    配置管理的重要意义在于维护文档的统一和可追溯性。尽管宏观的配置管理包括很多内容,但是我们最常用到的是对程序代码的版本控制,至于变更的控制、管理和通知这里不多介绍。下面将简要介绍国内几种常用的工具: ...CVS

    SVN服务器VS2005客户端part2

    CVS 没有任何关于 “移动” 操作的概念。它只能注意到,一个文件在一处被删除了,而在一个新位置创建了另外一个文件。由于它不会连接两个操作,因此也很容易使文件历史轨迹丢失。设置 CVS 存储库时,您必须非常谨慎...

    SVN服务器与VS2005客户端par1

    CVS 没有任何关于 “移动” 操作的概念。它只能注意到,一个文件在一处被删除了,而在一个新位置创建了另外一个文件。由于它不会连接两个操作,因此也很容易使文件历史轨迹丢失。设置 CVS 存储库时,您必须非常谨慎...

    Ant使用指南pdf

    全面的ant使用手册~!内容如下: · Ant 生成文件是如何构造的 ...· 模式匹配和选择器的基本概念,再加上如何从一个生成文件调用另一个生成文件,以及如何 执行 CVS 操作 · 如何通过编写 Java 类来扩展Ant 的标准功能

    unix平台下c语言高级编程指南

    内容简介回到顶部↑ 本书是专为在UNIX平台下用C语言编制程序的人写的。是以POSIX为标准,主要以C语言为基础,详细介绍了UNIX平台下编写各种应用程序的范例和方法。全书分四个部分,共十五章。...15.4 并发版本控制CVS

    SpringBatch批处理 刘相编

    基本篇重点讲述了数据批处理的核心概念、典型的作业配置、作业步配置,以及Spring Batch框架中经典的三步走策略:数据读、数据处理和数据写,详尽地介绍了如何对CVS格式文件、JSON格式文件、XML文件、数据库和JMS...

    svn学习,svn学习,svn相关信息

    三、基本操作 1.检出Check Out 2.提交Commit 3.解决冲突 4.标签Tag 四、分支与合并 1.版本库的概念 2.什么是分支? 3.使用分支 五、进阶 1.以后台服务方式启动 2.从CVS转换到SVN 六、附录 ...

    Java SE实践教程 源代码 下载

    Java SE实践教程 源代码 2010-9-...13.2.1 建立CVS的使用环境和基本操作 360 13.2.2 使用标记和分支 373 13.3 使用UML建模 376 13.3.1 对基本结构建模 376 13.3.2 对高级结构建模 381 13.4 小结 387 索引... 389

    Java SE实践教程 pdf格式电子书 下载(一) 更新

    感谢大家的支持,我终于升级了,上传限制得到...13.2.1 建立CVS的使用环境和基本操作 360 13.2.2 使用标记和分支 373 13.3 使用UML建模 376 13.3.1 对基本结构建模 376 13.3.2 对高级结构建模 381 13.4 小结 387

    Java SE实践教程 pdf格式电子书 下载(四) 更新

    感谢大家的支持,我终于升级了,上传限制得到...13.2.1 建立CVS的使用环境和基本操作 360 13.2.2 使用标记和分支 373 13.3 使用UML建模 376 13.3.1 对基本结构建模 376 13.3.2 对高级结构建模 381 13.4 小结 387

    Git-2.28.0-64-bit.rar

    Git 是一个快速、可扩展的分布式修订控制系统,具有异常丰富的命令集,可提供高级操作和对内部功能的完全访问。 有关有用的最小命令集,请参阅 gittutorial[7]以开始,然后查看 giteveryal[7]。Git 用户手册有更...

Global site tag (gtag.js) - Google Analytics