命令以“ 0”删除Clearcase元素的分支。版本 [英] Command to delete branches of Clearcase element with "0" versions
问题描述
Clearcase中删除未修改元素的分支的命令是什么(该分支中元素的版本为 0)?
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") ?
推荐答案
您只需删除该元素的版本0(我在此处详细说明)。
You can simply remove the version 0 of that element (that I detail here).
这将删除关联的分支。
cleartool rmver file@@/main/aBranch/0
您需要 cleartool查找
所有具有版本0(且没有版本1)且 rmver
那些版本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
您可以结合使用exec指令:
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\"'
请谨慎使用 rmver
,这是破坏性操作,因此在执行完整的 find -exec rmver
命令之前,请仔细测试!
Be careful with rmver
, this is a destructive operation, so do test that carefully before executing the full find -exec rmver
command!
在ClearCase中清除仅零版本的元素,乔治F. Frazier发表:
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
这将查找所有不包含元素的元素
mybranch
上的版本1(如果仔细阅读,您会注意到,如果删除了元素的版本1已经大于版本,则它执行的操作不正确。或等于2-但这是一种罕见的情况。)
完成后,只需使用rmbranch
对元素进行核对(确保你知道你在这里做什么!)。
有很多方法可以做到这一点。因为我运行MKS工具包,所以我从命令窗口执行以下命令:
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 usingrmbranch
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'
塔米尔 建议触发自动删除版本0 ,如 IBM Rational ClearCase:十个最佳触发器,位于 空分支 。
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
这对将来撤消签出版本为0的情况很有用。
That is good for future cases where an undo checkout leaves a version 0.
这篇关于命令以“ 0”删除Clearcase元素的分支。版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!