Diffing Files in AccuRev

By default, AccuRev diffs files using its own Diff Tool. You can also configure AccuRev to use third-party diffing tools.

Diffing Files Overview

Results from file diffing operations (Diff Against Backed or Diff Against Basis, for example) are always displayed in the Diff tab, shown here:

The Diff tab shows the files being compared side by side in realizable panes. The older version is displayed in the left pane, the more recent version is displayed in the right pane. The differences between the files are color-coded, as shown in the following table:

Color

Meaning

Blue

This line has changed.

Green

This line was added.

Red

This line was deleted.

The navigation map, to the right of the vertical scroll bar, shows the relative locations and sizes of the areas that differ between the two files. It uses the same color-coding as the difference sections. Click on any point within the navigation map to scroll directly to that area in the file.

Back to top

Filtering the Display

You can use the following controls to filter the display of two diffed files:

Ignore Whitespace

Controls whether whitespace is taken into account when comparing text lines.

Ignore Changes in Whitespace

Controls whether a change in the amount of whitespace in a text line is considered to be a change to that line.

Ignore Case

Controls whether uppercase and lowercase characters are considered to be the same when comparing text lines.

Back to top

About the Diff Toolbar

The Diff tab provides a toolbar with buttons for navigating file changes and changing the font size used for the display, as shown in the following illustration.

Navigation buttons let you quickly jump to the first, last, next, and previous changes in the file being diffed; you can also center the current change in the display, which can make it easier to understand the context for the change. The numeric field to the right of the navigation buttons shows:

  • The change in the file that currently has focus (the first number)
  • The total number of changes (the second number)

Finally, the two "A" icons allow you to increase or decrease the font size used to display file content, in one pixel increments between 8 and 24 pixels. The font size setting persists between sessions as long as cookies are enabled for your browser.

Diff Tab Display Modes

The right side of the toolbar contains two buttons that allow you to toggle between Context Diff and Full Diff display modes:

  • Context Diff mode shows each change, including five lines of unchanged text above and below the change to provide context.
  • Full Diff mode shows the entire file.

The Diff tab defaults to Context Diff mode for improved performance.

Back to top

Diffing Multiple Files

You can select multiple text files for diffing at a single time. For example, in the File Browser you might want to choose several files to diff at one time, rather than performing the diff operation on each file individually. When you diff multiple files, AccuRev adds a new set of navigational tools to the toolbar, as shown in the following illustration. Like the tools for a single file diff operation, these tools let you navigate quickly from one diffed file to the next, and show you both how many files in total were diffed, and which diffed file is currently displayed.

In this example, the file currently displayed in the Diff tab is locales.xml. One other file was selected for diffing at the same time, as indicated by the value 1 of 2. In this example, you would use either the Next Element or Last Element to display the second diffed file.

Note: You can diff text files only. Examples of text files include files with .txt, .h, .hpp, .c, and .cpp extensions. You cannot diff binary files. If you select both text and binary files, AccuRev displays a warning and allows you to complete or cancel the diff operation.

To diff multiple files at the same time:

  1. Select the files you want AccuRev to diff. You can use Ctrl+ click and Shift+ click to select files.
  2. Run the diff operation (Diff Against Basis, for example).

    The diff operation is performed against the first of the files you selected. Results are shown in the Diff tab.

  3. To examine the diffs in the next file you selected in Step 1, click the Next Element button, as shown in the following illustration:

The Diff tab displays the next file.

Back to top

Accessing Diff Results Using a URL

AccuRev automatically builds a URL for diff operation results. This URL can be:

  • E-mailed using the default e-mail client configured for your Web browser.
  • Opened in a new tab in the Web browser

See Obtaining Web UI Links for more information on this topic.

Back to top

Diff Against

The Diff Against command lets you compare two versions of a text file. It is available in the File Browser, History Browser, and change package entries on the Issues and Changes tabs. See Using AccuWork for more information about issues and change packages.

You can compare file versions in the following contexts:

In addition, AccuRev provides two Diff Against > Overlapping Changes options to help you identify and resolve conflicts between two versions of an element that result in an (overlap) status:

  • Mine - Compares your workspace version against the common ancestor in the backing stream. This option identifies the changes in your workspace that did not come from the backing stream; it is the equivalent of diffing against the last version that you merged with.
  • Theirs - Displays only the changes added to the backing stream since the last time you merged with the backing stream. This option is useful for identifying the changes to the backing stream that caused the overlap condition.

The Overlapping Changes options are available only for elements with an (overlap) status.

Once you choose the versions you want to compare, the results are displayed in the Diff tab. See Diffing Files in AccuRev for more information.

Diff Against Backed or Basis Version

Compares the selected file to another version from AccuRev. To perform the comparison:

  1. In the File Browser, right-click the file you want to diff.
  2. Select Diff Against, then select Backed Version or Basis Version from the context menu.

Alternative: Right-click the file you want to diff in the Issue Edit form's Changes Subtab, then choose Diff Against Basis from the menu.  

Diff Against Other Version

Compares two selected file versions in the History Browser's Summary pane.

To perform the comparison:

  1. Right-click the transaction you want to diff in the History Browser's Summary pane.
  2. Select Diff Against Other from the context menu. The cursor changes to a cross when it is over version listings.
  3. Navigate to the other version in the Summary Pane and click it.

Diff Against Previous Transaction

Identifies changes to a file that occurred during a specific transaction.

To perform this operation:

  1. In the History Browser or the Displaying Active Transactions, click a line in the Summary pane to select a transaction.

    This populates the Versions pane with all files that were part of that transaction.

  2. Right-click any file in the Versions pane.
  3. Choose Diff Prev. Trans. from the context menu to show the changes in that file caused by that transaction alone.

Back to top

Diff Against Basis

This tab appears when a Diff Against Basis command is issued from the context menu in the File Browser.

This command displays the difference between the selected stream and its basis stream. You can display the differences by file or by issue, and switch between the two using the Issue Diff and File Diff buttons once the initial difference has been displayed.

File Diff

If you choose Diff Against Basis (by Files), the File Diff tab appears. This tab shows the source and destination streams for the comparison, and a list of files which differ between the two streams.

The following commands are available in the File Diff tab. Commands are available in both the toolbar and context menu unless noted otherwise.

Save As

Invokes your Web browser's Open command, allowing you to open or save (see Save As) the selected file.

Promote

Opens the Promote dialog box to send the current version of the element to the parent of the current stream. See Promoting Elements.

Annotate

Opens the selected file using the Annotate tool. See Reviewing Changes to Text Files.

History

Shows the history of this file in a History Browser.

Version Browser

Opens the Version Browser, showing the versions of this file in the AccuRev repository.

Diff

Compares this file to its basis versions and shows the resulting comparison in the Diffing Files in AccuRev.

Properties

Displays the Element Properties dialog box for the selected file. See Displaying Element Properties.

Open

Using the Open Commands the selected file.

Code Review

If enabled by your AccuRev administrator, allows you to create a code review for the selected file, or add files to an existing code review. See Submitting AccuRev Elements to Code Reviewfor more information.

Export

See Common Table Commands.

Print

Prints the list of files displayed in the Changes subtab.

Issue Diff

See Diff Against.

Back to top