Thursday, February 07, 2008

Some ClearCase Operations


Assumptions:

-- "cleartool" is in $PATH and aliased to "ct"
-- /admin-vob is the Unix path for special admin version object base (VOB)
-- "main_view" is a default view with the following config spec:

element * CHECKEDOUT
element * /main/LATEST

Operations:

# Creating a branch type that is available to all VOBS
# associated with the admin VOB

$ ct setview main_view
$ cd /admin-vob
$ ct mkbrtype -global -c "<comment>" <branch_name>

# Creating a label type that is available to all VOBS
# associated with the admin VOB

$ ct setview main_view
$ cd /admin-vob
$ ct mklbtype -global -c "<comment>" <label_name>

# Applying a label types to stuff recursively (already in a view):

$ ct mklabel -recurse -c "<comment>" <label_name> <start path>

# Applying a label type to an individual element (directory):

$ ct mklabel -c "A Directory" MY_LABEL /vob-at-hand/a/b/c/d

# Applying a label type to an individual element (file):

$ ct mklabel -c "A File" MY_LABEL /vob-at-hand/a/b/c/d/random.xml

# Locking a branch type that is available to all VOBS
# associated with the admin VOB

$ ct setview main_view
$ cd /admin-vob
$ ct lock -replace brtype:<branch_name_to_lock>

# Locking a label type that is available to all VOBS
# associated with the admin VOB

$ ct setview main_view
$ cd /admin-vob
$ ct lock -replace lbtype:<LABEL_TO_LOCK>
# Rename a branch type that is available to all VOBS
# associated with the admin VOB

$ ct setview main_view
$ cd /admin-vob
$ ct rename brtype:<src_branch_name> brtype:<tgt_branch_name>

# NOTE: Of course, any views that were looking for the old
branch tag need to have their config specs fixed.

# Rename a label type that is available to all VOBS
# associated with the admin VOB

$ ct setview main_view
$ cd /admin-vob
$ ct rename lbtype:<SRC_LABEL> lbtype:<TGT_LABEL>

# Create a ClearCase dynamic view in view storage.

$ cd /view-storage
$ umask 002
$ ct mkview -tag <view_name> <view_name>.vws

# Removing a ClearCase dynamic view:

$ cd /view-storage
$ ct rmview -force <view_tag.vws>

# NOTE: should ensure that there are no checkouts in view
# before removal.

# Listing the visible elements (sorted) from within a view:
$ ct ls -r -s -visible . | sort