Editing a File Using the Diff Tool
In addition to comparing two versions of a file, the Diff tool can help you to edit the contents of the version in your workspace. This "edit-by-diff" capability is available only when you're comparing your workspace version with another version; it's not available when you invoke the Diff tool from the Version Browser or History Browser.
Using the Diff Tool
Here's a procedure for using this capability (see the toolbar button summary below):
- Invoke the Diff tool in a File Browser, to compare your workspace version with some other ("before") version of the same file.
Click the Show result of edits button in the Diff toolbar. This opens a third pane (the Edit pane), which initially contains the same text as your workspace version.
As you browse through the difference sections, you can:
- Edit text manually in the Edit pane.
- Click the Revert my change toolbar button to swap in the "before" version's text at that point (a change, addition, or deletion). The button becomes highlighted to indicate your selection.
Include both the "before" and "after" versions' text at that point: click the Revert My Change toolbar button, then hold down the Ctrl key and click the Restore my change toolbar button.
Alternatively, click the two buttons in the opposite order. Both buttons become highlighted, and number annotations indicate the order you selected:
You can then modify the combined text manually.
- Change your mind about a difference section where you've used and/or , by selecting that section and clicking one of those buttons. Any manual edits you've made in that difference section are lost.
- Click the Revert all of my changes button to make the Edit pane the same as the "before" version.
- Click the Restore all of my changes button to make the Edit pane the same as the "after" version.
Finish your work in either of these ways:
- Click the Save edits and close toolbar button. This simply replaces the file in your workspace. (It doesn't perform an AccuRev Keep command.)
- Close the Diff tab to cancel the edit-by-diff session. No changes are saved to the file in your workspace.
Note: Edit-by-Diff vs. Merge
Using the edit-by-diff capability is similar to using the Merge Tool (see The AccuRev Merge Tool). But there's an important difference:
- An edit-by-diff operation involves just two versions.
- A merge operation takes into account a third version: the closest common ancestor of the two versions being merged.
Diff Previous Transaction Error
This error box appears when the selected version is the first version created in a stream or workspace. Thus, the search for a prior version in the stream or workspace fails.
Diff Toolbar Edit-by-Diff Buttons
Revert my change
Use the "before" version's section at this point. If the button is currently highlighted, you can hold down the Ctrl key and press to append the "before" section to the workspace version's section.
Restore my change
Use the workspace version's section at this point. If the button is currently highlighted, you can hold down the Ctrl key and press to append the workspace version's section to the "before" section.
Revert all my changes
Make the Edit pane the same as the "before" version.
Restore all my changes
Make the Edit pane the same as the "after" version.
Save edits and close
Store the current contents of the Edit pane in the workspace's file, without performing a Keep operation.