以下文字引自 Essential CVS,
待翻译
This section explains the basis of branching strategies and the two main philosophies of branching. It also provides some answers to the question of when and why you should branch on a project.
Branching Philosophies
The general rule of thumb for branching is: keep the main line of development on the trunk; everything else can be branched. The problem is determining the main line of development. Should the trunk contain stable code or unstable code? Should each release be branched when it goes to be tested? Should new features be developed on the trunk or on a branch?
These decisions all stem from two distinct definitions of "the main line of development." These two definitions result in two different branching philosophies, which can be termed basically stable and basically unstable.
Basically stable
The basically stable branching philosophy states that the trunk should contain project data that is always close to being ready for release. Branches are used for development, bug fixes, prerelease QA (quality assurance), and refactoring. Branches are also used for experimental code.
The strictest variation of this philosophy states that nothing should be merged to the trunk until it has been through QA. This ensures that at any time a release candidate can be taken from the trunk, put through a small amount of QA, and then published or sold.
More lenient variations of this philosophy allow anything that passes developer unit-testing to be merged into the trunk. Such a relaxed approach requires a release candidate to be branched off and put through a full QA analysis before publication.
Advantages of the basically stable method include the following:
You can take a release off the trunk at any time, run it through QA, and publish it.
Because the trunk contains stable code that changes slowly, you can perform experimental work on a branch with little likelihood of causing errors in someone else's work when the branch is merged back into the trunk.
The greatest disadvantage of the basically stable philosophy is that merging usually gets done by a QA tester rather than by a person who understands the semantics of the code being merged. Also, the trunk may change significantly between the original time a branch was split off from it and the time the branch is merged back. Both of these problems can be reduced by having the developer merge the trunk to the branch periodically, or by using a less strict variation.
Basically unstable
The basically unstable philosophy states that the trunk should contain the latest code, regardless of its stability, and that release candidates should be branched off for QA.
The strictest variation states that all development takes place on the trunk and branches are used only for release candidates, bugfix branches, and releases.
More lenient variations also allow branching for experimental code, refactoring, and other special-case code. Merging of a branch back into the trunk is done by the managers of the branch.
The advantage of this philosophy is that merging doesn't happen often and is easier to do because it is usually done by people familiar with the code.
The disadvantage of this philosophy, especially when applied in its strictest form, is that the main trunk often contains buggy code, experimental work, and sometimes code that doesn't compile at all. Frequent tagging can reduce this disadvantage, so tag every time there's good code or whenever someone starts to experiment or refactor. The more lenient variations keep the buggiest code and the code most likely to cause significant breakage off the trunk, reducing the time it takes to prepare a release for publication.
Branch Styles
CVS includes code to create and use branches, but it doesn't enforce any particular technique for using them. This section explains several styles for using branches.
In this section, the term long branch is used to mean either ongoing branches or branches that merge several times and then are no longer used. A short branch is a branch that is merged back to the trunk once and never again used.
CVS permits a branch to be activated again at any time; it has no way of saying a branch is no longer valid. Ending a branch is done simply by telling all developers that it will never again be used for active development.
Long branch, merging to branch
An ongoing branch for which the trunk merges repeatedly to the branch is useful for situations in which the trunk should not be affected by changes in the branch, but the branch needs changes from the trunk. Mirror web sites may use this method. See Figure 4-6 for an illustration of how this method works.
Long branch, merging to trunk
An ongoing branch that merges repeatedly to the trunk is useful in situations in which the branch should not be affected by ongoing trunk development, but the trunk needs changes made in the branch. Any situation in which a branch is being tested and prepared for publication can use this branch style. Projects that are in testing can use this method, putting the content that is being tested on the branch and merging corrections back to the trunk. See Figure 4-7.
Long branch, merging both trunk and branch
A long branch that merges in both directions ensures that changes from the branch are integrated to the trunk and that changes in the trunk are integrated into the branch. If the developers working on the branch are doing ongoing development of unstable code, the branch can be merged back to the trunk when each stage is completed, and the branch can be synchronized with changes from the trunk whenever the branch developers are prepared to merge those changes. This method can be useful when mature code is being rewritten one section at a time, while new features are being added on the trunk. See Figure 4-8.
Short branches
A short branch can be a standalone branch used for a simple change. If you want to add a single feature, write experimental code, or prepare for a release, a short, single-purpose branch may be ideal.
You can also use a series of short branches to simulate a long branch merged to and from the trunk. By using a series of short branches, you avoid having to merge branch changes to the trunk and then trunk changes to the branch. Instead, you merge changes from a branch to the trunk, and then start a new branch from the trunk. This method may be useful when both the trunk and the branch have significant changes. See Figure 4-9.
Nested branches
CVS permits you to create branches off of branches. You then treat the root branch as a trunk and manage the subbranch using any of the branch styles discussed in the preceding sections. Nested branches are most useful when using CVS for configuration management. Minimize the nesting complexity to reduce confusion.
If you are writing a new set of features on a branch and need to give a feature to a tester while you continue to work on the branch, you can create a test branch off your feature branch. Figure 4-10 shows a set of nested branches off a trunk.
Branch Policies
Consistent policies can help ensure that branching assists your project. Without consistent rules, you may end up with a mess of branches that are difficult to keep track of.
Having and using consistent policies can also help you keep merging as simple as possible. Minimizing the amount of merging requires communication between the developers working on the branch and those working on the trunk.
Develop policies that work for your projects and your team. The following policies are ones that my coworkers and I have found useful:
Have an overall design for the project.
Ensure that each branch has a definite purpose and minimize the number of currently active branches.
Minimize the complexity of your branching scheme. CVS permits nested branches, but there are few situations where multiple layers of nesting help a project.
Use a consistent branch-naming scheme that expresses the purpose of each branch.
Be aware of semantic differences between a branch and the trunk; good design and good communication can reduce these differences.
An example of semantic difference is when a developer has changed the number (or worse, the order) of parameters in a function and other developers call the function with the old parameters.
Avoid binary files where possible, to allow CVS to merge files automatically.
Merge back frequently; the fewer changes there are to the trunk, the easier they are to merge.
Tag the branch at every merge point, so you can avoid merging the same changes twice.
Tag the trunk at every branch point and just before and after every merge, in case you need to retrieve the trunk state at that time.
Use consistent tag-naming schemes for the tags associated with the branches.
分享到:
相关推荐
8. **分支创建(Branching)**:创建新的开发分支。 **TortoiseCVS使用流程** 1. **安装与配置**:下载并安装TortoiseCVS,设置CVS服务器地址、用户信息等。 2. **连接版本库**:通过资源管理器访问CVS服务器,检...
6. **分支与合并(Branching and Merging)**:需要时创建分支,完成特定任务后再合并回主线。 7. **标签(Tagging)**:在关键节点如发布版本时,使用`cvs tag`为当前状态打上标签。 ### 注意事项 使用CVS时,应...
- **分支管理** (`Branching`): 创建代码的不同版本线,便于独立开发和测试新功能。 - **标签使用** (`Tagging`): 为特定版本的代码打上标签,方便日后查找和引用。 #### 三、实践案例分析 为了更好地理解和应用...
1. **分支(Branching)**:支持创建平行的开发线路,允许独立的开发工作而不会影响主线。 2. **标签(Tagging)**:标记特定版本,如发布版本,便于回溯。 3. **模块(Modules)**:组织项目中的不同部分,便于管理...
**分支(Branching)**是CVS中一个非常重要的概念,它允许开发者在不影响主干(trunk)的情况下进行开发测试。 1. **创建分支:** - 在CVS中创建分支: ```bash cvs tag -b branch_name ``` - 其中`branch_...
第三章《WinCVS从入门到精通第三章.pdf》可能涉及更高级的主题,如解决冲突、标签(Tagging)和分支(Branching)。在多人协作的环境中,冲突是常有的事,理解如何处理冲突是至关重要的。标签和分支则提供了灵活的...
7. **Tagging and Branching**:标记和分支功能,允许用户创建特定时间点的快照或独立的开发路径。 #### 三、搭建与配置CVS ##### 搭建CVS服务端 1. **安装CVS服务端软件**: - 在Linux环境下可以通过包管理器如...
- **分支与合并 (Branching and merging)**:在开发过程中,可能会出现需要同时开发多个特性或修复的情况。此时,可以创建分支(branch)来进行独立开发,待开发完成后,再将其合并(merge)回主干。 - **递归行为 ...
- **分支(Branching)**:创建项目的不同版本用于平行开发。 - **合并(Merging)**:将一个分支的更改合并到另一个分支。 通过这些基本和高级操作,开发人员可以高效地利用CVS进行项目版本控制和团队协作。...
CVS支持多用户同时对同一代码库进行修改,通过版本分支(Branching)和合并(Merging)策略,确保项目在并行开发过程中的协同工作。 CVS具有以下重要功能: 1. 版本控制:记录文件的每次修改历史,可以查看历史...
书中还会深入讲解分支(branching)和标签(tagging)的概念。分支是一种机制,允许开发者在不影响主代码行(主线)的情况下,独立地工作于特定功能或修复。标签则用于标记代码库中的一个点,通常用于标记软件发布的...
5. **分支和标签(Branching and Tagging)**:WinCVS支持创建分支,允许开发团队在不影响主线开发的情况下进行实验性开发。标签则用于标记项目的重要状态,例如发布版本。 6. **冲突解决**:当多个人修改同一文件...
在传统的版本控制系统如CVS或Subversion中,合并与分支操作被视为高风险且复杂的过程,常常被开发者们小心翼翼地避免,只在必要时才执行。然而,Git的出现彻底改变了这一局面。Git将合并与分支操作变得异常简单与...
6. **分支(Branching)**: 分支允许开发者在不影响主线开发的情况下,进行实验性或长期的工作。当分支上的工作完成后,可以合并回主线。 ### 四、WinCVS特色功能 1. **图形化界面**: WinCVS提供直观的GUI,使操作...
与传统的集中式版本控制系统(如CVS、SVN)不同,Git采用了分布式版本库的方式,每个开发者的工作站上都有一个完整的项目版本库,这意味着即使没有网络连接,也可以进行提交、更新等操作,并且在连接到网络时再与...
7. **分支和合并(Branching and Merging)**: - 分支允许开发人员在不影响主线(主分支)的情况下进行开发。`svn copy`创建分支,`svn merge`进行合并。 8. **标签(Tagging)**: - 标签是特定版本的一个快照...
Git is easy to learn and has a tiny ... It outclasses SCM tools like Subversion, CVS, Perforce, and ClearCase with features like cheap local branching, convenient staging areas, and multiple workflows.
SVN还支持轻量级的分支(Branching)和标记(Tagging)操作,这使得项目管理和并行开发变得更加高效。分支操作允许开发者在发布正式版本后继续在一个分支上开发新版本,而发现的Bug可以在主分支上修正,并将修正合并...
- **Advanced CVS Operations**: Advanced operations such as branching, merging, and resolving conflicts within Eclipse. **Chapter 7: Web Development Tools** - **HTML and CSS Editing**: Features for ...