lock

lock a dynamic stream against promotions/demotions

Usage

accurev lock [ -c <comment> ] [ -kf | -kt | -kdf | -kdt ]
[ { -e | -o } <principal-name-or-group-name> ] <stream>

Description

The lock command prevents users from making various changes to the specified dynamic stream:

  • With no -k option, the command creates an “all” lock, which prevents users from:

    • promoting versions either to or from the specified stream

    • demoting versions either to or from the specified stream

    • modifying the contents of a stream with an incl, excl, or incldo command

    • modifying the specifications of a stream with a chstream command

  • With -kf, the command prevents users from:

    • promoting versions from the specified stream to other streams

    • purging versions from the stream

  • With -kt, the command prevents users from:

    • promoting versions to the specified stream from workspaces or other streams

  • With -kdf, the command prevents users from:

    • demoting versions from the specified stream to workspaces or other streams

  • With -kdt, the command prevents users from:

    • demoting versions to the specified stream from other streams

Using any combination of -kf, -kt, -kdf, and -kdt in the same command is not valid. (The first option appearing on the command line is taken, and all the other options are ignored.) But you can use these options in separate lock commands, to establish both “from” and “to” locks on the same stream.

By default, the lock applies to all users. The -o <principal-name> option makes the lock apply only to a specified AccuRev user. Similarly, the -o <group-name> option makes the lock apply only to the members of the specified AccuRev group.

Conversely, use the -e option to make the lock apply to everyone but the specified AccuRev user or group. That is, the specified user or group will be able to perform the appropriate operations, but no one else will.

Limitations on Locking

For a given user, an “all” lock overrides any specific locks for promote and demote.

An “all” lock on a stream does not prevent the stream from being deactivated with remove.

Locks and Virtual Versions

AccuRev’s system of real versions and virtual versions means that a version of an element seems to exist in multiple streams at once. A lock on one of those streams does not apply to any of the other streams. For example, suppose you create a real version of a file in workspace stream gizmo_dvt_derek, and then promote this version to stream gizmo_dvt. If you put a -kf “promote-from” lock on stream gizmo_dvt_derek, you can still promote the version from stream gizmo_dvt to another stream.

Removing Locks

Use the unlock command to remove an existing lock. Placing a new lock on a stream automatically removes any existing lock of the same type. For example, if you issue the following commands, the result will be a “promote-to” lock for everyone and a “promote-from” lock for everyone except john.

   accurev lock -kf -e tom stream1
accurev lock -kt stream1
accurev lock -kf -e john stream1

Options

-c <comment>

Specify a comment that will be displayed in the future when this lock prevents a user from promoting/demoting a version. The next command-line argument should be a quoted string. Alternatively, the next argument can be in the form @<comment-file>, which uses the contents of text-file <comment-file> as the comment. Default: No comment is associated with this lock.

-kf

Disallow promotions from the stream and purging versions in the stream. Cannot be used with -kt, -kdf, or -kdt.

-kt

Disallow promotions to the stream. Cannot be used with -kf, -kdf, or -kdt.

-kdf

Disallow demotions from the stream. Cannot be used with -kf, -kt, or -kdt.

-kdt

Disallow demotions to the stream. Cannot be used with -kf, -kt, or -kdf.

-o principal-name-or-group-name

Make the lock apply only to the specified AccuRev user, or only to the members of the specified AccuRev group. Cannot be combined with -e.

-e principal-name-or-group-name

Make the lock apply to everyone but the specified AccuRev user, or to everyone but the members of the specified AccuRev group. The specified user or group will be able to perform the operation, but no one else will. Cannot be combined with -o.

Examples

Disable all promotions and demotions to and from stream tulip_dvt; also disable include/exclude changes and chstream changes:

   > accurev lock tulip_dvt

Disable all promotions from stream tulip_dvt:

   > accurev lock -kf tulip_dvt

Allow user mary to make demotions to stream tulip_dvt, but disallow everyone else from doing so:

   > accurev lock -kdt -e mary tulip_dvt

See Also

chstream, demote, promote, remove, unlock