This topic describes AccuRev's own 3-way merge tool. You can also configure the GUI to use another text-file-merge tool.
The file in your workspace is always on the right. Above them, the Merge tool displays the merged version. The contributor panes and closest common ancestor pane are synchronized: scrolling any one of them causes the others to scroll, too.
Like the Diff tool, the Merge tool partitions the contributor versions' contents, displaying unchanged sections with a white background and
change sections with colored backgrounds. The color-coding scheme is a bit different, because the Merge tool has the more complex job of distinguishing
conflicting changes from non-conflicting ones. In addition, the color-coding scheme depends on which navigation mode you're working in.
Example 1: In My changes navigation mode, non-conflicting additions that come from your version are colored
green; non-conflicting additions that come from the other contributor are colored
gray. In
Their changes navigation mode, the color-coding of non-conflicting additions would be reversed.
Example 2: In Conflicts navigation mode, all conflicting changes are colored
yellow; all other change sections are colored
gray.
The merged version is displayed with color-coding, too. Each colored block is a location where a change has been incorporated from one of the contributors into the merged version. When it starts, the Merge tool performs as much merging as it can automatically, applying all of the non-conflicting changes to the merged version. The text is always colored
gray. Annotations in the left margin indicate the origin of the change:
The Merge tool cannot resolve conflicts automatically, so the location of each conflict is initially indicated in the merged version by a blank
yellow block. As you make selections to resolve the conflicts, the blank yellow blocks get filled in with the selected text and are annotated:
You can think of the Merge tool as a special-purpose text editor: it combines the contents of two files, producing a third file as the result. Like any text editor, the Merge tool provides you with a set of editing and navigation functions; you have a lot of flexibility in choosing which functions to use, and in which order.
But the Merge tool does enforce this requirement: you must resolve all the conflicting changes between the contributor versions before you can complete a merge operation. Thus, Merge tool usage follows this basic pattern:
•
If the
Their changes mode button is selected, the navigation buttons traverse just the change sections in which the left-hand (or upper)contributor differs from the
closest common ancestor.
•
If the
All the changes mode button is selected, the navigation buttons traverse all the change sections.
•
If the
My changes mode button is selected, the navigation buttons traverse just the change sections in which the right-hand (or lower) contributor differs from the
closest common ancestor.
•
If the
Conflicts mode button is selected, the navigation buttons traverse just the sections with
conflicting changes.
Whenever you use one of these buttons (except for
Search) to jump to a particular change section, the Merge tool remembers it as the
current change. Selecting a particular change section by left-clicking it in either contributor pane makes it the current change.
For example, "2 of 4" might mean "you are currently in My changes mode, and you are currently at the 2nd of 4 such changes".
Sometimes, the Merge tool can construct a merged version without any help from you. This occurs if all the change sections are non-conflicting. The Merge tool just applies all the changes to the merged version and announces that it's done. This section describes the more interesting case: the contributors have one or more conflicts, which
you must resolve.
The Merge tool automatically jumps to the first conflict. That is, it scrolls to the first yellow-highlighted change section in the contributors, and the corresponding blank yellow block in the merged version. It's up to you to decide which of the changes is to be incorporated into the merged version. You indicate your decision using the conflict-resolution toolbar buttons.

·
|
Click the Take common ancestor change toolbar button to incorporate the original block from the closest common ancestor.
|
·
|
Click the Take my change toolbar button to incorporate the changed block from the right-hand (or lower) contributor (file in your workspace).
|
2.
|
Hold down the Ctrl key, and click another conflict-resolution button. The newly selected block is sent to the merged version, below the previously selected block. The conflict-resolution buttons are annotated with numbers, indicating the order you selected. (And the tooltip reminds you of this "multiselect" capability.)
|
You can undo a multiselect by clicking any of the conflict-resolution buttons without holding down the
Ctrl key. Typically, you'll need to do some manual editing to "smooth out" the combined changes of a multiselect.
The following two conflict-resolution buttons make large-scale changes -- use them carefully! They both effectively override the Merge tool's automatic inclusion of non-conflicting changes into the merged version.
·
|
The Revert all of my changes button makes the merged version the same as the left-hand (or upper) contributor version.
|
·
|
The Use only my changes button makes the merged version the same as the right-hand (or lower) contributor version.
|
When you click one or more conflict-resolution buttons to resolve a conflict, the selected block(s) appear in the merged version and the highlight changes from yellow (unresolved) to blue (resolved). This also decrements the change section counter in the Merge toolbar.
Use the
Next navigation button to scroll down to the next conflict. (It may take more than one click if your are not in
Conflicts navigation mode.) Again, use one of the "take change" buttons to select the text from the left contributor or the right contributor (or both of them).
You don't have to resolve the conflicts in order. You can jump around as much as you want among the change sections, or scroll through unchanged sections to look up information the affects your merge decisions.
You can change your merge decisions as much as you want. For example, you can navigate to a particular change section where you had selected
Take their change, and then click the
Take my change button. This swaps out their change and swaps in your change.
Warning: swaps of this kind also discard any manual edits that you have made in that section after initially selecting it.
If you want to discard all your merge work, close the Merge tab to abandon the merge session entirely.

At any time during a Merge tool session, you can manually edit the contents of the merged version. Just click anywhere in the pane containing the merged version, and type. The
Delete and
Backspace keys work as expected. Using context (right-click) menus or the GUI main menu, you can
Cut, Copy, and
Paste sections of text that you've highlighted with the mouse. You can also use the common keyboard shortcuts:
Ctrl-C or
Ctrl-Ins to copy,
Ctrl-V or
Shift-Ins to paste.
Warning: If you make changes manually within a conflict section that you've resolved with one of the conflict-resolution buttons, the manual changes will be overwritten if you return to that section and click any conflict-resolution button.
Sometimes, there is a block of lines in a contributor version that you consider to be a single change section, but that the Merge tool decides are two separate sections. You can combine the two change sections:
·
|
Clicking Keep & Exit ends the merge session immediately, closing the Merge tab. AccuRev overwrites the file in your workspace with the merged version. Then, it a Keeps a new version in your workspace stream, to preserve the merge results. The overlap status of the file is removed, so that you can now Promote the new version to the backing stream.
|
·
|
Clicking Review continues the merge session. This enables you to review your work, change some of your merge decisions, and perform manual edits. At any time, you can click the Keep button in the Merge toolbar to complete the merge process.
|
As of AccuRev Release 4.9, the merge command is now smarter about simple merges, resulting in simplified display of merge lines in the Version Browser, and simplified change packages. For example, assume two developers are working in parallel on the same element, with a common ancestor, and there are only regular versions (that is, no patches, merges, or reversions) between the current versions and the common ancestor. When these are merged, the resulting version of the merge is rebased to point to the merged version as its basis. Also, the new basis version is added to the Comment field upon
keep.
(appears for file with .htm or
.html suffix only) Toggle switch: display the context of the merged version as plain text, or render the contents as HTML.