Computer Laboratory

TortoiseMerge and TortoiseDiff - viewing differences

This information is from TortoiseSVN Help

As an author, it is likely that you will want to look at differences between two revisions of the same file, or two separate files.

TortoiseMerge was created just for this purpose.
(TortoiseIDiff is used to view differences between image files).

Revision graph

Before you view changes between files, it is obviously helpful to know what revision you are working in and the past revision you want to check.

SVNTortoise provides a useful facility called the Revision graph which allows you to see what revisions you have been working at.

To view a revision graph, right click either the directory or the file, and select SVN Tortoise -> Revision graph.

The following are examples of what you might see:

A revision graph of a directory
A revision graph of a file

How to view differences between files

  • Local changes

    - to view changes in your working copy.
    • Select TortoiseSVN -> Diff.
  • Difference to another branch/tag

    - to view changes on the trunk (if you are working on a branch) or on a specific branch (if you are working on trunk):
    • Use the Explorer context menu.
    • Hold down the Shift key while you right click on the file.
    • Select TortoiseSVN -> Diff with URL.
    • In the dialogue box which appears, specify the URL in the repository with which you want to compare your local file to.
    You can also use the repository browser and select two trees to diff:
    i.e.two tags, or a branch/tag and trunk.
    Here you would use the Compare revisions command.

  • Difference from a previous revision

    - to view a difference between a particular revision and your working copy:
    • Use the Revision Log dialogue box.
    • Select the revision of interest, then select Compare with working copy from the context menu.
  • Difference between two previous revisions

    - to view the difference between two revisions which are already committed:
    • Use the Revision Log dialogue box and select the two revisions you want to compare.
    • Select Compare revisions from the context menu.
    If you did this from the revision log for a folder, a Compare Revisions dialogue box appears, showing a list of changed files in that folder.

  • All changes made in a commit

    - to view the changes made to all files in a particular revision in one view.
    • Use Unified-Diff output (GNU patch format).
      This shows only the differences with a few lines of context.
      It is harder to read than a visual file compare, but will show all the changes together.
    • From the Revision Log dialogue box, select the revision of interest.
    • Select Show Differences as Unified-Diff from the context menu.

  • Difference between files

    - to view differences between two different files:
    • In explorer, select both files using Ctrl-modifier.
    • Select TortoiseSVN -> Diff from the context menu.

  • Difference between a working copy file/folder and a URL

    - to view the differences between a file in your working copy, and a file in any Subversion repository:
    • In explorer, select the file, then press the Shift key whilst right clicking to obtain the context menu.
    • Select TortoiseSVN -> Diff with URL.
      The same applies for a working copy folder.
      TortoiseMerge shows these differences as a list of changed files which you can view one at a time.

  • Difference with blame information

    - to view the differences but also the author, revision and date that changes were made:
    For information about combining the diff and blame reports go to Section 5.20.2, "Blame Differences" of the TortoiseSVN Help.

  • Difference between folders

    The built-in tools supplied with TortoiseSVN do not support viewing differences between directory hierarchies.
    Section 5.9.4, "External Diff/Merge Tools" of the TortoiseSVN Help talks about tools which can be used for this function.

Comparing files

  • Use context menu -> Compare revisions to select two trees within the repository browser, or two revisions of a folder in the log dialog,
  • The Changed Files dialogue box (below) shows a list of all changed files. You can compare or blame these files individually using the context menu.
    compare revisions dialogue box
  • You can export the list of changed files to a text file, or export the changed files to a folder.
    (This only works on the selected files, so you need to select the files of interest - usually all of them.
  • To export the list of files and the actions (modified, added, deleted), use the keyboard shortcuts Ctrl-A to select all entries and Ctrl-C to copy the detailed list to the clipboard.
  • The compare revisions button button changes the direction of comparison, i.e. showing the changes needed to get from A to B, or if prefered, from B to A.

TortoiseDiff for images

This shows the TortoiseIDiff image viewer:
tortoise diff viewer dialogue box

  • Using TortoiseSVN -> Diff for any of the common image file formats will start TortoiseIDiff and show image differences.
  • By default, images are displayed side-by-side but you can use the View menu or toolbar to switch to a top-bottom view or to overlay images as if using a lightbox.
    A slider controls the relative intensity of the images (alpha blend) and Ctrl-Shift-Wheel changes the blend.
  • Zoom in and out and pan facilities are also available.
    Select the Link images together option, then the pan controls (scrollbars, wheelmouse) on both images are linked.
  • An image info box shows details about the image file: size in pixels, resolution and colour depth.
    If this box gets in the way, use View ->Image Info to hide it.