Featured Post

Trie implementation in C

Clearcase CookBook


  • List views of a particular user 
cleartool lsview | grep "<your-clearcase-username>"


  • Open Clearcase explorer from a view's root(Useful when unable to open snapshot explorer)
clearexplorer .


  • List of all checked out files in a view/view's directory
cleartool lsco -me -recurse -cview -short


  • Graphical diff of a file with it's predecessor
cleartool diff -pred -g <file-name>


  • Graphical version tree of a file
cleartool lsvtree -g <file-name>


  • Print Findmerge results from a particular branch [Use -unr for unreserved checkout]
cleartool findmerge . -fver .../<branch-name>/LATEST [-unr] -print


  • Do a merge from a particular branch [Use -unr for unreserved checkout]
cleartool findmerge . -fver .../<branch-name>/LATEST [-unr] -merge


  • Find all files changed in a branch

cleartool find . -type f -branch "brtype(<branch-name>)" -print


  • Remove a branch type completely
cleartool rmtype –rmall –force brtype:BRANCH_TYPE_NAME


  • List all branch types created by a user
cleartool lstype -kind brtype -invob <vob-path> |grep <username>


  • List verbose branch types created by a user
cleartool describe -long vob:<vob-path> |grep <username>


  • Remove a view completely 
cleartool lsview -long <view-tag-name>
cleartool unregister -view -uuid <view-uuid>
cleartool rmtag -view <view-tag-name>
cleartool rmview -force -all -uuid <view-uuid>

I have made a bash script combining these commands. Remember to exit out of the view first before executing this script.
#!/bin/bash
#removeView.sh
USERNAME=$USER     #User can update this variable to statically point to particular user
UUID_LONG=`cleartool lsview -long $1`
#echo $UUID_LONG

CURVIEW=`cleartool pwv -s`

if [ $CURVIEW=$1 ]; then
    echo "Exit the view first"
    exit
fi

VIEWLIST=`cleartool lsview |grep $1`
#echo $VIEWLIST

VIEW_NAME=`cleartool lsview |grep $1|awk '{ print $(NF-1) }'`
echo $VIEW_NAME

if [ "$1" != "$VIEW_NAME" ];
then
    echo "View does not exist!"
    exit
else
    echo "View ($1) exists.. Going for removal.."
fi

UUID=`echo $UUID_LONG | grep -o -P '(?<=View uuid: ).*(?=View owner)'`
echo View UUID : $UUID

if [ -n "$UUID" ] 
then
    cleartool unregister -view -uuid $UUID
    cleartool rmtag -view $1
    cleartool rmview -force -all -uuid $UUID
    echo View $1 removed successfully.
else
    echo "UUID is empty!!!"
fi


  • Create a dynamic view 
cleartool mkview -tag <tag-name> -stgloc -auto

Comments