Command to delete branches of Clearcase element with “0” versions

 ̄綄美尐妖づ 提交于 2019-11-26 20:46:27

问题


What is the command in Clearcase to delete the branches of an element in which it is not modified (Element's version in that branch is "0") ?


回答1:


You can simply remove the version 0 of that element (that I detail here).

That will remove the associated branch.

cleartool rmver file@@/main/aBranch/0

You would need to "cleartool find" all elements with a version 0 (and no version 1), and rmver those version 0.
For a given branch, this would return all the versions to delete:

cleartool find -type f -version "version(.../blah/LATEST)&&version(.../blah/0)" -print

You can combine that with an exec directive:

# on Windows:
cleartool find ... -exec "cleartool rmver --force \"%CLEARCASE_XPN%\"
# on Unix:
cleartool find ... -exec 'cleartool rmver --force "$CLEARCASE_XPN\"'

Be careful with rmver, this is a destructive operation, so do test that carefully before executing the full find -exec rmver command!


Another approach is mentioned in "Purging Zero-Version-Only Elements in ClearCase" article, by George F. Frazier:

you need to purge your view of those troublesome entities.
Run the following command to find all zero-version elements:

cleartool find -avobs -branch'{
    brtype(mybranch)&&!
    (version(.../mybranch/1))}' 
     -print > c:\files.txt 

This will find all elements with no version 1 on mybranch (if you read closely you'll notice it doesn't do the right thing if you have removed the 1 version of an element that already has versions greater than or equal to 2 — this is a rare situation though).
Once finished, it's simply a matter of using rmbranch to nuke the elements (make sure you know what you're doing here!).
There are many ways to do that; since I run the MKS toolkit, I execute the following from a command window:

cleartool rmbranch -f 'cat c:\files.txt' 

Tamir suggests a trigger to automatically remove version 0, as listed in the IBM Rational ClearCase: The ten best triggers, under the section Empty Branch.

cleartool mktrtype -c "Automatically remove empty branch" -element -all -postop uncheckout -execwin "ccperl \\mw-ddiebolt\triggers\test_empty_branch.bat" REMOVE_EMPTY_BRANCH

That is good for future cases where an undo checkout leaves a version 0.




回答2:


rmver won't work.

/home/ccadmin $ cleartool rmver -force ./VaREngine/Makefile@@/main/nz_mig/nz_relOne/0 cleartool: Error: Cannot delete version zero without deleting branch: "./VaREngine/Makefile".



来源:https://stackoverflow.com/questions/18183643/command-to-delete-branches-of-clearcase-element-with-0-versions

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