`
eyesmore
  • 浏览: 376116 次
  • 性别: 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 for windows

    【Cvs for Windows】是一种版本控制系统,用于管理软件项目的源代码。Cvs(Concurrent Versions System)...为了充分利用这个工具,开发者需要了解基本的Cvs概念和操作,同时参考提供的文档来解决可能出现的疑难问题。

    CVS使用和安装

    **CVS的基本概念** 1. **版本控制**:CVS通过创建文件的不同版本来实现版本控制,每个版本都有一个唯一的标识符,可以随时切换查看。 2. **仓库**:CVS仓库是存储所有项目文件的地方,通常在服务器上,所有团队...

    CVS原理及其操作配置

    ### CVS原理及其操作配置 #### 一、CVS基本原理 **CVS**(Concurrent Versions System)是一种源代码版本控制系统,主要用于管理软件项目的多个版本。...理解这些基本概念和操作方式对于有效使用CVS系统至关重要。

    CVS中文操作手册

    以下是对CVS的一些核心概念和常用操作的详细说明: 1. **CVS基础**:CVS是一个分布式系统,它允许多个开发者在不同的位置同时工作,并能够合并他们的修改。每个开发者都有自己的工作副本,可以独立修改,然后将更改...

    CVS安装程序和指导手册

    学习和理解CVS的工作原理和使用方法,对于理解现代版本控制概念以及协作开发的流程有着重要的意义。通过阅读提供的"CVS安装程序和课件",你可以深入了解CVS的安装和使用,从而更好地利用这个工具进行团队开发。

    cvs 中文使用手册

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

    CVS客户端工具TortoiseCVS

    **CVS基础概念** 1. **版本控制**:版本控制系统记录了文件和目录的历史更改,允许用户回溯到之前的任何版本,同时支持多人协作,避免了文件冲突。 2. **仓库(Repository)**:CVS中的中央存储库,保存所有文件的...

    cvs服务端及视频文本资料

    文本资料则可能包含了更深入的CVS概念和使用指南,例如CVS的工作原理,CVS关键字扩展,以及与IDE(集成开发环境)的集成方法。这些文档可能会详细解释如何设置CVS客户端,使用`cvs checkout`, `cvs commit`, `cvs ...

    cvsnt-2.5.03和CVS操作实例

    在本文中,我们将深入探讨cvsnt-2.5.03和CVS的基本概念、操作步骤以及实践案例。 1. **CVS与cvsnt的区别** CVS是开源的,最初为Unix系统设计,但后来也支持其他操作系统。cvsnt是CVS的一个Windows优化版本,它...

    cvs 文档的操作集合

    总的来说,这个压缩包提供了学习和使用CVS的机会,同时也提供了一个实用的Java库,可以帮助开发者在Java项目中实现更高效的版本控制操作。无论是对CVS的基础知识,还是对Java库的使用,都可以从这个资源中获益。通过...

    CVS安装工具-TortoiseCVS

    3. **日常开发**:在工作副本中编辑文件,使用TortoiseCVS菜单进行提交和更新操作。 4. **解决冲突**:如果出现冲突,通过TortoiseCVS的冲突解决工具进行处理。 5. **分支管理**:根据需要创建和合并分支,灵活应对...

    cvs工具中文使用手册

    **CVS(Concurrent Versions System)工具...通过熟练掌握CVS的基本操作和概念,可以更高效地进行软件开发,确保团队合作的顺利进行。在实际工作中,结合使用CVS中文使用手册,将有助于快速理解和应用CVS的各种功能。

    CVS教程及学习笔记

    在本教程中,你将学习到关于CVS的基本概念和操作,包括: 1. **安装与配置**:CVS的安装过程通常包括获取CVS服务器和客户端软件,如wincvs。在Windows环境下,wincvs是一个流行的图形用户界面,使CVS的使用更为直观...

    CVS的使用及其相关内容 CVS的使用及其相关内容

    "CVS的使用.pdf"和"cvs相关.pdf"可能是关于CVS的教程或参考手册,它们可能涵盖了CVS的安装、配置、基本操作、高级特性及最佳实践等内容。通过深入阅读这些资料,可以全面掌握CVS的使用,提高团队的开发效率和代码...

    CVS中文使用手册PDF

    2. **安装与配置**:如何在不同的操作系统上安装CVS客户端和服务器,以及配置相关环境变量和CVSROOT。 3. **创建项目**:学习如何创建一个新的CVS仓库,导入项目到仓库,并设置权限。 4. **版本控制操作**:掌握`...

    cvs的简介,CVS的用处

    CVS(Concurrent ...尽管现代的版本控制系统如Git已经取代了CVS在许多场景下的应用,但CVS仍然是理解版本控制概念和工作原理的一个基础工具,尤其对于那些在早期就采用CVS的项目来说,它仍然是不可或缺的一部分。

    CVS使用手册大全(pdf)

    首先,"CVS.pdf"可能是一份基础的CVS介绍,涵盖了CVS的基本概念、安装步骤和基本操作。这份文档通常会讲解如何创建版本库,如何将文件添加到版本控制,以及如何进行版本的检出、提交、更新和差异比较。 "CVS的配置...

    Myeclipse与CVS配置

    4. **连接到CVS库**:在Myeclipse中,右键点击项目,选择“Team” -&gt; “Share Project...”,然后选择CVS,按照向导操作,连接到刚刚设置的CVS服务器和库。 5. **检出项目**:连接成功后,可以从CVS库中检出项目到...

Global site tag (gtag.js) - Google Analytics