Paul
Paul

Reputation: 163

Set label on latest element in a branch

I have been working on a branch B1. There are several elements checked in on this branch. Now I want to put, or move if already labelled, label L1 on all latest versions on this branch.

How can I achieve this?

Upvotes: 1

Views: 1324

Answers (1)

VonC
VonC

Reputation: 1323653

Basically, you need all elements (files or folders)

  • whose one of their versions have a label LB1,
  • but whose current visible version is not labelled LB1,
  • and then move LB1 to that visible version.

For that:

 cleartool find -cview -element "{lbtype_sub(LB1)}" \
                       -version "{!lbtype(LB1)}
                -exec "cleartool mklabel –replace REL3 \"%CLEARCASE_XPN%\""

Note the difference between:

lbtype (label-type-name)

In all cases, TRUE if the object itself is labeled label-type-name. (Because elements and branches cannot have labels, this primitive can be true only for versions.)

lbtype_sub (label-type-name):

With elements, TRUE if the element has a version that is labeled label-type-name.


The OP Paul confirms in the comments the following command is working:

cleartool find . -cview -elem "lbtype_sub(L1)" -exec "cmd /c cleartool mklabel -rep L1 %CLEARCASE_XPN%" 

My config spec must be set to view the latest version in branch B1

Upvotes: 1

Related Questions