Comparing files with BeeDiff

Vive la Différence


BeeDiff compares two files and quickly displays the differences in a convenient desktop GUI interface.

By Florian Effenberger

Eric Isselée, Fotolia

Programmers often work with patches that contain the differences between two files. Linux has always had text-based tools for file comparison, such as the classic Unix diff utility. BeeDiff is a comparison tool with a graphic edge: You can compare files from a handy desktop interface, and color-coded changes appear.

Installation

BeeDiff [1] is not available as a prebuilt package with the current versions of Ubuntu and Debian, but it is included with openSUSE.

If you can't find BeeDiff in your distribution's repository, you can always download a binary from the website [2]. At the command line, type tar xvfz beediff_1.7_i586.tar.gz or run your archive manager to unpack the beediff directory with the files. To launch the program, enter beediff at the command line.

On our Ubuntu 8.04 lab system with the Gnome desktop, BeeDiff depends on the libqtgui4 package, which triggered some more dependencies.

Also, the initial launch took longer than expected. The program window (Figure 1) is neat and tidy, with two text boxes, an icon bar, and a status line that contains four counters.

Figure 1: BeeDiff is neat and tidy.
Alternatives to BeeDiff

Because comparing files is part of the developer's daily grind many programs with varying functional scope can compare files. Purists will prefer command-line tools like diff. If you also use Windows and Mac OS X to work on files, the tkdiff [3] GUI is preferable to BeeDiff. KDiff3 [4], Meld [5], or Diffuse [6] have more functions than BeeDiff. Most editors and office packages now offer similar functionality.

Configuration

The BeeDiff interface is fairly self-explanatory. If needed, System | Configure takes you to the basic settings (Figure 2), including upper/lower-case tolerance, tabs, blank lines and spaces, and the font and font color for changes. In most cases, the defaults should be fine.

Figure 2: The color scheme and font are modified in the Configure dialog.

Comparing Files

To compare files, open the files by clicking the ... button above the text windows. It makes sense to load the original file in the left-hand window and the file you want to compare it to in the right-hand window. The tool automatically numbers the lines, but you can disable this in System | Numeration.

Figure 3 shows you a comparison between two text files. The left-hand text window contains the original file, test1.txt, and the right-hand window has a modified version called test2.txt. The status bar tells you that there are a total of 26 differences, including 9 changes, 8 additions, and 9 deletions. Red highlighting indicates line deletions, green indicates changes within a line, and blue shows line insertions. Changes to individual words are highlighted in yellow.

Figure 3: BeeDiff comparing two text files.

Synchronizing Changes

If you want to synchronize the differences between two files, you can do so directly in BeeDiff. The Operations | Remove all from left or Remove all from right function removes the inserted and deleted lines - the lines with red or blue backgrounds - from the left or right files, respectively.

Lines marked in green contain text passages that are unclear to BeeDiff because the software is unable to identify the details of the changes.

Instead of simply discarding the changes, you can select Operations | Merge all to left or Merge all to right. The function attempts to incorporate the changes to one file into the other file, but typically, some manual editing is needed.

Manually Accept Changes

BeeDiff also gives you the option of manually confirming or discarding each change. The arrow icon next to each tagged text position applies the modification to the other file, and an X next to each inserted or deleted line eliminates the whole line. After completing your changes, you can save the file by clicking the floppy disk icon.

Conclusions

BeeDiff is useful for comparing two files and visualizing the changes. Although it is primarily designed for programmers, BeeDiff is also helpful to other users. The ability to individually accept or discard changes is handy, and the fact that both windows are synchronized shows that the developers have considered production use. BeeDiff is still missing a function for re-comparing files at the press of a button after making changes. If you need to compare more complex documents, an office suite that supports version control and change tracking is probably a better choice.

INFO
[1] BeeDiff: http://www.beesoft.org/beediff.html
[2] BeeDiff download: http://www.beesoft.org/download_beediff.html
[3] tkdiff: http://sourceforge.net/projects/tkdiff/
[4] KDiff3: http://kdiff3.sourceforge.net
[5] Meld: http://meld.sourceforge.net
[6] Diffuse: http://diffuse.sourceforge.net
THE AUTHOR

Florian Effenberger has been an open source software evangelist for many years. He is the international Marketing Project Co-Lead and the Marketing contact for the German language versions of OpenOffice.org. Besides this, Florian focuses on designing and managing open source-based school networks.