The lock command creates a lock on an entire VOB or on one or more file system objects, type objects, or VOB storage pools. A lock on an object disables operations that modify the object; a lock has no effect on read operations, such as lshistory. (Exception: see the section on cleartext pools in Storage pool lock.)
The VOB does not need to be mounted for you to lock type objects, storage pools, or the VOB itself. However, you need a view context (and therefore a mounted VOB if you're using a dynamic view) to lock elements or versions.
Locking an entire VOB disables all write operations to that VOB and forces a database checkpoint by causing a state flush. A typical application is locking a VOB to prevent it from being modified during backup.
You must lock a VOB before backing it up, and you cannot use the –nusers option. With –nusers, it is possible that the VOB will be modified during the backup, and locking with the –nuser option does not perform a database checkpoint.
In general, locking a type object disables these kinds of operations:
The following sections describe how these general rules apply to the different kinds of type objects.
You can create a subbranch at any version on a locked branch, using mkbranch. (Creating a subbranch does not modify the branch itself.)
In general, locking a trigger type does not inhibit triggers of that type from firing. Exception: Trigger firing is inhibited if a trigger type created with mktrtype –element –all, mktrtype –ucm –all or if mktrtype –type is made obsolete (using lock –obsolete).
If a branch instance is locked, you cannot do the following:
You can create a subbranch at any version on a locked branch, using mkbranch. (Creating a subbranch does not modify the branch itself.)
If a version is locked, you cannot do the following:
You must always specify an explicit version to lock or unlock.
Locking a VOB storage pool inhibits commands that create or remove the pool's data containers. It also prevents the pool's scrubbing parameters from being modified with mkpool –update. The following sections describe how this principle applies to the different kinds of storage pools.
An object becomes obsolete if it is processed with a lock –obsolete command. An obsolete type object or obsolete storage pool is not only locked, but is also invisible to certain forms of the lstype, lslock, lspool, and lsvtree commands. An obsolete VOB or obsolete VOB object is no different from one with an ordinary lock. You can change an object's status from obsolete to locked by using a lock –replace command:
cmd-context lock –obsolete brtype:test_branch (make a branch type obsolete)
Locked branch type "test_branch".
cmd-context lock –replace brtype:test_branch
(change the branch type to 'just locked')
Similarly, you can use a lock –replace command to make a locked object obsolete.
You can use this option to change a object's status from just locked to obsolete.
When locking type objects and storage pools, the command processes objects in the VOB containing the current working directory. To lock an entire VOB, you must specify a VOB.
The UNIX system and Linux examples in this section are written for use in csh. If you use another shell, you may need to use different quoting and escaping conventions.
The Windows examples that include wildcards or quoting are written for use in cleartool interactive mode. If you use cleartool single-command mode, you may need to change the wildcards and quoting to make your command interpreter process the command appropriately.
In cleartool single-command mode, cmd-context represents the UNIX system and Linux shells or Windows command interpreter prompt, followed by the cleartool command. In cleartool interactive mode, cmd-context represents the interactive cleartool prompt.
cmd-context lock lbtype:REL1 lbtype:REL1.1 lbtype:REL2
Locked label type "REL1".
Locked label type "REL1.1".
Locked label type "REL2".
cmd-context lock -obsolete brtype:rel2_bugfix
Locked branch type "rel2_bugfix".
cmd-context lock vob:. Locked versioned object base "/usr/hw".
cmd-context lock –nusers gomez,jackson brtype:test
Locked branch type "test".
cmd-context lock *.c
Locked file element "hello.c".
Locked file element "msg.c".
Locked file element "util.c".
cmd-context checkout –nc msg.c
cleartool: Error: Lock on file element prevents operation "checkout".
cleartool: Error: Unable to check out "msg.c".
cmd-context lock pool:cdft@\jazz_vobLocked pool "cdft".
checkin, checkout, chevent, chpool, chtype, clearmake, comments, lshistory, lslock, lspool, lstype, lsvtree, mkattr, mkattype, mkbranch, mkbrtype, mkdir, mkelem, mkhlink, mkhltype, mklabel, mklbtype, mkpool, mktrigger, mktrtype, promote_server, rename, rmattr, rmbranch, rmdo, rmelem, rmhlink, rmlabel, rmtrigger, rmtype, uncheckout, unlock