How do I list Clearcase versions without the Fully-qualified verison?

旧街凉风 提交于 2019-12-24 11:07:21

问题


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.


回答1:


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




回答2:


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.



来源:https://stackoverflow.com/questions/2806024/how-do-i-list-clearcase-versions-without-the-fully-qualified-verison

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!