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

3

8

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?

Topmast answered 14/12, 2011 at 5:11 Comment(0)
D
5
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 .
Devitrify answered 24/4, 2015 at 7:3 Comment(0)
K
1

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
Kistler answered 14/12, 2011 at 6:35 Comment(5)
Hi, thanks for your respond but I would like to apply(mklabel) label and not create(mklbtype) a new label.Topmast
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.Topmast
I managed to get my desired output if I use this command "cleartool ls -r -vis"Topmast
@user1096966: did you try cleartool find . -cview -vis -exec..., because you cannot add the -exec to a ls.Kistler
Yes, I cannot use exec if I use ls, but I cannot use cleartool find . -cview -vis too.Topmast
G
0

The doco is really clear about what is being labelled, in fact the first example shown in doco states that exactly...current view objects are labelled by default & currently selected versions (i.e. if in your view then label it, else not.)

....extract below from doco below (note: context and command and that label-type-selector pname is the last parameter...left blank below because resident in working dir)...

Example: •Create a label type named REL6. 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. cmd-context> mklbtype –nc REL6

Regards

Jim2

Gynaecocracy answered 22/2, 2012 at 1:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.