Monday, September 8, 2008

ClearCase 常用命令

更多精彩尽在139ya网址导航



clearcase下的一些常用命令

1.最基本的操作
cleartool co -nc xxx.cpp
cleartool ci -nc xxx.cpp

2.查看自己总共co了多少文件
cleartool lscheckout -cview -me -avobs

3.最有用的命令
cleartool man xxx
cleartool help xxx

4.新增目录和文件
cleartool mkdir -c comment new_dir
cleartool mkelem -c comment new_file.cpp

5.放弃co某个文件
cleartool unco -keep file.cpp           //保留当前所改动的文件
cleartool unco -rm   file.cpp

6.主线、分支文件合并
//查找需要合并的文件
cleartool findmerge . -fversion /main/xxxx_path -print 
//比较文件不同
cleartool diff file.cpp 
file.cpp@@/main/xxxx_path/LATEST
//查看最新版本
cleartool lsvtree file.cpp
//合并
cleartool merge -to file.cpp 
file.cpp@@/main/xxxx_path/LATEST file.cpp@@/main/LATEST


7.标签相关

//新建标签
cleartool mklbtype -nc TEST_LABEL
//给文件打标签
cleartool mklabel -r TEST_LABEL file.cpp
//删除标签
cleartool rmtype lbtype:TEST_LABEL
//给所有打上TEST_LABEL标签的文件打上TEST_LABEL2标签
cleartool mklabel -replace -version /main/TEST_LABEL TEST_LABEL2 *
//查找打上TEST_LABEL标签的所有文件
cleartool find . -version "lbtype(TEST_LABEL)" -print
//查找打上TEST_LABEL和TEST_LABEL2标签的文件
cleartool find . -element 'lbtype_sub(TEST_LABEL) && lbtype_sub(TEST_LABEL2)' -print

8.将整个目录导入clearcase
clearfsimport -recurse /xxx/xxx/xxx/src /view/zhuj/home/vobs/cc_account
/xxx/xxx/xxx/src目录(包括此目录下的所有目录和文件)被导入/view/zhuj/home/vobs/cc_account中(/view/zhuj/home/vobs/cc_account/src)


附加: 

常用命令:
创建view:clt mkview -tag view_abcd /view_store/view_abcd.vws
设置view: clt setview view_abcd
编辑config specification: clt edcs

创建branch type:clt mkbrtype dbg_branch1_comments
在某个文件的当前branch上, 拉出一个branch:
clt mkbranch 
dbg_branch1_comments filename.c

now you have make branch on the file, and checked it out.
you can edit it with gvim.
After changed codes, you can complie it successfully, and test the result, you can check it in.
clt ci filename.c
If you want to check out it again:
clt co filename.c

To change the branch name to a formula name you can use the command:
clt rename brtype:dbg_branch1_comments 
brtype:crnumber_branch1_comments

To see the version tree of a file:
clt lsvtree -g filename.c

To see which files is included in a branch, you can edit a script like this find_branch.sh:

echo "$1"
cleartool find -avobs -element "brtype("$1")" -nxn -print | xargs cleart
ool ls -s|grep "$1"

To compare files, I write a useful script file mydiff.

You can use xcc& to open graphic clearcase. So you can do most thing through the menu.

No comments: