The Merge command combines two versions of an element, producing a new version . AccuRev can process both content A change to the contents of a file element, recorded in a new version created with the keep command. See namespace change. changes and namespace 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. changes in performing a merge. By default, the merging of text-file contents is performed by AccuRev's own Merge tool, which uses a 3-way merge algorithm.
Notes (click to view):
Perhaps the most common usage pattern in AccuRev is:
Using Keep The operation (Keep command) that creates a new version of a file element in a workspace, permanently recording in the AccuRev repository a change to the contents of the file. to create one or more versions of a text file in your workspace.
Using Promote The operation (Promote command) that transitions a version from being active in one workspace or stream to being active in the parent stream (or some other stream). This operation creates a new virtual version in the parent stream; the virtual version provides an alias for the real version, which was originally created in some user's workspace. See version. to propagate the most recently kept version to the 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..
Occasionally, someone else "gets there first". That is, both you and a colleague are working on the same file concurrently, each of you using a copy of the file in your own workspace. And the colleague promotes his changes to the common backing stream before you do.
Before you can promote your own changes to the backing stream, you must first merge (that is, combine) the changes from your colleague's version with your changes. Merging ensures that no one's work is inadvertently lost or overwritten in a concurrent development environment.
The File Browser makes it easy to tell which files require a merge prior to promotion. If a file needs to be merged in your workspace, the Details pane shows the file as having (overlap) status -- that is, the work of one or more of your colleagues has overlapped your own work. If you select Overlap in the File Browser's Searches pane, the Details pane displays all your (overlap)-status files: all files in the depot that you must merge before you can promote them from your workspace to its backing stream.
Although the above scenario is by far the most common one, AccuRev's flexibility allows for other merge scenarios, too:
You can modify the file in your workspace by "pulling in" the changes from any version of the file, not just the backing stream's version.
You can merge the versions of the file located in any two dynamic streams or snapshots. This involves using the Change Palette.
In all cases, however, you use the Merge tool in the same way, to combine the contents of two versions of the same file element.
No matter which tool you've configured to merge versions, you invoke the Merge command in the same way: select one or more files with (overlap) status, then click the Merge toolbar button. Alternatively, choose Merge or Merge From on the selection's context menu. For example:
You can merge versions in the following contexts:
In the File Browser (when invoked from a workspace), to merge from the version in the parent stream.
In the Version Browser (when invoked from a workspace), to merge from an arbitrary version.
In the History Browser (when invoked from a workspace), to merge from the version in a particular transaction.
In the Change Palette, to merge versions in higher-level streams. (You must choose a workspace to use for the merge process.)
AccuRev processes the files you specify one-by-one. For each file, it does one or both of the following
Prompts you to resolve namespace-level conflicts between the file in your workspace and the other specified version. This involves making choices in one or more dialogs.
Invokes AccuRev's Merge tool or the other tool you've configured, in order to merge the contents of the two versions. AccuRev's Merge tool opens in a separate tab within the AccuRev GUI window; any other tool opens in its own window.
Notes (click to view):
Invoking the Merge command on multiple files
If you select multiple files, you can choose to have the Merge tool process as many of them automatically as possible. An automatic merge is possible if there are no conflicting changes The situation in which both contributors to a merge operation differ from the closest common ancestor at the same text line (or set of lines). between the two versions being merged. For files in which there are conflicting changes, the Merge tool always opens an interactive Merge tab.
In all cases, one of the contributors to a merge operation is the file in your workspace. If you've just saved the file with the Keep command, the file in your workspace is identical to the most recent version in your workspace stream. But if you invoke Merge on a file that you've edited but not yet saved with Keep, AccuRev uses the file, not the latest workspace-stream version. Keep'ing before Merge'ing is an AccuRev best practice.