clearcase命令指南主要在linux下實踐1. 基本操作
1.1. 協助
ct help
1.2. 縮寫
ct clearcase
co check out
unco undo check out
ci check in
mkview make view
sview set view
mkbrtype make branch type
mklbtype make label type
1.3. 基本操作
//Check in/out files('c' option for comment ,'nc' for no comment)
ct co -nc xxx.cpp
ct ci -nc xxx.cpp
ct unco xxx.cpp
ct co -nc xxx.cpp yyy.cpp zzz.cpp
ct co -c 'some comments here' xxx.cpp
//Adding files and directories to source control
ct mkdir directory-name
ct mkelem file-name
(加入檔案的時候,它保留在check out狀態,所以在加入後,需要check in)
//列出目前的目錄下所有checkout的檔案
ct lsco -r -s -cview .
//建立分支
ct mkbrtype -c 'some comments here' branch_name
//建立標籤,打標籤
ct mklbtype -c 'some comments here' label_name
ct mklabel -r label_name ***. cpp
//去掉檔案的某一個標籤 ct rmlabel label_name ***.cpp
//刪除標籤
ct rmtype lbtype:label_name
//尋找目錄下所有打上label_name標籤的檔案
ct find . -version "lbtype(label_name)" -print
//看version tree('g' option for graphics)
ct lsvtree -g xxx.cpp
//GUI tool for clearcase in Linux/Unix
xcleasecase
//查詢某個分支的所有檔案
需要先敲ct命令進入clearcase命令列
然後:find . -all -branch brtype(my_branch_name) -print
或者直接:ct find . -all -version "brtype(my_branch_name)" -print
print 是列印出來,還可以加exec使用尋找結果來執行其它命令,比如可以將某一個branch的檔案都打上某個label
ct find . -all -version "brtype(my_branch_name)" -exec 'ct mklabel -r label_name $CLEARCASE_PN'上面的命令一定要主義單雙引號。
//merge
ct findmerge . -fversion /label_name -type d -merge //對目錄
ct findmerge . -fversion /lable_name -type f -merge //檔案
ct merge -to . -version (version)
2. 指令碼和小技巧
2.1. 一次性check in目前的目錄下所有check out的檔案
cleartool lsco -r -s -cview .|xargs -I {} cleartool ci -c 'add some comments' {}
2.2. 一次性undo check out目前的目錄下所有check out的檔案cleartool lsco -r -s -cview . |xargs -I {} cleartool unco -rm {}
2.3. 尋找含有某關鍵字的節點
foreach i ( ct lsvtree -a -s . )
foreach? ct ls $i |grep keyword
foreach? end