ClearCase: how to find items that don't have a specific label

I am looking for a ClearCase command that will display all the elements that are visible in my current view, but DOES NOT have a specific label for them.

Say, for example, most of the elements that are visible in my view have applied LABEL_X to them. I want a list of those elements that do not have LABEL_X.

I obviously should use cleartool find , but the use and ClearCase help page is preventing me from building such a query.

+4
source share
3 answers

This should work:

 ct find -all -ele '! lbtype_sub(LABEL_X)' -print ct find -ele '! lbtype_sub(LABEL_X)' -print 

Notes:

  • ct means cleartool
  • Unix syntax here (for Windows, replace simple quotes with double quotes)
  • beware of the space between ! and lbtype_sub (in winodws you don't need space)
  • -ele it is very important to get only one occurrence of a given file (and not all different versions of a file that meet the criteria)

-ele restricts the search to elements rather than versions (which may lead to more results when using versions)

-all list all items included "deleted" (that is, "unreferenced"). The second line displays only visible elements (in the current view)

You must execute these two commands in a subdirectory of your choice within the given ClearCase (snapshot or dynamic view): all files inside this subdirectory (and subdirectories ...) corresponding to the sirteria will be in the list.

Warnings:

  • lists files and directories. If you want only files, add -type f to the request:

    ct find -type f -ele '! lbtype_sub (LABEL_X) '-print

  • what is displayed is the extended path for the items, that is, the file name followed by @@ .

To display only the name without @@ , use ' -nxn ' (without the extended path name)

 ct find -nxn -ele '!lbtype_sub(LABEL_X)' -print 

Another more complex but more complete way to list a name without @@ is to use descr -fmt . For instance:

 ct find . -ele "!lbtype_sub(LABEL_X)" -exec "cleartool descr -fmt \"%En %d\n\" \"%CLEARCASE_PN%\"" ct find . -ele '! lbtype_sub(LABEL_X)' -exec 'cleartool descr -fmt "%En %d\n" "$CLEARCASE_PN"' 

will give you (in windows or unix syntax) the date and name of files and directories not marked as LABEL_X.

With this descr -fmt display, you can combine any information and presentation you want to receive.

+3
source

The above works, but do not forget to specify -cview to get ONLY the current view, otherwise you will also get files from all other views.

+2
source

I needed to use the following in my Linux box cleanup program:

 cleartool find -cview -all -version '\!lbtype(LABEL_X)' -print 

VonC message syntax did not work properly with the "!" does not slip away.

+1
source

All Articles