tags:

views:

19

answers:

2

In Clearcase: I'm trying to find the names of all files in the current view without a specific label. So far I've come up with the following:

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

But this ends up displaying the filenames with the "@@/main/BRANCH1/SUBBRANCH" appended to the end, and I really want just the filename.

I've tried adding a -short, but the find command doesn't like that option, and I can't find an option in the manuals to change the behavior.

A: 

You can combine the find with a exec directive if needed (test both):

cleartool find -cview -all -element '\!lbtype_sub(LABEL_1)' -print

cleartool find -cview -all -element '\!lbtype_sub(LABEL_1)' -exec 'cleartool descr -fmt "%En\n" "$CLEARCASE_PN"'

Notes:

  • Unix syntax
  • -element '\!lbtype_sub(LABEL_1)' looks for all the elements (files) with no version with a certain label (hence the _sub associated with the lbtype query)
  • fmt is a fmt_ccase directive for the describe command.
  • "%En": Element name: For a file system object, its standard file or element name, or its path name; for a type object, its name.
  • "$CLEARCASE_PN" is between double-quotes because it may have spaces in its pathname/filename.

As noted in the OP's own answer (Luciano), if you don't need to see all elements (included deleted ones), but only elements currently visible in the view, -nxname is enough:

cleartool find -cview -nxn -element '\!lbtype_sub(LABEL_1)' -print

I still use -element instead of -version, because it is much faster and avoid useless duplicates.

VonC
A: 

Found it:

–nxname
Removes the extended naming symbol (by default, @@) and any subsequent version ID or branch pathname from the name of each selected object. Duplicate names that result from this transformation are suppressed. In effect, this option transforms extended names into standard operating system names; it also transforms names of branches or versions into names of elements.

So

 cleartool find . -cview -nxn -version '\!lbtype_sub(LABEL_1)' -print

prints all files in the current view & directory (and subdirectories) without the label LABEL_1

Luciano
I still recommend making a query at the element level, not the version level.
VonC