Why the extra stream and the extra step? Isn’t it redundant? No, because the workspace stream and backing stream play different roles. The whole idea of the workspace is to provide a degree of isolation from the changes that others are making concurrently. The workspace stream makes the isolation more flexible. It enables you to keep any number of intermediate versions of a file in your workspace, before “going public” by
promote’ing the most recent version. If you decide that you’ve headed off in the wrong direction, you can revert a file to any of those intermediate versions. You can even
purge all the work you’ve done on a file, which reverts to using the version in the backing stream.
All the intermediate versions that you keep are stored permanently in the depot, even the versions you never
promote. Thus, the
keep command provides a data-backup capability: “save a copy of this file, just in case I ever want to restore it to its current state”. It also means you can change your mind as many times as you like about which version of a file should be shared with the rest of the world.
The difference between keep and
promote highlights an important aspect of the way that AccuRev organizes and manages development data. It also highlights the difference between backing streams and workspace streams.
All “real” development takes place in the workspace tree. The keep command preserves the changes you’ve made to a file. Accordingly, versions created by the
keep command are called
real versions. Every real version can only be created in the workspace stream.
By contrast, the promote command does not record a change to any file. Rather, it changes availability of a change that was previously recorded with
keep. The version that
promote creates in a higher-level stream is called a
virtual version; each virtual version is just an alias for an existing real version in some workspace stream.
The AccuRev repository keeps track of which files have changed in your workspace. This set of files is called the workspace’s default group. Many of the changes are new versions, created with
keep. The default group also includes renamed or relocated files (
move command), deleted files (
defunct command), and added files (
add command), etc.
When you promote a file’s changes from your workspace stream to the backing stream, the file is removed from the workspace’s default group. This reflects the fact that you’re done working on that file — at least for now! Similarly, a
purge of your work on a file removes the file from the workspace’s default group.