Command to remove branches of a Clearcase element with versions "0"

What is the command in Clearcase to remove the branches of an element in which it is not changed (the version of the element in this branch is "0")?

+4
source share
2 answers

You can simply remove version 0 of this item ( here in detail) .

This will remove the linked branch.

cleartool rmver file@ @/main/aBranch/0 

You will need to " cleartool find " all elements with version 0 (and without version 1) and rmver those version 0.
For this branch, this will remove all versions:

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

You can combine this with the 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 check carefully before running the complete find -exec rmver !


Another approach is mentioned in " Clean Up Zero Version Items in ClearCase, " by George F. Fraser:

you need to clear your view of these unpleasant entities.
Run the following command to find all items with version zero:

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

All elements without version 1 on mybranch will be found mybranch (if you carefully read, you will notice that this is not so if you deleted 1 version of an element that already has versions greater than or equal to 2 - this is a rare situation, though).
Once done, you just need to use rmbranch to destroy the elements (make sure you know what you are doing here!).
There are many ways to do this; since I run the MKS toolkit, I run the following from the command line:

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

Tamir suggests a trigger automatically removes version 0 , as indicated by IBM Rational ClearCase: the top ten triggers in the Empty Office section .

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

This is good for future cases when canceling the check leaves version 0.

+6
source

rmver will not work.

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

+2
source

Source: https://habr.com/ru/post/1496527/


All Articles