®
IBM Software Group
Essentials of Rational ClearCase Module 7: Integrating Parallel Development
1
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
2
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 3
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 4
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
Types of Branches: Integration Branches Branches designated for integrating development work Allows you to work on multiple development threads concurrently Examples include /main Project branches Release branches Feature branches
6
Integration Branch Example: Project Branch Branch used for each separate releasable product All development for a particular project occurs only on the project branch Can be just /main in simple environments
7
Integration Branch Example: Release Branch Branch designated for holding official releases of a product Facilitates tracking changes among releases Keeps version trees compact
8
Integration Branch Example: Feature Branch Branch designated for work on a specific feature Facilitates tracking the development of individual modules and integration of the modules into project development branches
9
Types of Branches: Maintenance Branches Branch to track bug fixes and integrate them into project or release branches Can generate patch versions Several maintenance efforts in parallel may require a maintenance Integration
10
Types of Branches: Developer Branches Branch designated for long-range or high-risk individual development Facilitates tracking the development of individual modules and integration of the modules into project and release branches
11
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
Viewing Branch Types
13
Creating Branch Instances Using the Config Spec Once a branch type exists, you can create instances of that branch type Preferred method of instantiating branch types is using the –mkbranch clause in the config spec The -mkbranch clause can be used to implement complex branching policies and to ensure consistent branching of elements
14
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
Check out continues to create branches until version zero on the new pat_r2 branch is created 15
Multiple-Level Auto-Branching (cont.) Rule 1: Rule 2: Rule 3: Rule 4:
element element element element
* * * *
CHECKEDOUT /main/r2_int/pat_r2/LATEST /main/r2_int/LATEST -mkbranch pat_r2 R1 -mkbranch r2_int
util.c after check out with the above config spec util.c before check out
16
Multi-Level Auto-Branching: Write Config Specs 1.
2.
17
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
Merging an Unreserved Checkout You cannot check in an unreserved checkout if there are successor versions The unreserved checkout must be merged with LATEST before you can check in
19
Merging an Unreserved Checkout (cont.) There are two checkouts: one reserved and one unreserved
After Alex checks in his reserved checkout
20
After Pat merges Alex’s changes into her version and checks in
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
Selective Merge: Example Scenario: Integrate bug fix changes of /r1_bugfix/3 into /r2 branch
22
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
Subtractive Merge: Example Scenario: The multi-thread algorithm implemented in element versions 2 and 3 contains a fatal flaw. How do you back out those changes, but retain subsequent good changes?
Back out only these changes
24
Merging Non-ClearCase Files Use the ClearCase Diff Merge tool to merge files not under ClearCase control Example: cleartool merge –out newfile.txt c:\file1.txt c:\file2.txt Use the Diff Merge tool to merge non-ClearCase files with ClearCase elements Example: X:\Hardware\src>cleartool merge -g -to util.c c:\file1.txt 25
Comparing Non-ClearCase Files Use the ClearCase Diff Merge tool to compare files not under ClearCase control Example: cleartool diff -g c:\file1.txt c:\file2.txt
Use the Diff Merge tool to compare non-ClearCase files with ClearCase elements Example: X:\Hardware\src>cleartool diff -g util.c c:\file1.txt
26
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 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