Diffs

When you view a changelist or code review, the associated files are presented as diffs(noun) A set of lines that do not match when two files are compared. A conflict is a pair of unequal diffs between each of two files and a base. (verb) To compare the contents of files or file revisions. See also conflict., short for differences, showing you how they have changed.

Initial Diff Display

The review revision selectors are used to specify which revisions of a review you want to diff(noun) A set of lines that do not match when two files are compared. A conflict is a pair of unequal diffs between each of two files and a base. (verb) To compare the contents of files or file revisions. See also conflict., they are located in the Files tab above the list of files.

Tip

If a review consists of one or more Swarm-managed changelists. When comparing versions of a review, Swarm is showing any differences between the selected versions, not the review author's personal changelist. See Internal representation for details.

The first row of buttons above the files allow you to (left to right):

Image of Diff Buttons for all Files
Tip

The default states for the Show Comments, Show Diffs Side-by-Side, Toggle Show Whitespace, and Toggle Ignore Whitespace buttons are set in your user settings, see User Settings.

Each file is presented with an icon indicating whether the file was:

The file's presentation can be controlled with (left to right):

Image of Diff Buttons for a Single File

Viewing a diff

When you view a diff, the changes are highlighted:

Image of a Side-by-Side Diff with Changes

 

Image of a Side-by-Side Diff Showing the Final Change in a File

Show more context buttons

The diff presentation displays a concise view of where changes were made within a file, showing the changed lines and only a few lines before and after the change. Sometimes, this concise view needs to be expanded to fully understand the context of the change, use the Show More and Show All buttons to display extra lines around the change:

Note

By default, the number of extra lines displayed when you click the Show More Lines Above and Show More Lines Below buttons is 10. This setting can be changed by your Swarm administrator, see More context lines.

Comments

Comments can be displayed within the body of a file and appear immediately below the line the commenter targeted for comment. See Comments for more details.

Image of a Side-by-Side Diff with a Comment Displayed
Note

The comment here icon Comments Here icon image appears in the line number column whenever there is a comment. Click the icon to display the comment and click the icon again to collapse the comment. This is useful when the comment display is toggled off.

Inline diff view

When viewing a diff in-line, the line numbers for the old version are first, the line numbers for the new version are second, and they are followed by the file content. Some users find it easier to use this view to locate an area that has changed, but they then switch to the side-by-side view to understand the change better. Swarm maintains the scroll position, you do not lose your place in the file after toggling the diff view.

Inline Diff image
Note

Press n on your keyboard to scroll to the next changed area within a file. Press p to scroll to the previous change.

Per-file toolbar

When a diff contains multiple files, the changes can be taller than your browser window. Swarm keeps the per-file toolbar in view for each file as you scroll, this means that you can identify the file and control its presentation with the buttons on the right of the toolbar.

Image of the Per-file Toolbars Stay in View as You Scroll