Search code examples
version-controlclearcase

How to clone a ClearCase label type?


Could we clone or copy a already existed ClearCase label type?

In past, we labeled our source code with name OLD_LABEL. Then we do a lot of branching and labeling.

X:\myvob1\code>cleartool lsvtree README
README@@\main
README@@\main\1 (DEV_LABEL2, DEV_LABEL1,OLD_LABEL,DEV_TEST...)
README@@\main\dev_4.0

Now, could we clone the OLD_LABEL to a new one like NEW_LABEL instead of renaming the OLD_LABEL?

X:\myvob1\code>cleartool lsvtree README
README@@\main
README@@\main\1 (DEV_LABEL2, DEV_LABEL1,NEW_LABEL,OLD_LABEL,DEV_TEST...)
README@@\main\dev_4.0

I tried the cleartool cptype but the NEW_LABEL does not appear.

I know that we can rename the OLD_LABEL to NEW_LABEL with cleartool rename. But we also want to keep the OLD_LABEL.


Solution

  • You can simply apply NEW_LABEL on all versions which have OLD_LABEL.
    No need to clone.

    A simple cleartool find is enough, using the query language

    For visible files in a view:

    cleartool find . -version 'lbtype(OLD_LABEL)' -exec 'cleartool mklabel NEW_LABEL "$CLEARCASE_XPN"'
    

    For all files:

    cleartool find -all -element 'lbtype_sub(OLD_LABEL)' -version 'lbtype(OLD_LABEL)' -exec 'cleartool mklabel NEW_LABEL "$CLEARCASE_XPN"'