keep

create a new version of an element

Usage

accurev keep [ -c <comment> ] [ -dmn ] [ -E <value(s)> ] [ -O ] 
[ -R ] { -l <list-file> | <element-list> }

Description

The keep command creates a new version of an element, using the copy of the element that is currently in your workspace. It is similar to the “check-in” command of other configuration management systems.

In order to keep an element, it must exist as an element in AccuRev and your workspace must have a copy of the element in it. If the element is not yet in the repository (e.g. you just created it with a text editor), you must first add it. add performs a keep automatically, creating version 1 in your workspace stream.

You usually do not need to perform any special command, such as a “check-out”, before or after performing a keep. After you have kept an element, you can immediately edit it again.

Keeping a version transitions an element from the modified state to the kept state. The element won’t be selected by the -m option of any of accurev command until you modify the copy in your workspace again.

Exclusive File Locking and Anchor-Required Workspaces

See File Locking in Workspaces.

Pre-Operation Triggers

If a pre-keep-trig trigger is defined for the depot, it fires before the keep command is executed. Similarly, an admin_preop_trig script runs on the AccuRev Server machine before the keep command is executed. The server-side script can (for example) control the setting of the element(s)’ exclusive file locking state, overriding the keep -E specification. See the mktrig and AccuRev Triggers.

‘Keep’ and Directories

AccuRev creates a new version of a directory element when you rename the directory or move it to another location in the depot’s directory hierarchy (move command). You never need to explicitly keep a directory.

Options

–c <comment>

Specify a comment for the transaction. 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: enter a comment interactively, using the text editor named in environment variable EDITOR (or a system-dependent default editor).

-d

Select all elements in your default group.

-E <value(s)>

Change the element type to text, ptext, or binary. This change applies to the version being created and establishes the default type for future versions; it does not change the type of any existing version of the element.

You can also use this option to change the exclusive file locking state for this element: serial or parallel.

To specify two (non-conflicting) values at once, separate them with a comma, but not a SPACE:

 -E serial,binary

See Controlling the Element Type and Exclusive File Locking State in the add reference page.

-R

Recurse into the directories specified in <element-list>, and keep all modified files in the directory that are not in the default group. (You must also specify -n, and <element-list> must consist of a single directory name. Use “.” to specify the current working directory.)

-l <list-file>

Process the elements listed in <list-file>. This must be a text file, with one element name per line. Extra whitespace is not allowed; make sure there are no empty lines and no leading or trailing white space around the filenames. Wildcards are not expanded. There is no provision for comment lines in the file.

If you use this option, any <element-list> specified is silently ignored.

<element-list>

One or more element names, separated by whitespace. If you also specify a <list-file> using the –l option, this <element-list> is silently ignored.

-m

Select only the modified elements.

-n

Select only the modified elements that are not in your default group.

-O

Override any errors on modification-time timewarps. Allows a keep on a file with a modification time older than its ancestor's modification time.

Examples

Create a new version of a particular element, specifying a comment string:

> accurev keep -c "fixed typos in greeting message" greet.msg

Create new versions of all modified elements that are not in the workspace’s default group:

> accurev keep -n

Create new versions of all modified elements that are in the workspace’s default group:

> accurev keep -m -d

Create new versions of all modified elements, regardless of whether or not they are in the default group:

> accurev keep -m

See Also

add , ln, mktrig, move

Techniques for Selecting Elements