Wednesday, October 15, 2008

Rational Clearcase: Some Useful Commands

Hi,
Rational Clearcase is perhaps the most popular version management software across various organizations. Here is my humble attempt to capture most useful commands that can save a lot of your time.

a) Creating an element
$cleartool mkelem -eltype{binary, directory etc.} elem_name

b) Creating many elements at once or say you want to convert your non-clearcase element as versioned.
- first copy & paste all such files/dir in a destination directory.
$find -type f/d |xargs cleartool mkelem eltype elem_name

b) Browsing files in your branch
$ct find ./ -branch 'brtype(_view_name)' -print

c) Soft Links
$cleartool ln -s target link_name

To update a link, remove it first($ cleartool rmname link_name), create a new link with same/different in a checked-out directory.

d) Merging changes in main branch
You have two options:
1. Use cleartool merge
2. Use diff/patch OR vimdiff

cleartool merge
---------------
- Checkout file with your changes.
- $cleartool merge -to file_with_your_changes -version main_branch_version

vimdiff
-------
Amazingly simple and useful.

- Checkout file with your changes.
- $vimdiff file_with_your_changes file_on_main_branch
- You can make out the changes which are maked with different colors.
- Look the file on right side pane, a red color signifies some change in the line
- Merge changes with :,+1 diffget
- Moreover you can use any vi command.

Hope these inputs would help people.

Thanks a lot!