ClearCase操作命令.docx
《ClearCase操作命令.docx》由会员分享,可在线阅读,更多相关《ClearCase操作命令.docx(13页珍藏版)》请在冰豆网上搜索。
![ClearCase操作命令.docx](https://file1.bdocx.com/fileroot1/2023-2/9/c1661dbd-2473-48d1-b351-4afd22066d3e/c1661dbd-2473-48d1-b351-4afd22066d3e1.gif)
ClearCase操作命令
ClearCase操作命令
目录
ClearCase基本命令:
2
1.最基本的操作2
2.最有用的命令2
3.查看被自己co的文件2
4.新增目录和文件2
5.放弃co某个文件2
6.Checkout2
7.Checkin3
8.主线、分支文件合并3
9.标签相关3
ClearCase高级命令5
1.将整个目录导入clearcase5
2.加锁5
3.解锁5
4.转换格式5
5.查看VOB的基本信息和UUID5
6.删除视图5
7.删除lost+found5
8.查询某一天的修改记录5
9.更改VOB的Owner:
5
10.更改VOB的Group:
5
11.增加AdditionalGroup:
5
12.删除AdditionalGroup:
6
13.更改group、owner、mod6
14.创建VOB6
15.Mountvob6
16.创建视图6
17.设置当前视图6
18.设置当前的activity6
参考:
7
⏹ClearCase基本命令:
1.最基本的操作
cleartool co -nc xxx.cpp
cleartool ci -nc xxx.cpp
2.最有用的命令
cleartool man xxx
cleartool help xxx
3.放弃co某个文件
cleartool unco -keep file.cpp //保留当前所改动的文件
cleartool unco -rm file.cpp
4.Checkout
//Checkout一个文件
cleartoolcheckout[-reserve][-unreserve]filename
//Checkout前目录
cleartoolcheckout.
//Checkout当前目录下所有文件
cleartoolCheckout–nc*.*
//Checkout当前目录下所有的文件和目录中的文件
cleartoolfind.$file-exec‘cleartoolcheckout-nc$CLEARCASE_PN’
//查看当前目录以下被checkout的文件或目录
cleartool lsco -cview -r
5.Checkin
//Checkin一个文件
cleartoolcheckinfilename
//Checkin当前目录
cleartoolcheckin.
//Checkin当前目录下所有文件.
cleartoolCheckin–nc*.*
//Checkin当前目录下所有的文件和目录中的文件
cleartoolfind.$file-exec‘cleartoolcheckin-nc–ide$CLEARCASE_PN’
//Check in 所有被 checkedout的文件
cleartoollsco -cview -recurse -short .|xargs cleartool ci -nc
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 ls//查看当前目录中文件是否是clearcase文件
cleartool lsco -cview -me –all//查看当前vob中被自己checkout的文件
cleartool lsco -cview -me –avobs//查看所有vob中被自己checkout的文件
cleartool lsh -last2 //查看当前目录中每个文件最后2次操作的历史
cleartool lsh -last2 -all//查看当前vob最后2次操作的历史
cleartool lsh -last –avobs//查看当所有vob中最后1次操作的历史
8.新增目录和文件
cleartool mkdir -c comment new_dir
cleartool mkelem -c comment new_file.cpp
9.标签相关
//新建标签
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
//label the last version of branch branch_name
cleartool find . -version 'version(/main/brach_name/LATEST)' -print -exec 'cleartool mklabel -nc LABEL_NAME $CLEARCASE_PN'
//use this command to check whether all the files are labeld:
cleartool find . -version 'version(/main/brach_name/LATEST) &&!
lbtype(LABEL_NAME)' -print
⏹ClearCase高级命令
10.将整个目录导入clearcase
clearfsimport-r‘源路径’‘目标路径’
11.加锁
find.-name'*.*'-exec'cleartoollocknuseruserame1,username2"%CLEARCASE_PN%"'
12.解锁
find.-name'*.*'-exec'cleartoolunlock "%CLEARCASE_PN%"'
13.转换格式
chtype -fcompressed_file“fileName”
14.查看VOB的基本信息和UUID
des-lvob:
.
15.删除视图
rmview-uuid"UUID"
16.删除lost+found
find.-name'*.*'-exec'cleartoolrmelem-f"%CLEARCASE_PN%"'
17.查询某一天的修改记录
cleartoollshis-r-since07-dec
18.更改VOB的Owner:
cleartoolprotectvob–chownroot /vob/vob.vbs
19.更改VOB的Group:
cleartoolprotectvob–chgrpalluser /vob/vob.vbs
20.增加AdditionalGroup:
cleartoolprotectvob–add_groupgroup1 /vob/vob.vbs
21.删除AdditionalGroup:
cleartoolprotectvob–delete_groupgroup1 /vob/vob.vbs
22.更改group、owner、mod
protect-r-chgrpgroupname–chownusername-chmod770.
23.创建VOB
cleartoolmkvob-tag/vobtags/test_code-c"Test""D:
\Data\Tets.vbs"
24.Mountvob
cleartoolmount/vobtags/vob
25.创建视图
cleartoolmkview–tagtest/ccvob/views/test.vws
26.设置当前视图
cleartoolsetviewtest
27.设置当前的activity
cleartoolsetactivityactivityname
⏹参考:
1. When you come to work, the first thing you need to do is:
Create a View Command:
cleartool mkview -tag
example:
cleartool mkview -tag alex_test /net/nj2/
Other Command:
cleartool lsview //list all the views reside in the hosts
cleartool lsview | grep name //list specified view by name
cleartool rmview -tag //remove an exist view
2. After you create a vew, you need to Set the View to enter it. Then you are able to see the vob content only when you set the view.
cleartool setview
Example:
cleartool setview alex_test
Other Commands
cleartool pwv see which view you are currently in
exit quit from current view
3. When you are in a view, you need to set the config spec correctly to pick up the right version of element.
cleartool catcs //view your config spec
cleartool edcs //edit your config spec by vi editor
Other Commands
cleartool catcs > filename //Copy your config spec to a file
cleartool setcs filename //Set your config spec from a file
What doew config spec say ?
For example:
element* CHECKEDOUT
element* .../ISGcq00123456/LASTEST
element* BLUETOOTH_00.07.00
element* AP_SIPC.01.32.00
element* AP_IB2.00.38_ARM
element* /main/LATEST
Command
element
file path:
hello.c, *, /vob/su_java/...
version path:
Label or Branch
4. Now you may have a task to do. You have a CR assigned, and you know the baseline version.
Set config spec to the baseline version.
Create branch type associated with the CR.
cleartool mkbrtype ISGcq00123456
Make branch on the baseline version
cleartool mkbranch ISGcq00123456 hello.c@@/main/2
Result:
hello.c@@/main/ISGcq00123456/0 is created and checked out(a copy of hello.c in the dir was created and you can edited it. If there is not hello.c in the dir, the clearcase would submit a error).
Add a rule to pick up this branch in the config spec, just below the CHECKEDOUT rule.
element* .../ISGcq00123456/LATEST
Accessional:
Branch type shall have naming convention designed by every project.
Don't want check out:
cleartool mkbranch -nco ISGcq00123456 hello.c@@/main/2
Remove a branch from an element:
cleartool rmbranch hello.c@@/main/ISGcq00123456.
Make sure no checked out version on this branch
Rename a branch name
cleartool rename brtype:
old_name brtype:
new_name
It will apply to all the created branch.
Remove a branch type as well as all the related element branch
cleartool rmtype -rmall brtype:
ISGcq00123456
5. After making your CR branch on the file to be changed, check out the version if it hasn't been checked out(checkout后会产生一个自己的私有文件,你可以自己修改,别人看不到,只有这个文件被checkin后才会放到vobs里).
cleartool co -nc hello.c@@/main/ISGcq00123456/0
Then, you are able to edit this file. After you finish the change, check in the file to vob.
cleartool ci -nc hello.c
The result is, the element will increase one version on the branch:
hello.c@@/main/ISGcq00123456/1
Accessional
A checked out version is only in your view. Other engineer can not see it. If you remove that view, you will lost the checked out version.
You can undo checkout by:
cleartool unco hello.c
If a checked version has no change, it can't be checked in. You will get an error message like "The file is identical"
An unreserved checked out will not block other people check out the same version. Normally, we just use reserved checkout.
You can only check out a file on the branch which has mastership role.
6. If your task is to create a new file, you need to do below steps:
Make branch on the directory that you will add the file to
cleartool mkbranch ISGcq00123456 /vob/su_jave/code/src
The directory will be automatically checked out. Then make element in this dir.
cleartool mkelem -nco hello.c
Create a folder
cleartool mkelem -eltype directory test
Dont check it out, because you need to make the CR branch on this file.
cleartool mkbranch ISGcq00123456 hello.c
Check in this directory. Otherwise, other people can not see your new file.
cleartool ci -nc /vob/su_java/code/src
Accessional
We usually only check in the file, but forget to check in the directory. This will cause the file you created can't be stored in the VOB and can't be seen by other people.
Go to the top project folder, use below command to list all checked out files and directories in the current dir and sub dir in your view. It will help you check in all elements.
cleartool lsco -cview -r
7. Now, your task is ongoing. In coding and testing, you may need to merge your file to other version. below example gives the merge steps:
Example:
Merge file from hello.c@@/main/branchfrom/5 to hello.c@@/main/branchto/2
cleartool co -nc hello.c@@/main/branchto/2
cleartool merge -to hello.c hello.c@@/main/branchfrom/5
Usually you may also need to compare two versions
cleartool diff hello.c hello.c hello.c@@/main/branchfrom/5 hello.c@@/main/branchto/2
Compare this version from the previous version
cleartool diff -pre hello.c@@/main/branchto/2
Accessional
Use this command to list all versions of an element
cleartool lsvt hello.c
include the merge info
cleartool lsvt -merge hello.c
Remove a merge arrow:
cleartool rmmerge hello.c@@/main/branchfrom/5 hello.c@@/main/branchto/2
Dont do actual merge, just draw a merge line
cleartool merge -ndata hello.c@@/main/branchfrom/5 hello.c@@/main/branchto/2
In what cases we need merge:
Integrate with the code developed by someone else.
If baseline version has been incresed, need upermage.
Merge for release.
8. If you want to remove an un-use version, use the command
cleartool rmver hello.c@@/main/branchto/2
Then the version 2 will be removed, but next time the version will increase from 1 to 3.
If you want to remove a file, you can use remove name command:
cle