Edgewall Software

Version 4 (modified by Christian Boos, 17 years ago) ( diff )

Synchronized the documentation with [1792]

Trac Diff Module

Note 1: this module is currently being developed in source:branches/cboos-dev/anydiff-branch development branch. Please use [1792] for testing.

Note 2: that page is a prototype for the Diff documentation. It will eventually be merged with the TracChangeset documentation page.

The Different Ways of Preparing a Diff

Examining Differences Between Revisions

A very frequent need is to look at changes made on a file or on a directory spanning multiple revisions. In the TracLog view, one can select the old and the new revision of the path being examined, and then select the Diff operation.

Examining Arbitrary Differences

One of the main feature of source configuration management systems is the possibility to work simultaneously on alternate Lines of Developments, or branches. The evolution of branches are often made in parallel, making it sometimes difficult to understand the exact set of differences between alternative versions.

This is where Trac comes to the rescue: in the TracBrowser, the path/revision currently examined can be selected to be the Base (i.e. the old path/revision pair) for a Diff operation. The TracBrowser enters in a specific Diff mode reminding you to select a Target (i.e. the new path/revision pair).

The resulting set of differences consist in the changes that should be applied on the Base in order to make it look like the Target of the Diff.

For convenience, it is possible to invert the roles for the old and the new path/revision pairs by clicking the Reverse Diff link on the diff page.

Checking the Last Changes

The last possibility for looking at changes is to have a quick look on the Previous Diff while browsing a file or a directory.

This shows the relevant TracChangeset information, but restricted to the path being browsed, and with a link to the next Previous Diff, making it convenient to look at the history of the changes for a given path.

Of course, if one is doing that on the root of the repository, there will be no path restriction and the full changeset will be shown.

Looking at the Differences

See TracChangeset for now, as the display of the differences is identical to what is described there. Actually, the TracChangeset is now a particular case of TracDiff.

Note however that the Changeset information is only displayed when it makes sense, i.e. when there's only one changeset involved in the difference being examined.


In order to test the above features:

  • either extract the branch, but it's slightly out-of-date compared to the trunk
  • or apply the changes on top of the trunk ([1792] as of this writing)

For the second option:

$ cd trac/trunk
$ svn merge -r 1760:1792 http://svn.edgewall.com/repos/trac/branches/cboos-dev/anydiff-branch .
C      trac\mimeview\api.py
C      trac\wiki\formatter.py

Edit the conflicted files and solve the conflicts by selecting the .working version.

I was thinking about providing a checkbox for each file entry in order to generate a diff containing only the selected changes (cherry-picking support). A similar feature has also been requested in #1662.

Please feel free to test, as the feature set won't change much now, and add your observations here

Note: See TracWiki for help on using the wiki.