ClearCase delete view private files only

夙愿已清 提交于 2019-12-01 07:42:05

问题


Is there any was to delete only view private files in CC dynamic view. There are a bunch of eclipsed files and view private files in my view. I need to delete only view private files and retain checked-out and eclipsed files.

I tried following -

cleartool ls -r | grep -v eclipsed | grep -v checkedout | xargs rm -v

But looks like eclipsed files are listed twice with cleartool ls. So it deletes eclipsed files too :(

cleartool ls -r produces two outputs for an eclipsed file in dynamic view.

src.mk
src.mk@@ [eclipsed]

So deleting with cleartool ls -rec | grep -v "Rule:" | grep -v "eclipsed" | grep -v "-->" | xargs rm -v deletes eclipsed files too.


回答1:


You are right, none of those two soution would work:

 cleartool ls -rec | grep -v "Rule:" | grep -v "eclipsed" | grep -v "-->"  | xargs rm -v

    cleartool lsprivate | grep -v "eclipsed" | xargs rm -v

Source: my old answer at "Command to find all view private files in the current directory recursively".

An lsprivate alone lists eclipsed file like any other private file:

M:\yourDynView\yourVob\aDir\>ct lsprivate

M:\yourDynView\yourVob\aDir\aFile.vsd
M:\yourDynView\yourVob\aDir\aPrivateFile

But, an lsprivate -l list eclipsed file twice:

M:\yourDynView\YourVob>ct lsprivate -long

view private object    M:\yourDynView\yourVob\aDir\aFile.vsd
file element           M:\yourDynView\yourVob\aDir\aFile.vsd@@ [eclipsed]
view private object    M:\yourDynView\yourVob\aDir\aPrivateFile

So you need three passes

  • one to generate that cleartool lsprivate -l
  • one to remove any line above a line which contains eclipsed
  • one to read that file and delete the remaining private files listed in that file

The second step could be (loosely tested after this thread)

gawk "{if ((NR!=1)&&($0!~/eclipsed/)) {if ($lastlin!~/eclipsed/) {print astlin};lastlin=$0} } END{print lastlin} " s

With 's' the file containing the result of a cleartool lsprivate -l.



来源:https://stackoverflow.com/questions/15811574/clearcase-delete-view-private-files-only

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