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

26,667

Solution 1

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 .

Solution 2

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
Share:
26,667
user1096966
Author by

user1096966

Updated on October 31, 2020

Comments

  • user1096966
    user1096966 over 3 years

    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?

  • user1096966
    user1096966 over 12 years
    Hi, thanks for your respond but I would like to apply(mklabel) label and not create(mklbtype) a new label.
  • user1096966
    user1096966 over 12 years
    I have just tried "cleartool find . -cview -print" but the output is not what I want. The output displayed other directory that is not visible in my current view. Thanks for your help, I will try to get the correct output first.
  • user1096966
    user1096966 over 12 years
    I managed to get my desired output if I use this command "cleartool ls -r -vis"
  • VonC
    VonC over 12 years
    @user1096966: did you try cleartool find . -cview -vis -exec..., because you cannot add the -exec to a ls.
  • user1096966
    user1096966 over 12 years
    Yes, I cannot use exec if I use ls, but I cannot use cleartool find . -cview -vis too.