Beruflich Dokumente
Kultur Dokumente
Topics
Objectives............................................................................................................ 7-2
Branching............................................................................................................. 7-3
Why Branch? ....................................................................................................... 7-5
Types of Branches: Integration Branches............................................................... 7-6
Viewing Branch Types ........................................................................................ 7-13
Creating Branch Instances Using the Config Spec ................................................ 7-14
Multiple-Level Auto-Branching ........................................................................... 7-15
Merging an Unreserved Checkout....................................................................... 7-19
Selective Merge.................................................................................................. 7-21
Subtractive Merge .............................................................................................. 7-23
Merging Non-ClearCase Files.............................................................................. 7-25
Objectives
Objectives
Upon completing this module, you should be able to:
Discuss when it is advantageous to branch
List common branch types and explain when
you might use them
Perform advanced merges
Merge and compare non-ClearCase files
Branching
Topics
Branching
Branching — review
Why branch?
Types of branches
Instantiating branch types
Merging
Performing special types of merges
• Unreserved checkout
• Selective merge
• Subtractive merge
Merging and comparing non-ClearCase files
Branching: Review
Branching: Review
Branching is a technique to isolate change and
enable parallel development
Branching controls the public and private nature of
work
Branch only when you want to make changes
Typically, parallel branches are eventually merged
into a resulting product
Configuration managers, ClearCase administrators,
or project leads typically define the organization
branching and merging policies
Branching is the ClearCase mechanism that enables parallel development and allows
you to control the public and private nature of development work. Eventually, the
changes made on parallel branches are merged to create a product. In general, the
configuration manager, ClearCase administrator, or project lead makes branching and
merging policies for an organization.
Branches are used for specific tasks — such as fixing defects, prototyping new
functionality, or promoting reliability — and are created only for artifacts that are
changed as part of that task.
Why Branch?
Why Branch?
When you need project level parallel development of
a common base (ports, spin-offs)
When you want to isolate aspects of the product’s
evolution (release area, patch area, development
area)
When you work on a long-range task and want to
save and baseline your own work (private branches)
When you are working on a new feature and don’t
want to have an impact on other developers
When you need to organize your work by location for
use with ClearCase MultiSite
5
In general, you should branch when you need to make changes, but want to isolate
those changes from other development efforts.
List some reasons to branch:
•
The project branch is a common use of an integration branch. Project branches can be
used for each separate releasable product. All development for a particular project
occurs only on that project branch.
In simple environments, it may be sufficient to have a single project branch.
For example, a project needs to port a product to Windows NT, but doesn’t want that
work to be on /main because it might interfere with other development. The project
leader can create a project branch for the Windows NT porting work.
Release branches are designated for official releases of the product. Merging the final
deliverable versions to a release branch allows you to easily diff changes among
releases.
In some cases, you may want to isolate work on a new feature from the main line of
development. In that case, you can create a feature branch. One or more developers
can work directly on a feature branch. Eventually, the feature branch can be merged
back into the project integration area.
10
The most common use for maintenance branches are bug fixes. Bug fix branches can
generate patch versions and may evolve into patch release versions. They can be also
be merged into other release branches. For example, work on r1_bugfix may
eventually need to be merged into the r2_int branch.
11
MultiSite Branches
MultiSite Branches
ClearCase MultiSite replicates and synchronizes
VOBs across distant sites
Branches support parallel development across sites
Branches are ‘mastered’ by individual sites
Some integration may
occur at replicated sites
One site is usually
responsible for ‘release’
branch
12
When you are using MultiSite, each branch is mastered by one site. Each site must have
its own branch. Each site may modify only branches that it masters.
13
Typically, ClearCase administrators or project leads define branch types. For the most
part, developers create instances of existing branch types.
To see a list of existing branch types, use the Branch Type Browser. You can access the
Branch Type Browser by clicking Admin > Branch type.
CLI Procedure
Usage:
cleartool lstype –kind brtype
Example:
cleartool lstype -kind brtype
20-Jan.17:32 alex branch type "bug_404"
20-Jan.14:00 pat branch type "main"
"Predefined branch type used to represent the main branch of
elements."
20-Jan.17:17 pat branch type "rel2_bugfix"
"branch to isolate bugfix work from the REL2 baseline."
14
Multiple-Level Auto-Branching
Multiple-Level Auto-Branching
A config spec can include a “cascade” of
-mkbranch rules:
element * CHECKEDOUT
element * /main/r2_int/pat_r2/LATEST
element * /main/r2_int/LATEST -mkbranch pat_r2
element * R1 -mkbranch r2_int
15
16
Rules 3 and 4 in this config spec are not evaluated again for this element; however,
they are used on other elements when they are checked out, ensuring a consistent
branch structure for all elements.
17
Topics
Topics
Branching
Branching — review
Why branch?
Types of branches
Instantiating branch types
Merging
Performing special types of merges
• Unreserved checkout
• Selective merge
• Subtractive merge
Merging/comparing non-ClearCase files
18
19
Earlier in this course, you learned about unreserved checkouts. If you want to check in
an unreserved checkout, but successor versions have been created since you checked
out, then you must merge your check out with the LATEST version before you can
check in.
ClearCase prompts you to merge changes if there are successor versions.
CLI Procedure
Usage:
cleartool merge { -out output-pname | -to contrib-&-result-pname }
Example:
Merge the latest version on the main branch to the unreserved checkout selected in this
view:
cleartool merge -to new.cpp -version /main/LATEST
20
Selective Merge
Selective Merge
Selects changes from
specific versions from a
branch to merge
Use the –insert option with
merge command
No merge arrow in Version
Tree Browser
21
You can only perform a selective merge from the command line.
CLI Procedure
Example:
cleartool checkout hello.c
cleartool merge -to hello.c -insert
-version /main/branch/4
You can also specify a range of versions. For example, to merge data from version 3
through 5 (inclusive) along the branch:
cleartool merge -to hello.c -insert
-version /main/branch/3 /main/branch/5
The version to be merged to must be checked out prior to issuing the cleartool merge
command.
22
Procedure
Before you start the merge you must:
1. Prepare a destination view. Your view must select the target version, LATEST on
the branch that will contain the results of the merge.
2. Check out the target version.
To start the merge:
cleartool merge -to hello.c –insert -version
/main/r1_bugfix/3
Note: selective merges are not indicated by merge arrows in the Version Tree Browser.
Subtractive Merge
Subtractive Merge
Removes changes made in one
or more of its predecessors from
a checked-out version
The –delete option indicates the
version or range of versions to
subtract
No merge arrow in Version Tree
Browser
23
You can only perform a subtractive merge from the command line.
To subtract a single version, you need only specify the version ID.
CLI Procedure
Example:
cleartool checkout hello.c
cleartool merge -to hello.c -delete -version /main/5 /main/6
24
25
You can explicitly specify a base contributor if you want the merge to be automatic
rather than manual.
26
Module Review
Module Review
Why might you want to create a branch?
How do you know what branch types are available?
What is the recommended way to create branch
instances?
What do you do if you want to check in an
unreserved checkout, but there are successor
versions?
What is a selective merge? Why would you perform
one?
What is a subtractive merge? Why would you
perform one?
27
Module Lab
Module Lab
In this lab, you perform the following tasks:
Use the ClearCase GUI to view branch types
Perform a selective merge
Use the command line interface to
• Compare and merge non-ClearCase files
• Perform a subtractive merge
28