ClearCase: How to find elements that do NOT have a particular label

前端 未结 3 985
终归单人心
终归单人心 2020-12-18 10:02

I\'m looking for a ClearCase command that will list all the elements that are visible in my current view, but do NOT have a particular label applied to them

相关标签:
3条回答
  • 2020-12-18 10:14

    Above works, but remember to specifiy -cview to get JUST the current view, otherwise you'll get files from all the other views as well.

    0 讨论(0)
  • 2020-12-18 10:24

    This should work:

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

    Notes:

    • ct stands for cleartool
    • Unix syntax here (for windows, replace simple quotes with double quotes)
    • beware of the space between ! and lbtype_sub (in winodws you do not need the space)
    • -ele very IMPORTANT to get only one occurrence of a given file (and not all the different versions of a file matching a criteria)

    -ele limits the search to elements, not versions (that would trigger a lot more results with versions involved...)

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

    You should execute those second command lines on the sub-directory of your choice within a given ClearCase (snapshot or dynamic view): all files within that sub-directory (and sub-sub directories...) matching the cirteria will be listed.

    Warnings:

    • files and directories are listed. If you want only files, add -type f to the query:

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

    • what is displayed is the extended path for elements, that is the name of the file followed with @@.

    To list only the name without @@, use '-nxn' (no extendedpathname option)

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

    Another more complex but also more complete way to list only the 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"'
    

    would give you (in windows or unix syntax) the date and name of the files and directories not labeled LABEL_X.

    With that 'descr -fmt' display, you can combine any kind of information and presentation you want for the result.

    0 讨论(0)
  • 2020-12-18 10:27

    I needed to use the following on my Linux clearcase install:

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

    The syntax from VonC's post did not work properly with the "!" not being escaped.

    0 讨论(0)
提交回复
热议问题