分类: 项目管理
2010-03-31 04:38:20
Clearcase User Commands: |
File: $HOME/.bashrc alias ct=/usr/atria/bin/cleartool |
File: $HOME/.cshrc alias ct /usr/atria/bin/cleartool |
ClearCase Command | Description |
---|---|
ct -ver | Display Clearcase, cleartool, db_server and VOB database schema version. |
ct lsvob | List vob mount table: * /vob/VOB-NAME.vbt /hosts/host-name/r1vob/vobs/vobstore/VOB-NAME.vbs public |
ct dump element-or-DO | Print internal Clearcase info. |
ct lsview | List all views: millesc_view /hosts/host-name/view-name/Views/millesc_view.vws |
ct lsview view-tag | List view path. |
ct mktag -view -tag dynamic-view-name -nstart /hosts/node-name/home/cleardata/views/dynamic-view-name or ct mktag -vob vob-tag ... |
Create a view-tag or VOB-tag. |
ct mkview -tag user1_view -stgloc viewstore | Create a new view in "viewstore" Clearcase server view mount point (see YoLinux or installation tutorial). List view storage locations: ct lsstgloc |
ct mkview -tag tmpA_view /hosts/node-name/home/cleardata/views/tmpA_view | Create a new view. |
ct setview user-name_view | Set current view to user-name_view. |
ct startview common_view | Set current view to common_view without starting a Clearcase shell environent. It allows one to view (only) the files. Path: /view/common_view/vob/vob-name/... |
ct endview common_view ct endview -server user-name_view |
Deactivate a Clearcase view. (First exit view) Useful if you get stale NFS handles. |
ct rmview -tag temp_view or ct rmview temp_view |
Remove view temp_view. |
cleartool setview username_view sv user-name_view |
Set Clearcase view. See alias defined above. |
ct pwv | Print working view/current view: Working directory view: username_view |
echo $CLEARCASE_ROOT | Print current view path. |
ct ls -l ct ls -vob_only |
Using current view, show files, private files, file version and rule. -vob_only: List elements and not derived objects Format: ... |
ct lstype -kind lbtype -list labels | List labels |
ct lsvtree -all file-name.ext | List file version label and build label: (version tree) file-name.ext@@/main |
ct lsvtree -all pref* | List file version label and build label for files beginning with "pref" |
ct lshistory [all] file-or-directory ct lshistory file-name |
List file or directory version history. List event rocords for a given file. |
ct chevent -c 'new-comment-goes-here' -replace -event event-id ct chevent -c 'new-comment-goes-here' -replace -lbtype label |
Change the comment on a version of an element. Lookup event id: ct lsh -event file-or-element Change the comment on a label. |
ct lsco ct lsco -r ct lsco -avobs -me ct lsco -avobs -cview |
List all checked out files in current directory. Flag "-r" recusivly looks in sub directories. List all files checked out to all views. List checkouts in view. |
ct lscheckout -l ct lsco -l ct lsco -recursive -me -cview |
List checked out files. (same) List files in current directory and subdirectories checked out to you in current view. Omit -cview tag to get all. |
ct catcr file-name | List configuration record for a file. |
ct find ./ -branch 'brtype(branch-name)' -print ct find ./ -version(main/LATEST) && \! version(LABEL_X)' -print ct find -avobs -nxname -element 'brtype(view_name)' -print |
List files in branch with search name or attribute. List files with label "LATEST" but not LABEL_X. |
ct lsprivate ct lsp -co |
List all private files in current view. View private files are files residing in the Clearcase filesystem but not under the control of Clearcase. i.e. object files as a result of a compile. May not be viewable by others. List files checked out to current view. |
ct mklbtype -nc LABEL_NAME ct mklbtype -c "comment" LABEL_NAME |
Create a label to be used later. |
ct lstype -kind lbtype -short | sort | List labels. |
ct describe -l file.ext | Describe object in VOB. Lists branch and version of file and configspec used in view. |
ct describe file-or-directory | List file or directory information. |
ct describe -long element:file-or-directory | List file or directory information. |
ct describe -long vob:/vob | List vob information. |
ct mklabel LABEL_NAME file-name.ext ct mklabel -r LABEL_NAME |
Apply label to a file. Label elements in directory tree. |
ct mklabel -replace NEW_LABEL_NAME file-name.ext@@/main/4 | Apply label to a newer version of the file. |
ct rmtype -rmall -force lbtype:LABEL_NAME ct rmtype -lbtype -rmall LABEL_NAME |
Remove a label of the name given. The option "-rmall" causes the removal of all instances of the label on all files / directories.Remove label type and all occurrences of the label. |
ct rmtype lbtype:LABEL_NAME | Remove label from Clearcase. It will not be removed if label has been applied. Use option "-rmall" to remove label and all instances of its application. |
ct rmtype -rmall -brtype branch-type | Remove branch and all files / directories in branch from Clearcase. Data disposed in "lost-found". |
ct find -avobs -version "lbtype (Build-Label)" -print ct find . -name '*.[hc]' -element 'lbtype_sub(LABEL_NAME)' -print |
Print all files and file versions going into build specified. list all .h and .c files whith the given label. |
ct co -nc file-name | Check-Out file (RCS command) -No Comment |
ct mkdir directory-name | Create a directory. Checkout parent directory first. |
ct ln -s source-directory-name local-directory-name | Create a symbolic link to a directory. Checkout parent directory first. |
ct mkelem -ci -nc filename | Add file to Clearcase control. |
ct rmelem filename | Remove file from Clearcase control. All history and knowledge of the element is completely removed. By contrast, the "ct rm" command will remove the file and not the history and the directory must be checked out in order to make this change. |
ct rmelem -rm filename | Remove file from Clearcase control and remove private view file. |
ct rmelem directory-name/* | Remove directory, revision history and its contents from Clearcase control. |
ct rmver filename@@/main/LATEST or ct rmver filename or ct rmver filename@@/main/22 or remove specifed version on main branch: ct rmver -force -xlabel -ver /main/22 file-or-element-name |
Remove latest version checked in of the file from Clearcase. Second example removes version 22 from the Clearcase change management system. Previous versions will be available from the archive. |
ct rm filename | Remove file from Clearcase view. First perform a checkout ("ct co") of the file and directory. Past versions will be available from the archive although not visible in current view. Safer than "ct rmelem" which removes all knowledge of the file old and new. |
ct reserve file-name | Lock file. Convert unreserved checkout to reserved. |
ct unco file-name ct unco -rm file-name ct uncheckout file-name |
UN-Check-Out file. Cancel a checkout of a file. Cancel a checkout of a file and remove file which was checked out. Not removed from Clearcase, just view private the checked out file is deleted/cleaned up. |
ct co -unr -nc file-name | Checkout file even though file is checked out by another. Checkout "unreserved", must be merged at a later time. |
ct checkout -unreserved file-name | Not locked. Checkout to read, print, etc. Same as above command. |
ct ci file-name | Check-In file. (also ct checkin file-name) Enter comment,enter "." as sole character on line and enter. |
ct diff -gra -pre file-name & ct diff -pred file-name ct xdiff -pred file-name |
Graphical Diff/Merge tool. Clearcase diff between current file and predecessor. X-windows diff with predecessor. |
ct mv file-name_A file-name_B | Rename a file. Be sure to checkout the parent directory first. If moving file to a new directory, check out the target directory as well. |
ct protect -r -chmod 775 directory-or-file-name | Set directory/file/element protection. |
Configspec commands | |
ct catcs
ct catcs -tag view_tag |
Print rules of current view (configspec): element * CHECKEDOUT Look at the configspec associated with another view. |
ct edcs | Edit current rules of view (config spec): Change from: element * CHECKEDOUTTo: element * Build-LabelClose vi: wq Set config spec for view "username_view"? [yes] |
ct setcs -default ct setcs -cur |
Reset to default view rules. Re-evaluate current configspec. |
ct update -add_loadrules | Updates elemets in snapshot view. GUI tool. Reevaluates config spec and reselects VOB elements to show. The option "-add_loadrules" allows you to load rules to your config spec and load elements which satisfy the rules. |
Help and Information commands | |
ct man clearcase-command ct man env_ccase |
Man page for Clearcase command. List Clearcase environment variables. |
ct apropos search-word | List commands and man page summaries for related Clearcase command. |
ct help ct help clearcase-command |
Help facility (simple). Lists possible command arguments. |
Tree/Branch commands | |
ct lstype -kind brtype ct lstype -kind brtype -invob /vob/vob-name |
List all branches. List all branches in the vob specified. |
ct find -avobs -version 'brtype(branch-type)' -print | Find all files of the specified branch name in all mounted VOB's. Find branch name with the ct lstype command.. |
ct lsvtree -all * ct lsvtree file-name ct lsvtree -g file-name |
List version trees (labels and branches) of files (even those without labels or branches). List all branches of specified file. Launch GUI display and show version tree (labels and branches) for a given file. ([Potential Pitfall]: You may have to issue the command export LANG=C prior to launching GUI.) |
ct chtype | Change element type or rename branch. |
ct mkbranch ct mkbranch -nc branch-name file-to-branch.cpp |
Create a new branch in version tree. Use the command mkbrtype to create the branch type (name) first. This command also checks out the file. The config spec needs to include this branch so file can be viewed. |
ct rmbranch | Remove a branch in version tree. |
ct mkbrtype mkbrtype -c "Comment goes here" branch_name |
Create a new branch type object. |
ct merge | Merge changes/differences of a file from another branch. |
ct findmerge ct findmerge ./ -flag VIEW-TAG -print |
Determines whether a merge is required for a file in your view. Find files in current directory tree which need to be merged. Use the describe command to see if branch has been merged. If so it wil be stated as such. |
Derived Objects commands | |
ct lsdo -l | List derived objects. |
ct rmdo | Remove a derived object. |
ct winkin *.o *.a executables | Wink-in a derived object. |
Admin commands | |
clearexport_ffile -r directory-name | Create file cvt_data which is the result of a recursive export of files from given directory name.. |
clearlicense | List number of allowable client connections and list who is holding a license. |
clearlicense -rel user | Release license from user who is holding a license. |
getcache ct getcache -mvfs |
Display Clearcase view or MVFS cache parameters. Troubleshoot by listing cache misses (Cache misses are bad). Perform this command on the server itself. |
getlog | Examine Clearcase log files. |
hostinfo | Display configuration data for a Clearcase host. |
lock
|
Command to lock a VOB, element, branch, type object or storage pool.
|
unlock ct unlock -brtype branch-type |
Unlock a VOB object. |
lslock | List locks. |
lsclients | List client list for lisence or registry host server. |
lsreplica | List replicas of a VOB. |
mkpool | Create or modify VOB storage pool. |
rmpool | Remove a storage pool from a VOB. |
lspool | List storage pools. |
chpool | Change the storage pool to which an element is assigned. |
mkregion | Register a new Clearcase network region. |
rmregion | Unregister a Clearcase network region. |
lsregion | List Clearcase network region. |
mktrigger | Attach a trigger to an element. |
rmtrigger | Remove trigger from an element. |
mktrtype | Create a trigger object. |
mkvob ct mkvob -tag VOB-tag -c "comment" /vobpath |
Create and register a versioned object base. |
rmvob ct rmvob /vobpath |
Remove a VOB. |
lsvob | List of mounted VOBs. |
checkvob | Fix inconsistancies between VOB database and storage pools. |
protectvob | Change owner or group of a VOB. |
reformatvob | Update the format of a VOB. Use command "ct -ver" to find the current VOB database schema version. |
rmtag | Remove a VOB tag from a storage registry. |
complete_migration | Take VOB out of migration mode. |
mount ct mount VOB-tag |
Activate a VOB. |
unmount ct umount VOB-tag |
Deactivate a VOB. ("ct describe -vob" to show VOB info/owner) |
register | Create an entry in the VOB/view storage registry. |
unregister | Remove a VOB/view from storage registry. |
relocate | Move elements and directory trees from one VOB to another. |
rename | Asign a new name to a Clearcase object (i.e. pool, replica, label). Use mv to change the name of a file or directory. |
setcache ct setcache -view -host -cachesize 1024k ct setcache -view -site -cachesize 2m ct setcache -view -cachesize 5m view_tag |
Set Clearcase view or MVFS cache parameters. Set cache size for all views on server to 1024 Kb. Set cache size for all views site-wide to 2 Mb. set cache size for a single specified view. View with ct lssite -inquire |
mvfscache | Controls and monitors MVFS caches (dynamic views only). |
ct lssite -inquire | List site-wide properties in the site config registry. |
setsite | Sets or unsets site-wide properties in the site config registry.
|
space | Report VOB disk space usage. |
Environment Configuration: |
Get shell config file sample from node-name:/home/vobadm/config/.bashrc, .cshrc, .kshrc.
Sample $HOME/.bashrc
export CLEARCASE=/usr/atria |
Sample Unix Clearcase sessions: |
node-name:(username)/home/username> cleartool setview username_view node-name:(username)/home/username> cd /vob/vob-name/src/sub-directory [username_view]node-name:(username)sub-directory> ct co -nc filename.cpp --- edit file --- [username_view]node-name:(username)Directory-name ct ci filename.cpp Add comments here. . exit |
[username_view]node-name:(username)sub-directory> ct co -nc . |
[username_view]node-name:(username)sub-directory> ct co -nc . |
[username_view]node-name:(username)sub-directory> ct mklbtype -nc RELEASE_NAME_#.#.# |
Update a file and apply the existing label to the new file:
[username_view]node-name:(username)sub-directory> ct mklabel -replace -nc RELEASE_NAME_#.#.# file-name@@/main/4 |
Remove old label:
[username_view]node-name:(username)sub-directory> ct rmtype -rmall lbtype:OLD_RELEASE_NAME_#.#.# |
List all labels:
[username_view]node-name:(username)sub-directory> ct lstype -kind lbtype |
List all labels on a file:
[username_view]node-name:(username)sub-directory> ct lsvtree -all file-name |
Label formats: RELEASE_NAME_#.#.#
Default labels created by Clearcase:
[prompt]> ct lsview |
[prompt]> cd /net/hostname/views/viewstore/ |
cd /net/hostname/views/viewstore/ |
[username_view]node-name:(username)sub-directory> ct lsco |
View default group on Windows PC:
PC Configspec: right click on XX: drive + clearcase + properties.
Clearcase explorer: C:\Program Files\Rational\ClearCase\bin\clearexplorer.exe
Clearcase find command: |
Tag "-all" refers to all files in VOB.
Explanation of Clearcase views and file structure within a view: |
Views are required in order to use Clearcase. A unique view assigned to a user will:
There are three types of views:
The Clearcase view and versioning system is based on a directory structure beneath what at first appears to be a standard set of files in a directory structure.
Example: (set view first: ct setview xxxxxx)
Clearcase presentation | Unix presentation | ||
---|---|---|---|
ct ls
|
ls
|
Actual Directory path representation:
filename1.ext@@/ - Actually a directory name not a file name LABEL-1 - Actualy a file with the full contents. LABEL-2 main/ - Directory of main branch. LABEL-1 - Actual file with full contents of file. LABEL-2 - Actual file with full contents of file. 0 - Actual file containing version zero. 1 - Actual file containing version 1 2 - Actual file containing version 2 3 - Actual file containing version 3 LATEST - Actual file with full contents of file. |
cd filename.ext@@/mainThis will show no change between the files.
diff 3 LATEST
Each view will have the directory structure described above within its view.
/view/... - View root directory /view/view-name1/ |
/view/view-name1@@/vob/vob-name/main/LATEST/directory-name/main/LATEST/... |
Configspec: |
Configspec specifies rules of viewing specified elements which will be shown in a given view. The system default configspec can be found in $ATRIAHOME/default_config_spec (Typically: /usr/atria/default_config_spec)
Basic configspec:
(/destination viewstore/view-tag.vws/config_spec)
element * CHECKEDOUT |
Pattern matching:
Pattern | Description |
---|---|
* | Matches all elements in the path but not recursively. |
*.h | Matches all elements in the path which match the suffix ".h", but not recursively. |
src/Makefile | Matches all elements in the path in a directory named "src" which match this file name. |
src/.../Makefile | Matches all elements in the directory/subdirectory tree named "src" which match this file name. |
src/.../*.[ch] | Matches all elements with the suffic ".h" and ".c" in the directory/subdirectory tree named "src". |
src/... | Matches all elements (files and directories) in the directory/subdirectory tree named "src". |
Config Rule | Description |
---|---|
element * CHECKEDOUT | This rule is mandatory. Without this rule, any file that is checked out will not be seen in a view. |
element -directory * /main/LATEST | Look at latest version of the directory on the main branch. |
element -directory * /branch-name/LATEST | Look at latest version of the directory on the defined branch. |
element -file * /main/version-number | Show this particular version number of all fields in view. |
element * LABEL | Show elements with this label. (i.e. element * /main/LABEL3) |
element * rule-name -time time element * rule-name -time 26-Oct.14:32 |
Show elements which comply with this rule and last modified prior to time |
element * rule-name -time time | Show elements which comply with this rule and last modified prior to time |
element * /vob/vob-name/AppName/* LABEL | Show elements in the specified directory with the given label. |
element /vob/projectA/... /main/LATEST | Rule applies only to specified directory hierarchy. |
Branching: |
Branching can be performed to:
Configspec to view branch:
element * CHECKEDOUT |
The branch type must first be created with the command: mkbrtype -c "Comment goes here" branchx
Create the branch type before creating the actual branch. Only one branch type of a given name will exist. Many files may exist with the branches of the same branch type.
Example of creating a branch:
This will create version "0" of file-to-branch.cpp in the branch named BugFix_branch_Y.
Create a branch off of version 5 of file-to-branch.cpp in branch main.
ct mkbranch -nc BugFix_branch_Y file-to-branch.cpp@@/main/5
Create branch using all source: ct mkbranch -nco -c "Bugfix patch B" patch_B *.cpp *.h
GUI: ct lsvtree -g file-name
Merging: If one wishes to include the changes made in a branch into the "latest" version in the "main" branch, one would perform a "merge".
List all branches: ct lstype -kind brtype
GUI Tools: |
Tools:
xcleardiff*promptBrightColor: yellow
xcleardiff*changeColor: blue
xcleardiff*deleteColor: red
xcleardiff*insertColor: green
[Potential Pitfall]: You may have to issue the command export LANG=C prior to launching GUI.
Common resources:
Motif resource file: (Add to $HOME/.Xdefaults)
*scheme: Monet |
Version String Generation: |
...
target: version.h $(OTHER_OBJS)
cc -o target -DDATE ="\"@(#)`date`\"" $(OTHER_OBJS)
...
...
char *version = "@(#)target R3.0";
char *version_time = DATAE;
...
This is used in conjunction with the UNIX what command. (Not available on Linux)
Notes: |
Links: |