ClearCase:如何找到没有特定标签的元素 [英] ClearCase: How to find elements that do NOT have a particular label
问题描述
我正在寻找一个ClearCase命令,它将列出在我当前视图中可见的所有元素,但是不会向其应用特定的标签。
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.
例如,在我的视图中可见的大多数元素都应用了 LABEL_X 。我想要一个没有 LABEL_X 的元素的列表。
Say for example, most of the elements that are visible in my view have LABEL_X applied to them. I want a list of those elements that do not have LABEL_X.
我显然需要使用 cleartool find
,但是使用和ClearCase手册在如何构造这样的查询方面给我留下了难题。
I obviously need to use cleartool find
, but the usage and ClearCase man page baffle me in terms of how to construct a query like this.
推荐答案
这应该工作:
ct find -all -ele '! lbtype_sub(LABEL_X)' -print
ct find -ele '! lbtype_sub(LABEL_X)' -print
注意:
- ct代表cleartool
- 此处的Unix语法(对于Windows,用双引号替换简单引号)
- 注意
!
和lbtype_sub
之间的空格(在winodws中,不需要空格) -
-ele
非常重要只获取一个给定文件的一次出现(而不是所有不同版本的文件匹配条件)
- ct stands for cleartool
- Unix syntax here (for windows, replace simple quotes with double quotes)
- beware of the space between
!
andlbtype_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
将搜索限制为元素,
-ele
limits the search to elements, not versions (that would trigger a lot more results with versions involved...)
-all
列出包括已删除(即未引用)的所有元素。
第二行仅列出当前视图中的可见元素
-all
list all elements included "deleted" (that is "unreferenced") ones.
The second line lists only visible elements (in the current view)
您应该在给定的ClearCase(快照或动态视图)内的所选子目录上执行这些第二个命令行:该子目录中的所有文件(以及子子目录...
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.
警告:
-
文件和目录。如果只需要文件,请在查询中添加
-type f
:
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
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 @@
.
只列出不含 @@
' -nxn
'(无扩展路径名选项)
To list only the name without @@
, use '-nxn
' (no extendedpathname option)
ct find -nxn -ele '!lbtype_sub(LABEL_X)' -print
另一个更复杂但也更完整的列表只有不带 @@
的名称是使用 descr -fmt
。例如:
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"'
会给你(在windows或unix语法中)未标记为LABEL_X的文件和目录的日期和名称。
would give you (in windows or unix syntax) the date and name of the files and directories not labeled LABEL_X.
使用 descr -fmt
显示,您可以将任何种类的信息和演示文稿
With that 'descr -fmt
' display, you can combine any kind of information and presentation you want for the result.
这篇关于ClearCase:如何找到没有特定标签的元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!