Updating a Workspace

Kinds of Changes Involved in an Update

How Update Works

Deciding which elements to update

Transferring data from the repository

Recording the update

More on Update ...

The principal purpose of an AccuRev workspace is to provide an isolated location for performing development tasks. The changes you make do not affect your colleagues until you decide to make them public, using the Promote command. Likewise, the changes that others make do not immediately affect your workspace. You must execute an Update command to bring versions created (and then promoted) by your colleagues into your workspace.

You invoke the Update command in the File Browser, using the File > Update command or a button above the Folders pane.

During execution of the Update command, a progress window appears. A user preference controls how this window is used.

Kinds of Changes Involved in an Update

At its simplest, an update just copies versions of some file elements from your workspace's backing stream (parent stream, basis stream) The stream that is just above a given workspace or stream in a depot's stream hierarchy. The given workspace/stream inherits versions from the backing stream. into the workspace. For example, your colleagues may have edited the contents of files colors.java and main_menu.java, created new versions of them in their workspaces, then promoted the versions to the common backing stream. When you invoke Update, the new versions of those two files are copied from the depot to your workspace, overwriting the older versions of the file.

In addition to incorporating such content changes A change to the contents of a file element, recorded in a new version created with the keep command. See namespace change. into your workspace, Update incorporates namespace changes A change to the pathname of a file or directory element: either renaming the element in place or moving the element to a different location in the depot’s directory hierarchy. :

AccuRev tracks namespace changes in the same way as content changes -- by saving each change as a new version in your workspace. If you Rename file colors.java to colours.java, the change is recorded as a new version of the file. Changing the name again, to hues.java, creates another new version.

Similarly, defuncting file rgb.java creates a new version of the file in your workspace.

Note: Rename'ing a modified file before Keep'ing it

How Update Works

The following sections provide an overview of how Update works.

Deciding Which Elements to Update

The basic Update strategy is to leave the files you're working on undisturbed, and to copy any new versions of other files into the workspace. This enables the workspace to provide the safety of isolation, while still "keeping in touch" with other users' progress.

Roughly speaking, Update partitions the files in your workspace tree The ordinary directory tree, located in the user's disk storage, in which the user performs development tasks and executes AccuRev commands. into two categories, to determine which are candidates for updating:

But things are not quite this simple. You might have edited other files, too, without preserving the changes with the Keep command. Such files have (modified) status.

In many cases, no one else has been working on those files. If no new versions of the (modified)-status files have been created in the backing stream since your most recent Update, the update proceeds, leaving those files alone.

But suppose one or more of the files does have a new version in the backing stream. In this case, the file's status is (modified)(overlap). Update won't simply overwrite the file with the backing-stream version, but it can attempt to merge An operation that combines the contents of two versions (contributors) of the same element. To merge the contents of text files, AccuRev uses a '3-way merge' algorithm: it compares the two files line-by-line with a third file, the version that is the closest common ancestor of the other two. Merging of namespace changes also takes into account the closest common ancestor. the file with the backing-stream version:

Notes (click to view):

Transferring Data from the Repository

Update next applies both content changes and namespace changes to elements in the workspace:

Recording the Update

After it has completed the updating of versions in the workspace, Update changes the values of two workspace parameters:

More on Update ...

For a more detailed description of how Update does its work, see section "The Update Algorithm" in AccuRev Technical Notes.