Search code examples
clearcasecleartool

Find Objects that have not a label in any version


I want to find objects that have not got a LABEL in any version.

I can check if any object has a LABEL in its LATEST version with following command :

cleartool find .  -version "version(/main/LATEST) && !lbtype(MYLABEL)" -print

And this command also lists all versions :

cleartool find .  -version "!lbtype(MYLABEL)" -print

I want the object list that has not got label (MYLABEL) in any versions. How can I do this?


Solution

  • You can first try looking for elements instead (with the lbtype_sub query primitive):

    cleartool find .  -ele "!lbtype_sub(MYLABEL)" -print
    

    See "Additional examples of the cleartool find command"

    About *_sub query primitives

    When using the ClearCase find command in what circumstances should the *_sub query primitives (attype_sub, label_sub and attr_sub) be used instead of just lbtype or attype?

    When the type being queried does not apply to the "level" (-element -branch -version) being queried.
    For example, query for a label using -element: labels are only on versions within elements

    (you can limit to files only with -type f, or folders only with with -type -d)


    If that does not work would recommend a three steps process.

    • find all the elements (file or folder) that have one version with that label
    • find all the elements
    • remove the first elements from the second list

    The end result is what you are looking for.