Question & Answer
Question
How do you recursively check in and check out elements in IBM Rational ClearCase (CC) using cleartool commands?
Cause
You want to automate the check-out of a large number of files in an IBM Rational ClearCase VOB. This can happen when you do large-scale updates, or builds where the output is already under source control,
Answer
There is no single command to do a large-scale check-out or check-in. However, you can perform this type of check-out using the cleartool find
commands.
- Steps for Check-out command
Note: The additional \" in the Windows command line is to account for file or directory names that contain spaces. This will enclose the element name in quotes, preventing error messages caused by names containing spaces
IMPORTANT: You will need to know which version of the files to check out. This example uses the version query to select the latest versions on the main branch. Review the ClearCase Command Reference Guide on the topic of find (cleartool man find
) for more information. - List all elements to be checked out (in addition to the current directory)
- UNIX/Linux command:
myhost% /usr/atria/bin/cleartool ls -l -r
directory version dira@@/main/3 Rule: element * /main/LATEST
directory "./dira":
version ./dira/a@@/main/3 Rule: element * /main/LATEST
version ./dira/b@@/main/3 Rule: element * /main/LATEST
directory version ./dira/dirb@@/main/3 Rule: element * /main/LATEST
directory "./dira/dirb":
version ./dira/dirb/c@@/main/3 Rule: element * /main/LATEST
- Windowscommand:
M:\def\dmm-vob>cleartool ls -l -r
directory version dira@@\main\4 Rule: element * \main\LATEST
directory version lost+found@@\main\0 Rule: element * \main\LATEST
directory ".\dira":
version .\dira\a@@\main\4 Rule: element * \main\LATEST
version .\dira\b@@\main\4 Rule: element * \main\LATEST
directory version .\dira\dirb@@\main\4 Rule: element * \main\LATEST
directory ".\dira\dirb":
version .\dira\dirb\c@@\main\4 Rule: element * \main\LATEST
- Perform recursive check-out:
- UNIX/Linux command:
myhost% /usr/atria/bin/cleartool find . -version 'version(/main/LATEST)' -exec 'cleartool co -nc $CLEARCASE_PN'
Checked out "." from version "/main/4".
Checked out "./dira" from version "/main/3".
Checked out "./dira/a" from version "/main/3".
Checked out "./dira/b" from version "/main/3".
Checked out "./dira/dirb" from version "/main/3".
Checked out "./dira/dirb/c" from version "/main/3".
- Windows command:
M:\def\dmm-vob>cleartool find . -version "version(\main\LATEST)" -exec "cleartool co -nc \"%CLEARCASE_PN%\""
Checked out "." from version "\main\5".
Checked out ".\dira" from version "\main\4".
Checked out ".\dira\a" from version "\main\4".
Checked out ".\dira\b" from version "\main\4".
Checked out ".\dira\dirb" from version "\main\4".
Checked out ".\dira\dirb\c" from version "\main\4".
- Confirm what has been checked out
- UNIX/Linux command:
myhost% /usr/atria/bin/cleartool lsco -all
17-Aug.19:17 user1 checkout directory version "/vobs/dmm-vob/." from /main/4 (reserved)
17-Aug.19:17 user1 checkout directory version "/vobs/dmm-vob/dira" from /main/3 (reserved)
17-Aug.19:17 user1 checkout directory version "/vobs/dmm-vob/dira/dirb" from /main/3 (reserved)
17-Aug.19:17 user1 checkout version "/vobs/dmm-vob/dira/a" from /main/3 (reserved)
17-Aug.19:17 user1 checkout version "/vobs/dmm-vob/dira/b" from /main/3 (reserved)
17-Aug.19:17 user1 checkout version "/vobs/dmm-vob/dira/dirb/c" from /main/3 (reserved)
- Windows command:
M:\def\dmm-vob>cleartool lsco -all
17-Aug.19:58 user1 checkout directory version "M:\def\dmm-vob\." from \main\5 (reserved)
17-Aug.19:58 user1 checkout directory version "M:\def\dmm-vob\dira" from \main\4 (reserved)
17-Aug.19:58 user1 checkout directory version "M:\def\dmm-vob\dira\dirb" from \main\4 (reserved)
17-Aug.19:58 user1 checkout version "M:\def\dmm-vob\dira\a" from \main\4 (reserved)
17-Aug.19:58 user1 checkout version "M:\def\dmm-vob\dira\b" from \main\4 (reserved)
17-Aug.19:58 user1 checkout version "M:\def\dmm-vob\dira\dirb\c" from \main\4 (reserved)
- Step for Check-in command
- Recursive Check-in using the Find command
Change to the directory that contains the files to be recursively checked in:
- UNIX/Linux command:
myhost% /usr/atria/bin/cleartool find . -version 'version(/main/LATEST)' -exec 'cleartool ci -nc $CLEARCASE_PN'
Checked in "." version "/main/5".
Checked in "./dira" version "/main/4".
Checked in "./dira/a" version "/main/4".
Checked in "./dira/b" version "/main/4".
Checked in "./dira/dirb" version "/main/4".
Checked in "./dira/dirb/c" version "/main/4".
- Windows command:
M:\def\dmm-vob>cleartool find . -version "version(\main\LATEST)" -exec "cleartool ci -nc \"%CLEARCASE_PN%\""
Checked in "." version "\main\6".
Checked in ".\dira" version "\main\5".
Checked in ".\dira\a" version "\main\5".
Checked in ".\dira\b" version "\main\5".
Checked in ".\dira\dirb" version "\main\5".
Checked in ".\dira\dirb\c" version "\main\5".
- Recursive Check-in using
check in
andlsco
commands
You can run the following command syntax on Linux or Solaris to recursively check in all check-outs for the user running the command:
cleartool ci -nc `cleartool lsco -me -short -r`
IMPORTANT: Be aware that recursively checking out or checking in files can cause performance degradation, especially when the total amount of the files exceed 2GB.
The recommendations are as follows if performance is degraded due to this recursive operation.
- Change the operation. Say, check out and check in smaller parts.
- Stop the operation all together.
Related Information
[{"Product":{"code":"SSSH27","label":"Rational ClearCase"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Documentation","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF015","label":"IRIX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"9.0.1;9.0;8.0.1;8.0","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}},{"Product":{"code":"SSSH27","label":"Rational ClearCase"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Documentation","Platform":[{"code":"","label":""}],"Version":"","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]
Was this topic helpful?
Document Information
Modified date:
29 September 2018
UID
swg21122520