2016-09-13 29 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