Keep: Preserving Changes in Your Private Workspace

A workspace is just a normal directory tree in which you make changes to version-controlled files. You can work with the files using text editors, build and test tools, IDEs, and so on, just as if the files were not version-controlled at all. For example, you might edit a source file and invoke the editor’s Save command a dozen times over the course of an hour or two. These operations do not involve AccuRev at all, the operating system changes the contents and the timestamp of the file in your workspace.

You do not need to perform a check out operation or otherwise get permission before editing a file in your workspace. (Some legacy SCM systems do impose such a regimen, and AccuRev can be configured to require checkouts, if your organization requires them.)

Every so often, you want AccuRev to preserve the current contents of the file as an official new version of the file. You accomplish this using the Keep command.

This figure shows how to invoke the Keep command from the File Browser toolbar. Keep is also available from the Actions and context (right-click) menus. You can also keep new files, like requirements.txt in the preceding illustration, its status is external because it has not yet been added to AccuRev.

Tip: The File Browser helps organize your workspace using Outgoing Changes (your work), Incoming Changes (others’ work), and Conflicts modes (conflicting changes in your work and that of a teammate).

You can continue modifying the file, using Keep to preserve the latest changes, as often as you like. Other team members will not complain about "thrashing" because these new versions stay within your workspace and do not affect any other user’s workspace. AccuRev retains all the versions that you Keep. This makes it possible for you to roll back to any previous version you created.

Several other operations are similar to Keep in that they create a new version of a file in your workspace, without affecting any other user’s workspace. The most important of these are:

Rename and Move
You can rename a file or move it to a different directory (or both), using AccuRev commands. Other users will continue to see the file at its original pathname in their workspaces.
Defunct
You can remove a file from your workspace with the Defunct command. When you promote a defuncted file, other users will continue to see the file until they update their workspaces, at which point the file will be removed. (Defunct differs from a simple delete in that Defunct removes the file from your workspace, while Delete removes the physical file from your local directory.)

More About Keep

AccuRev retains all of the versions that you Keep. Each time you Keep a file, its current contents are copied to the AccuRev repository, located on the machine where the AccuRev Server runs. You do not need to care about the name and precise location of this copy. Each version you create has a version-ID, such as myWorkspace\2 (which translates as "the 2nd version of this file created in the myWorkspace workspace").

AccuRev keeps track of the status of each file in a workspace. After you Keep a file, the Status column in the File Browser contains the indicator (kept). It also contains the indicator (member), meaning that the file belongs to the set of files you are actively working on. (See Active and Inactive Files in Promote for more information). The Version column displays the version-ID.

A change to the data within a file, recorded by Keep, is termed a content change. The change made by Rename, Move or Defunct is termed a namespace change. (Many SCM systems do not handle namespace changes at all, or have very limited capabilities in this area.) As noted previously, AccuRev Server saves a new copy of the file in the repository whenever you make a content change. But it does not need to copy the file when you make a namespace change, rather, the AccuRev Server just records the change in its database.

To perform version control on directories, AccuRev Server only needs to keep track of namespace changes, such as renaming, moving, or deleting a directory. Unlike some legacy SCM systems, AccuRev does not need to record a new directory version when you make a content change. For example, when adding a new file to the directory.