MPS 2017.2 Help

Viewing Changes Information

This sections explains different ways to keep track of the changes that you and your teammates introduce to the source code.

Reviewing project history

MPS allows you to review all changes made to the project sources that match the specified filters.

For distributed version control systems, such as Git and Mercurial, you can view project history in the Log tab of the Version Control tool window.

For centralised version control systems, such as Subversion, Perforce, CVS, ClearCase, and TFS, project history is available in the Repository tab of the Version Control tool window.

Tracking changes to a file in the editor

As you modify a file that is under version control, all changes are highlighted in the editor with change markers that appear in the left gutter next to the modified lines and show the type of changes introduced since the last synchronization with the repository. When you commit the modified file to the repository, the change markers disappear.

The changes you introduce to the text are color-coded:

  • /help/img/idea/2017.2/lineAddedMarker.png line added.
  • /help/img/idea/2017.2/lineChangededMarker.png line changed.

When you delete a line, the following marker appears in the left gutter: /help/img/idea/2017.2/deleted_line_marker.png.

You can manage changes using the dedicated toolbar. To invoke it, hover the mouse cursor over a change marker and then click it. The toolbar is displayed together with a frame showing the previous contents of the modified line:

/help/img/idea/2017.2/changeMarkerToolbar.png

You can perform the following operations:

ItemTooltip and ShortcutDescription
Previous Change / Next Change
/help/img/idea/2017.2/arrowUp.png / /help/img/idea/2017.2/arrowDown.png
N/A N/A Use these buttons to navigate between changes.
Rollback
/help/img/idea/2017.2/rollback.png
N/A Click this icon to rollback the changes. Note that all changes to the file since its last revision will be reverted, not just the current line.
/help/img/idea/2017.2/compareIcon.png Show Diff
N/A
Click this icon to explore the differences between the current and the repository version of the current line in the Diff for Range dialog.
/help/img/idea/2017.2/copy.gif Copy
N/A
Click this icon to copy the previous version of the modified line to the clipboard.
/help/img/idea/2017.2/detailed_diff.png Show Detailed Differences Toggle this icon to change the way differences to modified lines are presented when you click the line changed change marker. If enabled, the differences are highlighted with the corresponding color:
/help/img/idea/2017.2/highlight_change.png

Comparing local changes with the repository version

Apart from navigating through your local changes within a file in the editor, you can review these changes compared to the base revision of the file in question.

You can review changes in one of the following ways:

  • In the Change Details pane in the Local Changes tab of the Version Control tool window. Select a file you want to review in the Local Changes tab and click the Preview Diff /help/img/idea/2017.2/previewUsages.png button on the toolbar.
  • In the Differences Viewer. To invoke the Differences Viewer do one of the following:
    • Select a file you want to review in the Local Changes tab and press N/A
    • Click the Show Diff icon /help/img/idea/2017.2/icon_showDiff.png on the toolbar.
    • Right-click a file you want to review and select Show Diff or <your_VCS> | Compare With Latest Repository Version from the context menu.

The left pane shows the affected code as it was in the base revision, and the right page shows the affected code after changes have been made.

Use the toolbar buttons and controls to navigate between changes and configure the appearance of the Change Details pane or the Differences Viewer:

ItemTooltip and ShortcutDescription
/help/img/idea/2017.2/arrowUp.png/help/img/idea/2017.2/arrowDown.pngPrevious Difference / Next Difference N/A N/A
Use these buttons to jump to the next/previous difference.

When the last/first difference is hit, MPS suggests to click the arrow buttons N/A/N/A once more and compare other files, depending on the Go to the next file after reaching last change option in the Differences Viewer settings.

This behavior is supported only when the Differences Viewer is invoked from the Version Control tool window.

/help/img/idea/2017.2/comparePreviousFile.png
/help/img/idea/2017.2/compareNextFile.png
Compare Previous/Next File
N/AN/A
Click these buttons to compare the local copy of the previous/next file with its update from the server.
/help/img/idea/2017.2/edit.png Jump to Source
N/A
Click this button to open the selected file in the active pane in the editor. The caret will be placed in the same position as in the Differences Viewer.
Viewer type
/help/img/idea/2017.2/diffViewer_type.png
Use this drop-down list to choose the desired viewer type. The side-by-side viewer has two panels; the unified viewer has one panel only.

Both types of viewers enable you to

  • Edit code. Note that one can change text only in the right-hand part of the default viewer, or, in case of the unified viewer, in the lower ("after") line, i.e. in your local version of the file.
  • Perform the Apply/Append/Revert actions.
Whitespace
/help/img/idea/2017.2/diffViewer_whitespaces.png
Use this drop-down list to define how the differences viewer should treat white spaces in the text.
  • Do not ignore: white spaces are important, and all differences are highlighted. This option is selected by default.
  • Trim whitespaces: ("\t", " "), if they appear in the end and in the beginning of a line.
    • If two lines differ in trailing whitespaces only, these lines are considered equal.
    • If two lines are different, such trailing whitespaces are not highlighted in the By word mode.
  • Ignore whitespaces: white spaces are not important, regardless of their location in the source code.
  • Ignore whitespaces and empty lines: the following entities are ignored:
    • all whitespaces (as in the 'Ignore whitespaces' option)
    • all added or removed lines consisting of whitespaces only
    • all changes consisting of splitting or joining lines without changes to non-whitespace parts.
      For example, changing a b c to a \n b c is not highlighted in this mode.
Highlighting mode
/help/img/idea/2017.2/diffViewer_highlight.png
Select the way differences granularity is highlighted.
The available options are:
  • Highlight words: the modified words are highlighted
  • Highlight lines: the modified lines are highlighted
  • Highlight split changes: if this option is selected, big changes are split into smaller 'atomic' changes.
    For example, A \n B vs. A X \n B X will be treated as two changes instead of one.
  • Do not highlight: if this option is selected, the differences are not highlighted at all. This option is intended for significantly modified files, where highlighting only introduces additional difficulties.
/help/img/idea/2017.2/collapseAll.png Collapse unchanged fragmentsClick this button to collapse all unchanged fragments in both files. The amount of non-collapsible unchanged lines is configurable in the Diff & Merge settings page.
/help/img/idea/2017.2/sync_scrolling.pngSynchronize scrollingClick this button to simultaneously scroll both differences panes; if this button is released, each of the panes can be scrolled independently.
/help/img/idea/2017.2/cogwheel_blue_with_arrow.pngEditor settingsClick this button to invoke the list of available settings. Select or clear this options to show or hide whitespaces, line numbers and indent guides, to use or disable the use of soft wraps, and to set the highlighting level.

These commands are also available from the context menu of the differences viewer gutter.

/help/img/idea/2017.2/external_tool.pngShow diff in external toolClick this button to invoke an external differences viewer, specified in the External Diff Tools settings page.

This button only appears on the toolbar when the Use external diff tool option is enabled in the External Diff Tools settings page.

/help/img/idea/2017.2/icon_help.pngHelp
N/A
Click this button to show the corresponding help page.
N/A Annotate

This option is only available from the context menu of the gutter.

Use this option to explore who introduced which changes to the repository version of the file in question, and when. The annotations view lets you see detailed information for each line of code, such as the version from which this line originated, the ID of the user who committed this line, and the commit date.

You can configure the amount of information displayed in the annotations pane.

For more details on annotations, refer to Viewing Changes Information

The most useful shortcuts are the following:

ShortcutDescription
Use this keyboard shortcut to show the popup menu of the most commonly user diff commands.
N/A Use this keyboard shortcut to switch between the left and the right panes.
N/A Use this keyboard shortcut to select the position obtained by N/A in the opposite pane.
N/A/N/A Use this keyboard shortcut to undo/redo a merge operation. Conflicts will be kept in sync with the text.

Viewing changes history for a file or selection

MPS allows you to review changes made to files or even fragments of source code. The Show History and the Show History for Selection commands are available from the main VCS menu and from the context menu of files.

The change history for a file is displayed in the dedicated History tab of the Version Control tool window.

The change history for a selection of code is displayed in a separate window, in the form of the differences viewer.

Viewing the History for a File

Do one of the following:

  • Open a file in the editor. Then, on the main VCS menu or on the context menu of the editor tab, choose <VCS> | Show History.
  • In the Project tool window, right-click a file and choose <VCS> | Show History from the context menu.

The History tab for the selected file appears in the Version Control tool window, the name of the file is shown on the title bar of the tab.

You can use the toolbar buttons to compare the selected revision with the local version, compare classes from the selected revision, checkout the selected revision from your VCS, annotate the selected revision, etc.:

ItemTooltip and ShortcutDescription
/help/img/idea/2017.2/icon_showDiff.png Compare
N/A
Click this button to compare the selected revision of a file with its previous revision in the Differences Viewer.
/help/img/idea/2017.2/icon_showDiffLocal.pngShow Diff with LocalClick this button to compare the selected revision of a file with its local copy in the Differences Viewer.
/help/img/idea/2017.2/iconCreatePatch.pngCreate PatchClick this button to create a patch from the selected revision.
/help/img/idea/2017.2/historyViewGetIcon.pngGetClick this button to retrieve the selected revision. If the local copy has already been modified, MPS prompts to overwrite the local version, or cancel the operation.
/help/img/idea/2017.2/annotate-details.pngAnnotateClick this button to open the selected revision of a file in the editor with annotations.
/help/img/idea/2017.2/showAffectedFiles.pngShow All Affected Files
N/A
Click this button to open the Paths Affected in Revision dialog where you can view all files that were modified in the selected revision.
/help/img/idea/2017.2/copy.gifCopy Revision NumberClick this button to copy the revision number of the commit that the selected file belongs to to the clipboard.
/help/img/idea/2017.2/icon_UML.pngCompare all classes from revision on UML
N/A
Click this button to view all classes of the selected revision as a UML Class diagram. See section Viewing Changes as Diagram.
/help/img/idea/2017.2/openGitHub.pngOpen in GitHubClick this button to open the page that corresponds to the selected commit on GitHub.
/help/img/idea/2017.2/showAllBranchesIcon.png Show All Branches Click this button to display changes from branches other than the current one.
/help/img/idea/2017.2/hierarchyClassButton.pngShow Branches

Click this button to show branches.

/help/img/idea/2017.2/icon_ChangeListShowAll.pngShow All Revisions Submitted In Selected Changelist

Click this button to display the list of all revisions committed in the same changelist as the selected revision of a file.

/help/img/idea/2017.2/refresh.pngRefreshClick this button to refresh the current information.
/help/img/idea/2017.2/showDetails.pngShow DetailsClick this button to show the commit message for the selected revision.
/help/img/idea/2017.2/close.pngClose
N/A
Click this button to close the current history tab.

Viewing the History for a Selection

  1. In the editor, select a fragment of the source code.
  2. Choose <VCS> | Show History for Selection from the main VCS menu, or on the context menu of the selection.

The history for the selected fragment will open in a separate window.

Checking file status

MPS allows you to check the status of project files relative to the repository. File status shows you which operations have been performed on the file in question since you last synchronized with the repository.

You can check the status of a file in any interface element (e.g. the editor, or various tool windows) by the color used to highlight the file name.

ColorFile StatusDescription
BlackUp to dateFile is unchanged.
/help/img/idea/2017.2/highlightBlackTxt.GIF
Gray DeletedFile is scheduled for deletion from the repository.
/help/img/idea/2017.2/highlightGrey.gif
Blue ModifiedFile has changed since the last synchronization.
/help/img/idea/2017.2/highlightBlueTxt.GIF
Green AddedFile is scheduled for addition to the repository.
/help/img/idea/2017.2/highlightGreenTxt.GIF
Violet MergedFile is merged by your VCS as a result of an update.
/help/img/idea/2017.2/highlightVioletTxt.GIF
Brown UnversionedFile exists locally, but is not in the repository, and is not scheduled for adding.
/help/img/idea/2017.2/highlightBrown.gif
Olive IgnoredFile will be ignored in any VCS operation.
/help/img/idea/2017.2/highlightOlive.gif
Light brown HijackedFile is modified without checkout. This status is valid for the files under Perforce, ClearCase and VSS.
hijacked
Red Merged with conflictsDuring the last update, file was merged with conflicts.
/help/img/idea/2017.2/highlightRedTxt.GIF
Lilac Externally deletedFile is deleted locally, but was not scheduled for deletion, and still exists in the CVS repository.
/help/img/idea/2017.2/highlightLilac.gif
Dark cyan SwitchedThe file is taken from a different branch than the whole project. This status is valid for CVS and SVN.
/help/img/idea/2017.2/highlightCyanTxt.GIF

Using annotations

What are VCS annotations?

Annotation is a form of file presentation that shows detailed information for each line of code. In particular, for each line you can see the version from which this line originated, the user ID of the person who committed this line, and the commit date. The annotated view helps you find out who did what and when, and trace back the changes.

Annotating lines of code is available for ClearCase, TFS, Mercurial, Git, CVS, Perforce and Subversion.

The Annotate command is available from VCS-specific nodes of the Version Control menu, the context menu of the Editor left gutter, file context menus, and the file history view.

When annotations are enabled, the left gutter looks similar to the following example:

/help/img/idea/2017.2/annotate.png

Configuring the amount of information shown in the annotations pane

  1. Enable annotations and right-click the annotations gutter.
  2. Select View in the context menu and select or deselect the following options:
    • Revision: select this option if you want to see the number of the changelist within which the annotated changes were checked in.
    • Date: select this option if you want to see the date when the annotated changes were checked in.
    • Author: select this option if you want to see the name of the user who checked in the annotated changes.
    • Commit number: select this option if you want to see the revision number of the current file.
    • Colors: use this control to toggle between the following highlighting modes:
      • Author: select this option if you want to highlight changes made by different authors with different colors.
      • Order: select this option if you want annotation colors to indicate how long ago a change was made. The entire file history is divided into several time periods containing an equal number of commits, and each time period is assigned its own color. The most recent changes are highlighted in green, while the oldest changes are highlighted in red:
        /help/img/idea/2017.2/annotations_order.png
      • Hide: select this option if you do not want to use color highlighting. In this case, all annotations will be displayed in gray.
    • Names: use this control to select how user names will be displayed. The following options are available:
      • Last name
      • First name
      • Full name
  3. To view a commit message for an annotated change, hover the mouse cursor over an annotation. A tooltip will appear showing the commit message for the corresponding change:
    annotation_popup.png

Annotating previous revisions

MPS lets you annotate not only the current file revision, but also it's previous revisions. The following options are available from the context menu of the annotations gutter:

  • Annotate Revision: this option is useful if you want to check what a file looked like after a particular change was committed. To do this, right-click this change and select Annotate Revision from the context menu.
  • Annotate Previous Revision: this option is useful if you find yourself in a situation when the last change in a particular line is meaningless, for example if all that was changed is code formatting. In this case, you can check what the previous revision of the file looked like. To do this, right-click a change and select Annotate Previous Revision from the context menu.

You can also annotate a particular file from the file history view. In the History tab, select the file version you want to review, right-click the corresponding line and select Annotate from the context menu.

Viewing the differences between revisions

To review the differences between the annotated version of a file and its previous version, position the cursor on an annotation, right-click it and select Show Diff from the context menu. MPS opens the Differences Viewer:

/help/img/idea/2017.2/annotations_show_diff.png

Navigating to log

If you are using Git for version control, you can also jump from the annotations view to the corresponding commit in the Log tab of the Version Control tool window.

To do this, position the cursor on an annotation, right-click it and select Select in Git log from the context menu. You can also use the Copy revision number command to located a revision in the log.

For projects hosted on https://github.com/, the Open on GitHub command is also available that takes you to the corresponding commit.

Last modified: 26 October 2017

See Also