Keep: Creating a New Version

The Keep command creates a new version in the workspace stream for each selected file.

Keep Overview

The contents of the version and its identity are both stored permanently in the AccuRev repository. For each file you Keep:

  • AccuRev copies the contents of the file currently in your workspace tree to the associated depot in the repository.
  • AccuRev assigns a version-ID to the new version, consisting of the workspace's name and an integer. For example, the version-ID

    talon_dvt_mary/17

    ... identifies the 17th version of the file element that was created in the workspace named talon_dvt_mary.

Typically, you invoke the Keep command on files that you've been working on, and thus have (modified) status. But this is not a requirement. If you Keep a file that you have not modified, a new version is created with identical contents.

Back to top

Invoking the Keep Command

In any workspace File Browser mode except Incoming Changes, select one or more file elements. Then:

  • Click the Keep toolbar button, or
  • Right-click the selection and choose Keep from the context menu

The Keep dialog appears, which you use to complete the command.

Back to top

The Keep Dialog

The Keep dialog includes basic options (always visible) and advanced options (visibility controlled by a Basic/Advanced button).

Basic Options

Comment

You can enter a comment string in the text box. (AccuRev "seeds" the text box with your most recent Keep comment made during the current AccuRev GUI session.) The comment string becomes a permanent annotation to the version you're creating.

AccuRev itself does not require a comment, but your organization can establish such a requirement by putting a trigger on the Keep command.

Advanced Options

Specify File Type

By default, AccuRev determines the element type for the newly created version automatically (text or binary). You can override the default by specifying either of these types or ptext (a variant of text). See AccuRev Element Types.

Specify Lock Type

Choosing Serial Development places a lock on the element to ensure that users in sibling workspaces won't have to merge their work on this element. The lock remains on the element until you (or someone else) changes this value to Parallel Development in a subsequent Keep command. See The Locks Dialog Box.

Back to top

AccuRev Element Types

Each version of a file element has an element type, which identifies the type of data contained in that version. Each time you create a new version (each time you keep your changes, for example), you can change the element type, using the Advanced section of the command's dialog box.

AccuRev supports the following element types. For a newly created version of any type, AccuRev creates a new storage file in the file storage area of the AccuRev repository.

binary

When a new binary version is created, the storage file is an exact copy of the file in the workspace tree. When you retrieve a binary version from the repository (for example, with Send to Workspace or Update), AccuRev makes an exact copy of the storage file in the workspace tree.

text

When a new text version is created, the storage file is created with a single NL character (hex character code x0A) at the end of each text line. This means that a version’s storage file may have different line terminators than the workspace-tree file you submitted to the command.

When you retrieve a text version from the repository (for example, with Send to Workspace or Update), the file created in the workspace tree uses either the UNIX/Linux line terminator (NL / hex x0A) or the Windows line terminator (CR-LF / hex x0D-x0A) — depending on the EOL setting for your workspace (see The New Workspace Command: Screen 3 of 3).

ptext

ptext versions are handled like binary versions: exact copies are transferred between the workspace tree and the file storage area. The difference between ptext and binary files is in how they are handled by the Merge and Patch commands.

Back to top

Results of a Keep Operation — the Details

The Keep command does the following:

  • Creates a new version. A new version object is created in the workspace stream. It has a unique version-ID, such as talon_dvt_mary/13 ("the 13th version of this element created in workspace talon_dvt_mary"). A version object is immutable, and cannot be removed from the repository. The version created by Keep is termed a real version, because it represents an actual change to an element.

    AccuRev allows you to invoke the Keep command on a file whose contents you haven't modified. So the new version might actually have the same contents as its predecessor.

  • Preserves the contents of the new version. The contents of the new version are preserved permanently in the repository. AccuRev copies the file in your workspace tree to a container file in the depot. No AccuRev operation modifies or removes the container file (exception: archive command).
  • Sets the element status. The file element gets the status flag (kept) in your workspace. It also gets the (member) flag, indicating that the element is active in your workspace. (It's possible that the element already had one or both these status flags, from previous activity in your workspace.) If the element previously had (modified) status, this flag is removed.

Note:  

Content changes and namespace changes. The Keep command preserves content changes only, not namespace changes. Suppose you edit a file, so that it has (modified) status, then give it a new name with the Rename command. The new version that Rename creates does not record your content changes. The file will still have (modified) status until you preserve the contents changes with Keep.

"Undoing" a Keep operation. There is no true "undo" operation in AccuRev version control, since that would violate the TimeSafe principle. The Revert to Basis command provides a close approximation. If you want to "undo" some, but not all of several intermediate keeps, perform a Revert to Basis command followed by a Send to Workspace of the intermediate version.

Back to top