I need to apply a label on a set of two or more labels that are already created using cleartool. I know how to create and apply a label using cleartool and have studied mklabel
You could try and find all the relevant versions (the ones with the right labels) and perform a mklabel
.
cleartool find can be combined with an exec directive including a mklabel.
cleartool find . -ver "lbtype(LBL1) || lbtype(LBL2)" \
-exec "cleartool mklabel -replace NEW_LBL \"%CLEARCASE_XPN%\"
The tricks though are:
you need to list your labels from the oldest to the newest (here LBL2
must be created more recently than LBL1
) because you can mklabel
only one version per file: if a file has two different versions each labeled with one of your label, you want to end up with your new label on the most recent one. Hence the order in the find query.
you need the '-replace
' option of the mklabel
, because again, if two versions are found, the first mklabel
will work, the second won't unless the -replace
instructs it to move NEW_LBL
to the second version.