2016-09-13 81 views
1

我正在寻找查询优化,但IBM在清晰的文档中对此不是很唠叨。 简而言之,我们有相当大的vob,并且我们想列出2个日期之间所做的所有更改,哪个查询是最快的,您是否看到有待改进?Cleartool命令性能:lshistory或找到-exec

方法1:

cleartool find -avobs -type f -element '(created_since(1-Jun-2016) &&     !created_since(1-Sep-2016)) 
&& (Element_Type==""Program"" || Element_Type==""Output"" || Element_Type==""Data"")' 
-ver 'created_since(1-Jun-2016) && !created_since(1-Sep-2016)' 
-exec 'cleartool describe -fmt ""#Name:%Xn Date:%Nd User:%u Label:%1.400Cl Attributes:%a Version:%Vn Comment:%Nc \n"" $CLEARCASE_XPN' 
>| test.txt 

方法2:

cleartool lshistory -avobs -since 1-Jun-2016 -fmt '#Name:%Xn Date:%Nd User:%u Label:%1.400Cl Attributes:%a Version:%Vn Comment:%Nc \n' -nco -pname >| test.txt 

谢谢!

回答

1

cleartool lshistory是关于事件记录,minors ones can be scrubbed。它提供了更少的过滤选项,这意味着您可以获得所有内容,然后自行应用过滤器(grep

通常,cleartool find可以更快,因为您可以添加标准以优化搜索。

从 “Additional examples of the cleartool find command”,才能看到所有改变(不只是在单元级的作品,但是变化,在版本级别),查询是:

cleartool find . -version "{created_since(date1) && !created_since(date2)}" 

-print

,您可以添加的事实:

  • type f(你只想要的文件,不是文件夹)
  • 任何其他标准(注:我没有看到“ELEMENT_TYPE”在query_language

这些将有助于加快查询。


OP M4hd1增加in the comments

基于您的评论,我改变了查询到:

cleartool find -avobs -type f -element '(attr_sub(Element_Type,==,"Output"))' -ver 'created_since(1-Jun-2016) && !created_since(1-Sep-2016)' -exec 'cleartool describe -fmt ""#Name:%Xn Date:%Nd User:%u Label:%1.400Cl Attributes:%a Version:%Vn Comment:%Nc \n"" $CLEARCASE_XPN' >| test.txt 

在多条线路:

cleartool find -avobs -type f -element '(attr_sub(Element_Type,==,"Output"))' \ 
    -ver 'created_since(1-Jun-2016) && !created_since(1-Sep-2016)' \ 
    -exec 'cleartool describe -fmt ""#Name:%Xn Date:%Nd User:%u Label:%1.400Cl Attributes:%a Version:%Vn Comment:%Nc \n"" $CLEARCASE_XPN' \ 
>| test.txt 
+0

谢谢您的帮助!根据你的评论,我改变了查询:cleartool find -avobs -type f -element'(attr_sub(Element_Type,==,“Output”))'-ver'created_since(2016年6月1日)&&!created_since 2016年1月1日)' -exec'cleartool describe -fmt“”#Name:%Xn Date:%Nd用户:%u标签:%1.400Cl属性:%a版本:%Vn评论:%Nc \ n“ “$ CLEARCASE_XPN' > | test.txt – M4hd1Pro

+0

@ M4hd1干得好!我已将您的评论纳入答案中,以获得更多的知名度。 – VonC