Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cleartool: How to apply label to files which are in my current view only?

I could not find the proper command to apply a label to files which are in my current view. I have tried the following command:

cleartool mklabel -r TEST_LABEL /vob/test/a

However, the problem is that this command will apply the "Test_Label" label to every files in the "vob/test/a" directories regardless of whether the files are in my current view.
Is there any command to apply label only to the files listed in my current view?

like image 245
user1096966 Avatar asked Dec 14 '11 05:12

user1096966


2 Answers

cleartool mklabel  -r(ecurse) LABEL_NAME <directory name>

This command will apply LABEL_NAME to all files in folder and below of your view, you can just go to that directory,then type following command to create and apply label

> cd /vob/test/a
> cleartool mklbtype –nc TEST_LABEL 
> cleartool mklabel  -r TEST_LABEL .
like image 70
shijq73 Avatar answered Sep 24 '22 14:09

shijq73


The mklabel documentation state states, as to what version is labeled:

Processes the entire subtree of each pname that is a directory element (including pname itself). VOB symbolic links are not traversed during the recursive descent into the subtree.

One example mentions:

Attach that label to the version of the current directory selected by your view, and to the currently selected version of each element in and below the current directory.


Now, if you want to be really sure of the versions actually labelled, one solution is to use a find command, combined with your mklabel:

cleartool find . -cview -exec "cleartool mklabel TEST_LABEL \"%CLEARCASE_XPN%\""

If you had already that label applied to incorrect version and want to move it:

cleartool find . -cview -exec "cleartool mklabel -replace TEST_LABEL \"%CLEARCASE_XPN%\""

That way, you can first list the versions involved:

cleartool find . -cview -print

And then, if you agree with the output, apply the mklabel through the -exec directive.

The OP user1096966 reports making it work with a cleartool ls, to be sure to select only element visible in the current view:

cleartool ls -r -vis

The is no '-exec' directive, so a pipe might be involved, as in (not tested, but you get the idea):

cleartool ls -r -vis -s -nxn | xargs cleartool mklabel -replace TEST_LABEL
like image 20
VonC Avatar answered Sep 22 '22 14:09

VonC